Provide Python code formatting once Monaco Format document piping exists for the playground — browser-friendly constraint (Pyodide) vs server-backed formatter.
Options to evaluate — pick implementation time
A. Run Black (or autopep8) inside Pyodide worker if WASM port available and deps acceptable. B.Backend / code-execution microservice: format user snippet with black (or Ruff --format), return text — aligns with graded runs already leaving the sandbox. C. Lighter PEP8-only heuristic (last resort — not parity with “Black”).
Integration
Implement provideDocumentFormattingEditProvider('python', …) (or our Monaco language id).
Latency UX: spinner / cancel for slow WASM cold start.
Teaching: deterministic output for novices preferred.
Dependency
Platform Format toolbar + Monaco #24 + parent platform ticket.
## Summary
Provide **Python** code formatting once Monaco **Format document** piping exists for the playground — **browser-friendly** constraint (Pyodide) vs **server-backed** formatter.
## Options to evaluate — pick implementation time
**A.** Run **Black** (or **`autopep8`**) inside **Pyodide** worker if WASM port available and deps acceptable.
**B.** **Backend / code-execution microservice**: format user snippet with **`black`** (or Ruff `--format`), return text — aligns with graded runs already leaving the sandbox.
**C.** Lighter PEP8-only heuristic (last resort — not parity with “Black”).
## Integration
- Implement `provideDocumentFormattingEditProvider('python', …)` (or our Monaco language id).
- **Latency UX**: spinner / cancel for slow WASM cold start.
- **Teaching**: deterministic output for novices preferred.
## Dependency
Platform Format toolbar + Monaco `#24` + parent platform ticket.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Provide Python code formatting once Monaco Format document piping exists for the playground — browser-friendly constraint (Pyodide) vs server-backed formatter.
Options to evaluate — pick implementation time
A. Run Black (or
autopep8) inside Pyodide worker if WASM port available and deps acceptable.B. Backend / code-execution microservice: format user snippet with
black(or Ruff--format), return text — aligns with graded runs already leaving the sandbox.C. Lighter PEP8-only heuristic (last resort — not parity with “Black”).
Integration
provideDocumentFormattingEditProvider('python', …)(or our Monaco language id).Dependency
Platform Format toolbar + Monaco
#24+ parent platform ticket.spikerj referenced this issue2026-04-28 23:49:11 +00:00