https://github.com/jon-edward/web_python
https://github.com/jon-edward/web_python
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jon-edward/web_python
- Owner: jon-edward
- License: mit
- Created: 2024-09-28T21:07:10.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-11-02T13:12:50.000Z (7 months ago)
- Last Synced: 2024-11-02T14:19:17.034Z (7 months ago)
- Language: TypeScript
- Homepage: https://jon.is-a.dev/web_python/
- Size: 132 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# web_python
This is a browser-based Python interpreter (using
[Pyodide](https://pyodide.org/en/stable/)) which allows the user to mount
a local project directory and run an entry point script from within the
directory.
## Building from source
```bash
npm install
npm run build
```## Notes
Mounting a local directory is currently only available in
**Chromium-based browsers** (ie. Chrome, Edge), which means
this will likely not work on other browsers. Progress toward making this
widely available is on [MDN's Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/requestPermission).The interpreter is run within a web worker, and stdout/stderr is handled
through messages between the main running thread and the worker. This is
convenient for keeping the main thread open for UI, but makes print
operations relatively slow; because of this, you may want to write logs to
a file instead of feeding it all to the console for large amounts of
logging.Lines of `requirements.txt` (if it exists in the project
directory) are fed directly to `micropip.install`, which
allows for very simple package installation when a pure Python wheel is
available. See [packages built by Pyodide](https://pyodide.org/en/stable/usage/packages-in-pyodide.html)
for some common packages which don't have a pure Python wheel.Static type checking is available using [mypy](https://mypy-lang.org/).
The site polls for changes to the project directory and
feeds mypy's report to a separate terminal panel. This can be disabled
if desired.