Skip to main content

3 posts tagged with "Python"

CPython on Pyodide, and the runtime Vivari builds around it.

View All Tags

A step debugger with no inspector to talk to, and the second SharedArrayBuffer that makes it pause

· 12 min read

A breakpoint is not a feature you write. It is a favour the engine does you. When you set one in VS Code, nothing in your program changes: V8's inspector holds the isolate, walks the real call stack, and hands back scopes it already had. Every step debugger you have used is a thin client in front of that.

A Web Worker has no inspector. There is no --inspect port to open, no inspector binding to require, no way to ask the engine to stop. So the first question here was not how to build a debug UI. It was where a pause could possibly come from.

There was never a second import pandas, and PEP 552 is why there is now

· 11 min read

On your laptop, the first import pandas of the day is slow and every one after it is fast. You have probably never thought about why. CPython compiles the package's .py files to bytecode, writes that bytecode into __pycache__, and never does it again.

Run Python inside a browser tab, where every command is its own process with its own interpreter and a freshly unpacked copy of every package, and something uncomfortable follows. There is no second time. Every import pandas is the first one.

Flask, Django and FastAPI answering real requests, with no socket underneath

· 15 min read

Every Python web framework bottoms out in the same two lines, whatever it calls them:

sock.bind((host, port))
sock.listen(backlog)

A browser tab does not have that. There is no TCP stack in a page, no file descriptor to bind, and no amount of WebAssembly changes it. So the interesting question is not whether you can run Flask's Python in a browser, because you can. It is what happens when someone types flask run.