What's New in v0.10.2
Added
- Error union and optional return types in all dunder methods - All magic methods (
__new__,__add__,__repr__,__len__,__call__,__eq__,__iter__,__get__,__setattr__, etc.) now support three return conventions: plainT(always succeeds),!T(error union — Zig errors automatically become Python exceptions), and?T(optional — returnnullafter callingpyoz.raiseValueError()etc.). Previously, only regular functions and a few protocol methods like__getitem__supported error unions. This enables raising exceptions from__new__, comparison operators, number protocol methods, and all other dunder methods.
Fixed
- Cross-compilation from Linux to macOS/Windows - The PyPI wheel build (
build_wheels.py) now downloads CPython headers at build time instead of using host Python's platform-specific headers. Previously, cross-compiling from Linux used the host'spyconfig.h(a Debian multiarch stub), which failed for non-Linux targets. The build script now extracts headers from the official CPython source tarball, stages the correctpyconfig.hper target (Unix LP64 orPC/pyconfig.hfor Windows), and passes them to Zig via-Dpython-headers-dir. - Windows .pyd crash on import - Windows builds previously used
linker_allow_shlib_undefinedwhich left Python C API symbols as NULL pointers (Windows doesn't support lazy symbol resolution like Unix). The.pydnow links against a properpython3.libimport library generated at build time from CPython'sstable_abi.tomlusingzig dlltool, so allPy_*symbols resolve correctly againstpython3.dllat load time.
Installation
Download the binary for your platform and add it to your PATH:
| Platform | Binary |
|---|---|
| Linux x86_64 | pyoz-x86_64-linux
|
| Linux ARM64 | pyoz-aarch64-linux
|
| macOS x86_64 | pyoz-x86_64-macos
|
| macOS ARM64 (Apple Silicon) | pyoz-aarch64-macos
|
| Windows x86_64 | pyoz-x86_64-windows.exe
|
| Windows ARM64 | pyoz-aarch64-windows.exe
|
Source
Download PyOZ-0.10.2.tar.gz for the source code.
Quick Start
pyoz init mymodule
cd mymodule
pyoz build
pip install dist/*.whl