Skip to content

Conversation

@lebalz
Copy link
Contributor

@lebalz lebalz commented Jan 11, 2026

Support Live Pyodide-Code

Support syntax

```py live_pyo id=<uuid>
from time import sleep

n = input('How many times shall i say hi?')
n = int(n)
for i in range(10):
  print('Hello', i+1)
  sleep(1)
```

The live_pyo transforms the code to an editable and runnable code block. The execution is performed in a webworker (+service worker for inputs) in pyodide (a WebAssembly CPython port).

The code is extensible via the alias plugin system, allowing interactive components to be implemented effortlessly in userland.

An example can be found in tdev-website/website/packages/pyodide-code where a clock py package, models and components are implemented:

sbb-clock.mp4

Upgrade Guide

  • the website directory for extensions in userland is configureable over siteConfig.ts#websiteDir. Make sure to adapt the tsconfig.json accordingly.
  • update the tdevUpdate.config.yml to sync tsconfig.tdev.json to tsconfig.json (instead of tsconfig.json --> tsconfig.json)
  • the CodeEditor implementation is reworked to be reused by pyodide-code
    • the Script-Document is left as-is, but should probably be renamed to brython-code during a summer-break.
    • the CodeEditor accepts a iCode Model - which is implemented by BrythonCode and PyodideCode
    • the brython core logic is refactored to it's own plugin @tdev/brython-code.
    • add require.resolve('@tdev/brython-code/register') to your siteConfig.ts#apiDocumentProviders
    • the current implementation is backward-compatible
  • A ViewStore was added - plugins can register components and plugin-specific stores (as the PyodideStore) to it.
  • to activate pyodide, add require.resolve('@tdev/pyodide-code/register') to your siteConfig.ts#apiDocumentProviders.

@netlify
Copy link

netlify bot commented Jan 11, 2026

Deploy Preview for teaching-dev ready!

Name Link
🔨 Latest commit 23a6f5a
🔍 Latest deploy log https://app.netlify.com/projects/teaching-dev/deploys/697157d9637edf00085fb68f
😎 Deploy Preview https://deploy-preview-265--teaching-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@lebalz lebalz changed the title POC Pyodide feat: Pyodide-Script Jan 19, 2026
@lebalz lebalz changed the title feat: Pyodide-Script feat: Pyodide-Code Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants