What's New in v0.6.2
Added
- Auto-generated
__repr__for classes without custom__repr__- Classes that don't define a__repr__method now automatically get a repr in the formClassName(field1=val1, field2=val2). Private fields (starting with_) are excluded from the output. - Auto-generated
tp_docfor classes without__doc__- Classes that don't declare a__doc__string now get an auto-generated docstring showing the constructor signature and field types, e.g.SimplePoint(x, y)\n\nAttributes:\n x: float\n y: float. This makeshelp(MyClass)useful out of the box. ClassInfostruct for the conversion system - IntroducedClassInfo(pairing a custom name with a Zig type) to thread custom class names through the entire comptime pipeline, replacing baretypearrays.getWrapperWithName(name, T)- New comptime function that generates a class wrapper using the provided custom name, ensuring a single consistent type instantiation across registration and conversion.
Changed
- All protocol signatures normalized to
(name, T, Parent)- Every protocol that accepts a class name now takes it as the first parameter for consistency:NumberProtocol,SequenceProtocol,MappingProtocol,IteratorProtocol,CallableProtocol,DescriptorProtocol,ReprProtocol,AttributeProtocol, andMethodBuilder. - All protocols now use class-aware converters -
SequenceProtocol,MappingProtocol, andDescriptorProtocolnow usegetSelfAwareConverter(name, T)instead of the genericConversions, matching the pattern already used byNumberProtocol,CallableProtocol,IteratorProtocol, andMethodBuilder. - Conversion system uses
ClassInfoinstead of bare types -Converter, all wrapper functions inwrappers.zig, andextractClassInfoinroot.zignow work with[]const ClassInfoto ensure custom class names are used everywhere.
Fixed
help(module)now lists all registered classes - Classes were missing fromhelp(module)because their__module__attribute wasbuiltinsinstead of the module name. Fixed by settingtp_nameto the qualified form"module.ClassName", which Python uses to derive__module__automatically.- Custom class names now propagate through the entire system - Previously,
getWrapper(T)used@typeName(T)which produced internal Zig paths likeos.linux.kernel_timespec. When using external types withpy.class("Timespec", std.os.linux.kernel_timespec), the custom name now correctly appears in__repr__,tp_doc, error messages, andhelp()output. - Fixed dual comptime instantiation bug - Registration and conversion previously created separate type instantiations (one with the custom name, one with
@typeName), causing objects returned from functions to lack properties and methods. Both paths now use the samegetWrapperWithNameinstantiation.
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.6.2.tar.gz for the source code.
Quick Start
pyoz init mymodule
cd mymodule
pyoz build
pip install dist/*.whl