github pyozig/PyOZ v0.12.1
PyOZ v0.12.1

latest release: v0.12.2
4 months ago

What's New in v0.12.1

Added

  • Auto-kwargs for ?T params in .from — Functions discovered via .from that have optional (?T) parameters now automatically support keyword arguments without requiring pyoz.Args(T). Required params stay positional-only, optional params become keyword-capable. For example, fn add(a: i64, b: i64, multiplier: ?i64) generates the Python signature add(a, b, /, multiplier=None) and can be called as add(1, 2, multiplier=5). Requires source text (via pyoz.withSource(), __source__(), or __params__) for parameter name extraction. A compile-time warning is emitted if ?T params are used without source text.
  • .funcs and .classes are now optional in pyoz.module() — When using .from for all declarations, you no longer need to specify empty .funcs = &.{} and .classes = &.{}.

Changed

  • Enum stubs show type annotations instead of values — Generated .pyi stubs for enums now use field: int / field: str instead of exposing the actual values (field = 0 / field = "name").

Fixed

  • Source parser performance: eagerly-parsed source cachingwithSource now eagerly parses the source file once and shares the pre-parsed data across all lookups, eliminating redundant comptime tokenization. Previously, Zig's comptime evaluator re-parsed the source for every doc/param lookup (92× for a 24-class file), causing 2m+ compile times. Now compiles in ~3s. Also eliminates source text leaking into debug symbols (the old SourceInfo("entire source...") generic type name is replaced with ParsedSource).
  • pub inline fn and pub noinline fn doc comments now extracted — The source parser now correctly skips inline, noinline, and export keywords between pub and fn, so doc comments on pub inline fn declarations are properly extracted for Python docstrings and stubs.
  • Package mode no longer requires underscore prefix in module-name — Package layout detection now uses py-packages containing the project name, instead of requiring the module name to start with _. Users can now use module-name = "liburing" with py-packages = ["liburing"] and from .liburing import * in __init__.py. The underscore convention still works but is no longer required. Affects pyoz develop, pyoz build, pyoz test, pyoz bench, and wheel building.
  • build.zig templates now include guidance for custom C include paths — The generated build.zig includes comments showing that addIncludePath and addObjectFile must be added to user_lib_mod, not lib.root_module (which is the bridge module in 0.12.0). This prevents @cImport failures when wrapping C libraries.
  • Better compile error for kwfunc without pyoz.Args(T) — When using explicit kwfunc with a parameter not wrapped in pyoz.Args(T), the compiler now shows a clear error message with the fix, instead of the cryptic type 'u32' has no members.

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.12.1.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.