Skip to content

jon-edward/web_python

Repository files navigation

web_python

This is a browser-based Python interpreter (using Pyodide) which allows the user to mount a local project directory and run an entry point script from within the directory.

web_python UI

Building from source

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.

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 for some common packages which don't have a pure Python wheel.

Static type checking is available using mypy. 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.

About

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published