Effortlessly run Python code in your React apps
npm install react-py
Effortlessly run Python code in your React apps.
---
You can try out react-py in the playground.
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(
`
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.
For full documentation, visit elilambnz.github.io/react-py.
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.
_react-py_ is available under the MIT License.
Eli Lamb - elilambnz
James Ansley - James-Ansley
This project uses Pyodide, a Python distribution for the browser and Node.js based on WebAssembly.
If you're interested in contributing, please read our contributing docs before submitting a pull request.