Interactive Python notebooks demonstrating Cloudflare services, APIs, and workflows. These examples cover tasks from analyzing logs to writing billing reports, storing files in R2, querying D1 databases, and more!
- Python 3.8+
- Node.js for WASM builds
- Git
Visit notebooks.cloudflare.com to run notebooks directly in your browser using WASM.
This deployment is automatic whenever changes are merged to the main branch
make edit- Starts Marimo server on http://localhost:2718
make security-test- Starts local server for PKCE security integration tests
- Tests OAuth authentication flow with security protections
- See SECURITY-TEST.md for details
- Full Python environment with all packages
- Best for development and testing
make export
make preview- Builds notebooks for web deployment
- Runs locally to preview WASM version
- Matches production environment
# Using Python venv
make edit-notebook notebook=_start.py
# Using uv (faster setup)
make edit-uv-notebook notebook=_start.pyβββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Running: help
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Main workflow:
edit [PYTHON][WORKSPACE][*] Launch marimo edit in workspace mode
export [WASM BUILD][*] Build HTML/WASM and show preview instructions
preview [WASM SERVE][*] Serve the exported notebooks locally
Other commands:
clean-deep Deep clean including removal of the Python virtual environment
clean Remove temporary files, caches, and build artifacts
deploy Run lint, build HTML/WASM, and deploy via npm
edit-notebook [PYTHON][NOTEBOOK] Launch marimo edit for a specific notebook (default: _start.py)
edit-uv-notebook [PYTHON][NOTEBOOK] Launch marimo with uv for a specific notebook (default: _start.py)
edit-uv-workspace [PYTHON][WORKSPACE] Launch marimo with uv in workspace mode
lint Run Python and JavaScript linters
venv Alias to set up Python virtual environment
We welcome contributions! Please see our Contributing Guidelines for details on how to submit pull requests, report issues, and contribute to this project.
- Create your notebook in the
notebooks/directory - Add to configuration in
notebooks.yaml:- title: "My New Notebook" description: "Description of what it does" file: "my_notebook.py"
- Test python locally:
make edit - Test WASM locally:
make export && make preview - Submit a PR with your changes. See
- Local Development: Python virtual environment with Marimo
- Web Deployment: WASM compilation using Pyodide
- Hosting: Cloudflare Workers at notebooks.cloudflare.com
- Local: Standard pip/requirements.txt
- WASM: Pre-installed packages in Pyodide (see package list)
- Cloudflare API Docs: Complete API reference
- Marimo Documentation: Notebook framework guide
- Pyodide Documentation: Python in the browser
"Command not found: make"
- Install Make:
brew install make(macOS) orapt-get install make(Ubuntu)
Port 2718 already in use
- Kill existing process:
lsof -ti:2718 | xargs kill - Or use different port:
make edit(edit Makefile to change port)
WASM build fails
- Clean and rebuild:
make clean && make export - Check package compatibility with Pyodide (see package list)
Virtual environment issues
- Recreate environment:
make clean-deep && make venv
Connect with Cloudflare and the community:
- Discord: Join our Discord server
- Twitter: @Cloudflare and @CloudflareDev
- GitHub: Cloudflare organization
- Blog: Cloudflare Blog
- Developer Hub: developers.cloudflare.com