Skip to content

v1.0.0

Choose a tag to compare

@AfrazF AfrazF released this 20 Oct 16:08
· 83 commits to main since this release

v1.0.0 — Read-only Python → Blocks viewer

Turns Pybricks Python (SPIKE Prime, FLL) into color-coded Blockly blocks. Drop in .py files, see them as blocks. No editing (v2), no server needed.

Download index.html below → double-click → upload your .py files → read them as blocks. Works offline via file://.

What's in v1

  • Real parser — @lezer/python, any valid Python
  • Cross-file resolution — attachment1 as attachment_a resolves to a Motor, not text
  • Pybricks blocks — DriveBase (straight, turn, reset, use_gyro, settings), Motor (run_target, run_angle, run_until_stalled, run_time, reset_angle, stop), multitask, home, speed presets
  • Hardware setup — PrimeHub, Motor(port, direction), DriveBase(...)
  • Variables — create variable, set, pink chips in block args
  • Comments — grey standalone blocks; inline comments as icons on blocks
  • Docstrings — comment icons on the owning hat/task/function
  • Tasks vs functions — purple async def, pink def
  • Zelos renderer + Pybricks palette — orange hat, purple tasks, pink calls, cyan object chips
  • Resizable sidebar — file switcher, upload, drag-drop
  • Single-file build — ~875 kB, no dependencies at runtime
  • Docker deploy — docker compose up -d --build for hosted version

Known limits

  • run.py and main.py render as large raw blocks (control flow is v1.5)
  • Read-only (editing is v2)
  • No Monaco side panel (v1.25)

Use it

Offline: download index.html, open in Chrome/Edge, upload .py files.

Hosted:

git clone https://github.com/AfrazF/python-to-blocks.git
cd python-to-blocks && git checkout v1.0.0
docker compose up -d --build