Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/elilambnz/react-py

Effortlessly run Python code in your React apps.
https://github.com/elilambnz/react-py

pyodide python react repl

Last synced: about 2 months ago
JSON representation

Effortlessly run Python code in your React apps.

Awesome Lists containing this project

README

        



react-py


react-py


Effortlessly run Python code in your React apps. Try it out!


CI
CodeQL
MIT License
NPM Version
NPM Bundle Size

---

> ✨ PyRepl.io is a Python interpreter in your browser. Embed interactive Python examples in your documentation, blog posts, presentations and more. Get started for free.

## Quickstart

Install `react-py` with:

```sh
npm install react-py
```

Then, wrap your app in a `PythonProvider` component.

```tsx
import { PythonProvider } from 'react-py'

function App() {
return (
// Add the provider to your app



)
}

render(, document.getElementById('root'))
```

Using the `usePython` hook, you can run code and access both stdout and stderr. For full usage instructions and framework specific guides, see the [usage docs](https://elilambnz.github.io/react-py/docs/introduction/usage).

## Documentation

For full documentation, visit [elilambnz.github.io/react-py](https://elilambnz.github.io/react-py).

## Examples

[Basic Example](https://elilambnz.github.io/react-py/docs/examples/basic-example)

[REPL](https://elilambnz.github.io/react-py/docs/examples/repl)

[Interrupting Execution](https://elilambnz.github.io/react-py/docs/examples/interrupting-execution)

[Using Packages](https://elilambnz.github.io/react-py/docs/examples/using-packages)

[File System](https://elilambnz.github.io/react-py/docs/examples/file-system)

[Custom Modules](https://elilambnz.github.io/react-py/docs/examples/custom-modules)

[Making API Calls](https://elilambnz.github.io/react-py/docs/examples/making-api-calls)

[User Input](https://elilambnz.github.io/react-py/docs/examples/user-input)

[Data Visualisation](https://elilambnz.github.io/react-py/docs/examples/data-visualisation)

## Limitations

Most of the Python standard library is functional, except from some modules. The following modules can be imported, but are not functional due to the limitations of the WebAssembly VM:

- multiprocessing
- threading
- sockets

[Learn more about the limitations here](https://pyodide.org/en/stable/usage/wasm-constraints.html).

## License

_react-py_ is available under the MIT License.

## Contact

Eli Lamb - [elilambnz](https://github.com/elilambnz)
James Ansley - [James-Ansley](https://github.com/James-Ansley)

## Acknowledgments

This project uses [Pyodide](https://pyodide.org), a Python distribution for the browser and Node.js based on WebAssembly.

## Contributing

If you're interested in contributing, please read our [contributing docs](https://github.com/elilambnz/react-py/blob/master/CONTRIBUTING.md) **before submitting a pull request**.