github pyozig/PyOZ v0.10.2
PyOZ v0.10.2

latest releases: v0.12.2, v0.12.1, v0.12.0...
6 months ago

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: plain T (always succeeds), !T (error union — Zig errors automatically become Python exceptions), and ?T (optional — return null after calling pyoz.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's pyconfig.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 correct pyconfig.h per target (Unix LP64 or PC/pyconfig.h for Windows), and passes them to Zig via -Dpython-headers-dir.
  • Windows .pyd crash on import - Windows builds previously used linker_allow_shlib_undefined which left Python C API symbols as NULL pointers (Windows doesn't support lazy symbol resolution like Unix). The .pyd now links against a proper python3.lib import library generated at build time from CPython's stable_abi.toml using zig dlltool, so all Py_* symbols resolve correctly against python3.dll at 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

Don't miss a new PyOZ release

NewReleases is sending notifications on new releases.