Skip to content

PyOZ v0.11.4

Choose a tag to compare

@github-actions github-actions released this 19 Feb 10:14
· 24 commits to main since this release
2535170

What's New in v0.11.4

Added

  • pyoz.Signature(T, "python_type") -- stub return type override - New comptime wrapper type that overrides the Python type annotation in generated .pyi stubs without affecting runtime behavior. Use this when the Zig return type doesn't map cleanly to the desired Python type, most commonly when ?T is used for CPython exception signaling (returning null + PyErr_SetString) rather than representing Python None. For example, fn probe() pyoz.Signature(?Dict, "dict[str, bool]") generates def probe() -> dict[str, bool] instead of the incorrect def probe() -> dict[str, bool] | None. Also supports pyoz.Signature(?void, "Never") for functions that only raise. Works uniformly on module-level functions, class instance/static/class methods, __call__, __new__, and allowThreads/allowThreadsTry.
  • PyMemoryView_Check - Added type check function for memoryview objects, following the same isTypeOrSubtype pattern as other type checks. Uses PyMemoryView_Type which is part of the stable ABI since Python 3.2, so works across 3.8–3.13 in both normal and ABI3 modes.

Fixed

  • Comptime branch quota exceeded with large modules - Modules with many functions would fail to compile with evaluation exceeded 1000 backwards branches in anyFuncUsesDateTime/anyFuncUsesDecimal. Fixed by setting @setEvalBranchQuota(std.math.maxInt(u32)) in both functions.

Refactored

  • Type check functions - PySet_Check, PyFrozenSet_Check, PyBytes_Check, PyByteArray_Check, and PyObject_TypeCheck now use the shared isTypeOrSubtype helper for consistency.

Removed

  • method__returns__ class method stub override - The pub const method_name__returns__: []const u8 = "..." convention for overriding class method return type stubs has been removed in favor of the unified pyoz.Signature(T, "python_type") approach, which works identically for both module-level functions and class methods.

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.11.4.tar.gz for the source code.

Quick Start

pyoz init mymodule
cd mymodule
pyoz build
pip install dist/*.whl