Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 15 days ago
JSON representation
Effortlessly run Python code in your React apps.
- Host: GitHub
- URL: https://github.com/elilambnz/react-py
- Owner: elilambnz
- License: mit
- Created: 2022-08-01T11:01:25.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-29T07:36:12.000Z (7 months ago)
- Last Synced: 2024-05-01T16:13:07.908Z (7 months ago)
- Topics: pyodide, python, react, repl
- Language: TypeScript
- Homepage: https://elilambnz.github.io/react-py
- Size: 7.94 MB
- Stars: 209
- Watchers: 4
- Forks: 15
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
Effortlessly run Python code in your React apps.---
## Try it out
You can try out `react-py` [in the playground](https://elilambnz.github.io/react-py/playground).
## 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.
## Maintainers
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**.