I’ve been playing around with the Zig toolchain. One very interesting thing I found recently is that Zig’s toolchain, being completely self-contained, portable, and extremely compact, is being distributed on PyPI as an installable Python package. Combining with the fact that the Zig compiler has first-class support compiling C code, this means any sdist can acquire a working C compiler by simply adding ziglang
as a PEP 517 build dependency. With some glue code around the compiler, I was able to produce a PEP 517 backend (using Flit internals) that can produce non-pure wheels that Works On My Machines™ by only declarative pyproject.toml
definitions, without setuptools or an external compiler setup.
Project: zlig · PyPI
Example: zlig/examples/demo at main · uranusjr/zlig · GitHub
This thing is likely not very useful itself, but I feel the Zig compiler route is very much worth investigating for anyone interested in improving the native module landscape beyond what we have in setuptools.