What's New in v0.12.1
Added
- Auto-kwargs for
?Tparams in.from— Functions discovered via.fromthat have optional (?T) parameters now automatically support keyword arguments without requiringpyoz.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 signatureadd(a, b, /, multiplier=None)and can be called asadd(1, 2, multiplier=5). Requires source text (viapyoz.withSource(),__source__(), or__params__) for parameter name extraction. A compile-time warning is emitted if?Tparams are used without source text. .funcsand.classesare now optional inpyoz.module()— When using.fromfor all declarations, you no longer need to specify empty.funcs = &.{}and.classes = &.{}.
Changed
- Enum stubs show type annotations instead of values — Generated
.pyistubs for enums now usefield: int/field: strinstead of exposing the actual values (field = 0/field = "name").
Fixed
- Source parser performance: eagerly-parsed source caching —
withSourcenow 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 oldSourceInfo("entire source...")generic type name is replaced withParsedSource). pub inline fnandpub noinline fndoc comments now extracted — The source parser now correctly skipsinline,noinline, andexportkeywords betweenpubandfn, so doc comments onpub inline fndeclarations are properly extracted for Python docstrings and stubs.- Package mode no longer requires underscore prefix in
module-name— Package layout detection now usespy-packagescontaining the project name, instead of requiring the module name to start with_. Users can now usemodule-name = "liburing"withpy-packages = ["liburing"]andfrom .liburing import *in__init__.py. The underscore convention still works but is no longer required. Affectspyoz develop,pyoz build,pyoz test,pyoz bench, and wheel building. build.zigtemplates now include guidance for custom C include paths — The generatedbuild.zigincludes comments showing thataddIncludePathandaddObjectFilemust be added touser_lib_mod, notlib.root_module(which is the bridge module in 0.12.0). This prevents@cImportfailures when wrapping C libraries.- Better compile error for
kwfuncwithoutpyoz.Args(T)— When using explicitkwfuncwith a parameter not wrapped inpyoz.Args(T), the compiler now shows a clear error message with the fix, instead of the cryptictype '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