Summary
JOY OF PROGRAMMING, a video game to practice your Python, is on steam.
Pyodide support has been added to urllib3, and now powers pydantic docs.
Numpy 2 RC is there, and you should prepare.
Python, the video game
The news nobody was expecting: JOY OF PROGRAMMING - Software Engineering Simulator, has been released on Steam.
Video games are an underutilized medium to learn programing, and Python is not very popular on the browser like JS, so having something that is interactive and visual is super interesting. It looks like a 3D Factorio child cousin:
This is not the first video game to learn programming on Steam. Things like exapunks existed before, but it was not in Python. There is a service to learn Python using some kind of RPG named code combat, but it's not something you install on your machine and own, it's was in the browser, and now it's on Roblox.
"JOY OF PROGRAMMING" fits the niche quite nicely, although it's only in early access on windows now, and I wish the authors good luck.
Pyodide on the rise
Pyodide, the Webassembly CPython port, has been showing a lot of potentials for years. Been able to run Python in the browser, it lets you do very cool things like run jupyter without any installation (try it, but give it time to load).
Of course, it's slow, limited in libraries you can use, and comes with several MB to load upfront just for the privilege of doing print()
when your page loads, but it works remarkably well given it has to emulate an entire filesystem (sqlite3 works ^^).
Just a few hours ago, the urllib3 project, the most popular HTTP client backend in Python, has announced that they now have experimental support for pyodide.
This is interesting, since urllib3 is used by numerous libs to offer HTTP support, not the least important one being requests.
This comes with the usual limitations of a web browser, as it uses the JS API under the hood, the main one being that you have to be mindful of CORS. So out the box, can only do requests to servers you own or that explicitly allow you do to so.
If you like this, know that they are having a fundraising right now for HTTP2 support.
While I have no plan to use pyodide for scripting, I always though it had a lot to like for teaching, and played with the idea of making this very blog code executable with it (ironic, I know). Well, I just discovered this week that pydantic does just that in its documentation! Click play, wait a bit, and tada!
I wasn't sure it was pyodide, but looking at the source code it pointed to this JS file confirming it. In fact, it lead me to discover another project, mkdocs-run-code, that helps insert runnable Python snippets in mkdocs (a sphinx alternative) documentation. I don't think it was meant to be reusable by us, though, but I have a feeling we'll see more of that on Read The Doc in a not too distant future, because it’s Samuel Colvin behind this.
Numpy 2 RC is there
I'm lying, numpy 2 release candidate publication date is set for tomorrow, which technically would make it land on February, but I didn't want to wait a whole month before talking about it.
Because it's a major release, which means it breaks compatibility. Plus, it's a very popular lib that is used in, hum, a vast array of projects.
Luckily, you can check if your code is compatible with ruff, using the NPY201 check. Install the latest version of ruff, and run:
ruff check --preview --select NPY201 you_scrip.py
You can even use --fix
to automatically, well, fix most of the code incompatibility.
However, this won't save your from incompatibilities in your dependencies or in the C API. As with Python itself, I'd recommend waiting until 2.1 before you migrate, and this is not even 2.0, but 2.0 RC.
This is where pining your dependencies in your requirement file is useful. You might have something like this already:
numpy>=1.2
But you need the upper limit now:
numpy>=1.2,<2.0
This should prepare you for the real release weeks from now. Meanwhile, don't forget to test.
At this point you are wondering what's new in numpy 2, and it's mostly, cleanup. C-API evolution, public API reduction and separation of the way scalars and arrays are treated.
It's not new features, sorry.
And a bit of everything
I'm just going to batch the rest of the small stuff there:
The JIT we talked about last month was merged on the 3.13 branch.
The raspi is, as expected, very hard to buy. But for once, production has been increased to keep up with demand. So you might actually get your hand on one of those sweet Python IOT goodies.
I discovered niquest, a requests drop-in replacement with, and unlike aiohttp/httpx, it supports http2/3, and a simpler asyncio syntax. It also has a nice multiplex perf boost, and default to the OS certificate store for TLS checks. It's not really news, but it's news to me, so I share.