Learning Lab

Pyodide makes blog posts feel less theoretical

2 min read

Pyodide changes the contract of a technical example.

A static snippet asks the reader to copy it later, install the right version, and trust that the dependencies will cooperate. Python running in the page offers a tighter loop: change an input, run the example, and inspect the result before leaving the argument.

the example should invite interference

For a probability distribution, a small classifier, a parser edge case, or a ranking function, the useful interaction is not decoration. It lets the reader alter the input, violate an assumption, and watch the output change.

<script src="https://cdn.jsdelivr.net/pyodide/v0.26.4/full/pyodide.js"></script>
<script>
  const pyodide = await loadPyodide()
  const result = pyodide.runPython("1 + 2")
  console.log(result)
</script>

The page loads a Python runtime compiled to WebAssembly, so small examples can execute in the browser.

keep the lab smaller than the subject

Not every article needs to become a notebook. A good embedded lab can have one concept, one input, and one output. A textarea, slider, or a few editable lines may be enough.

Useful candidates include tokenization, ranking functions, vector similarity, regex failures, small data transforms, JSON schema validation, and toy classifiers. A large dependency tree is usually a warning sign. If setting up the environment takes more attention than testing the idea, the post has changed subjects.

The runtime state also belongs in the interface. Readers need to see whether Python is loading, a package is installing, code is running, or execution failed. Without that state, an interactive example becomes a text box that happens to be difficult to diagnose.

The strongest version of a runnable post does not ask the reader to admire the example. It gives them a small surface they can change, then makes the consequences visible.

Jeremy London

About Jeremy London

Engineering leader and builder in Denver. I write about AI platforms, agents, security, reliability, homelab infrastructure, and the parts of engineering work that have to survive production.