ruff/playground
Micha Reiser 3150812ac4
Some checks are pending
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
[Knot Playground] Release / publish (push) Waiting to run
[red-knot] Add 'Format document' to playground (#17217)
## Summary
This is more "because we can" than something we need. 

But since we're already building an "almost IDE" 

## Test Plan



https://github.com/user-attachments/assets/3a4bdad1-ba32-455a-9909-cfeb8caa1b28
2025-04-07 09:26:03 +02:00
..
api [playground] Use cursor for clickable elements (#16833) 2025-03-18 18:06:00 +01:00
knot [red-knot] Add 'Format document' to playground (#17217) 2025-04-07 09:26:03 +02:00
ruff [playground] Provide fallback monospace-font (#17242) 2025-04-06 21:57:20 +01:00
shared [playground] Add Reset button (#17236) 2025-04-06 17:09:56 +00:00
.gitignore Remove all useEffect usages (#12659) 2024-08-08 13:16:38 +02:00
.prettierignore Red Knot Playground (#12681) 2025-03-18 17:17:11 +01:00
eslint.config.mjs Red Knot Playground (#12681) 2025-03-18 17:17:11 +01:00
package-lock.json Update dependency pyodide to v0.27.5 (#17250) 2025-04-06 22:01:57 -04:00
package.json Red Knot Playground (#12681) 2025-03-18 17:17:11 +01:00
README.md Red Knot Playground (#12681) 2025-03-18 17:17:11 +01:00
tsconfig.json Red Knot Playground (#12681) 2025-03-18 17:17:11 +01:00
tsconfig.node.json Red Knot Playground (#12681) 2025-03-18 17:17:11 +01:00

playground

In-browser playground for Ruff. Available https://play.ruff.rs/.

Getting started

Install the NPM dependencies with npm install, and run, and run the development server with npm start --workspace ruff-playground or npm start --workspace knot-playground. You may need to restart the server after making changes to Ruff or Red Knot to re-build the WASM module.

To run the datastore, which is based on Workers KV, install the Wrangler CLI, then run npx wrangler dev --local from the ./playground/api directory. Note that the datastore is only required to generate shareable URLs for code snippets. The development datastore does not require Cloudflare authentication or login, but in turn only persists data locally.

Architecture

The playground is implemented as a single-page React application powered by Vite, with the editor experience itself powered by Monaco.

The playground stores state in localStorage, but supports persisting code snippets to a persistent datastore based on Workers KV and exposed via a Cloudflare Worker.

The playground design is originally based on Tailwind Play, with additional inspiration from the Biome Playground.

Known issues

Stack overflows

If you see stack overflows in the playground, build the WASM module in release mode: npm run --workspace knot-playground build:wasm.