Add browser Python editor with Pyodide, user auth, and workspace API

- FastAPI serves static UI, file CRUD under code/ and read-only lib/
- Pyodide worker runs Python and Jedi completions in the browser
- SQLite accounts: login/register, session cookies, superuser user management
- Optional EDITOR_API_KEY, AUTH_* env vars, .env.example
- Pipenv, pytest, Selenium smoke test, README

Made-with: Cursor
This commit is contained in:
2026-05-01 14:33:26 +12:00
parent d245ecd353
commit f204109a84
40 changed files with 4950 additions and 2 deletions

18
.env.example Normal file
View File

@@ -0,0 +1,18 @@
# Copy to `.env` in the repo root (same directory as Pipfile). `.env` is gitignored.
# Workspace tree: code/ (writable), lib/ (read-only); defaults to ./workspace under the repo root
# WORKSPACE_ROOT=/home/you/projects/python-editor/workspace
# If set, `/api/*` accepts this Bearer token (and still accepts session cookies if AUTH_ENABLED=true)
# EDITOR_API_KEY=
# --- User accounts (SQLite) ---
# AUTH_ENABLED=true # require sign-in for /api/* (except /api/auth/*)
# AUTH_REGISTER_OPEN=true # allow POST /api/auth/register
# AUTH_DATABASE_PATH=./data/editor.db
# AUTH_SESSION_DAYS=14
# BOOTSTRAP_ADMIN_USERNAME=admin # first-run only: create superuser if DB has zero users
# BOOTSTRAP_ADMIN_PASSWORD=change-me-in-production
# Base URL for `pipenv run test-selenium` (app must be running separately)
# SELENIUM_BASE_URL=http://127.0.0.1:8080