How to Use Play Python
1. Start Coding Immediately
Play Python runs Python in your browser using Pyodide (WebAssembly). You can open the editor and run code without creating an account or setting up a local environment. Your script executes in a browser sandbox and the output appears in the Output panel at the bottom.
2. Work with Multiple Files and Folders
- Use the file explorer to create files/folders, rename, move, upload, and delete.
- Open files into tabs; each tab tracks unsaved changes and deleted-file status.
- Download a single file or a full project ZIP from the explorer.
- Your project is synchronized into Pyodide's virtual filesystem automatically when running code/tests.
3. Run, Test, Lint, and Format
- Click Run (or press Ctrl+Enter) to execute the active file.
- Use the arguments bar for command-line args passed into sys.argv.
- Use Test to run pytest against test files in your project.
- Use Lint and Format (Ruff WASM) to check style issues and auto-format code in-browser.
- If your code calls input(), the playground opens an interactive prompt dialog.
4. Install Packages and Use Runtime Settings
- Install Python packages from the package panel (subject to Pyodide compatibility).
- Configure Env Vars from Settings: public/secret variables are injected into Python runtime via os.environ.
- Load env vars from project files such as .env or .env.dev.
- Environment variables are session-local and excluded from shared URLs.
5. Share and Collaborate
- Use Share to generate direct or shortened links for your current project state.
- Start a collaborative session to co-edit files with other users in real time (CRDT-backed sync and presence cursors).
- `.gitignore` rules are applied to URL/share payloads and CRDT participation boundaries.
6. Privacy, Data Flow, and Limits
- By default, code runs locally in your browser; sharing creates portable state URLs.
- Do not put secrets in source files or shared URLs unless you intentionally want to share them.
- Browser/WASM limitations apply (no native subprocesses, no full OS filesystem access).
- Package support depends on Pyodide-compatible distributions.
⚠️ Critical Security Warning
Do not treat the Environment Variables panel as a secure secret vault. It is provided on a best-effort basis for local runtime convenience only.
- Collaborative editor sessions are provided on a best-effort basis and are not guaranteed to be continuously available, stable, synchronized, or recoverable.
- You must always maintain independent backup/coordination plans in case collaborative editing is unavailable or fails.
- If you expose API keys, tokens, passwords, private keys, or other credentials in the Environment Variables panel, you do so entirely at your own risk.
- If you hardcode secrets in files and share a link (including shortened links), those secrets can be exposed because shared state URLs encode project file contents.
- The `.gitignore` feature is best-effort only and makes no guarantee that sensitive material will always be filtered in all cases.
- Play Python is not responsible for any leakage, misuse, compromise, loss, or damages resulting from secret exposure.
- Play Python is not liable for any harm, interruption, data loss, missed deadlines, or damages resulting from collaborative editor service failure or unavailability.
About the Creator
Python Playground is developed and maintained by Jim Chng. Connect on LinkedIn or explore the source code on GitHub.
