What's New in v0.3.0
Added
- Universal iterator support via IteratorView - Accept any Python iterable
IteratorView(T)for accepting any iterable (list, tuple, set, generator, range, etc.)- Methods:
next(),count(),collect(),forEach(),find(),any(),all() - Zero-copy: wraps Python iterator directly, no data copying
- Works with generators, ranges, and custom iterables
PyIter_Check()andPyObject_IsIterable()Python C API bindingsIterator(T)andLazyIterator(T, State)types for returning iterators (placeholder for future)
Fixed
- Use-after-free bug in Path conversion for pathlib.Path objects - Python 3.9 compatibility
PyPath_AsString()was decref'ing the string before returning, causing segfaults- Added
PyPath_AsStringWithRef()to return both string slice and owning PyObject - Path struct now stores Python object reference and releases it after function call
- Proper cleanup in function wrappers ensures no memory leaks
Changed
- Major internal refactoring of class generation - Improved maintainability
- Split monolithic
class.zig(2,887 lines) into 16 modular files - New
src/lib/class/directory with protocol-specific modules:mod.zig- Main orchestrator combining all protocolswrapper.zig- PyWrapper struct builderlifecycle.zig- Object lifecycle (new, init, dealloc)number.zig- Number protocol (~700 lines of numeric operations)sequence.zig- Sequence protocolmapping.zig- Mapping protocolcomparison.zig- Rich comparisonrepr.zig- String representation (repr, str, hash)iterator.zig- Iterator protocol (iter, next)buffer.zig- Buffer protocoldescriptor.zig- Descriptor protocolattributes.zig- Attribute access (getattr, setattr)callable.zig- Callable protocol (call)properties.zig- Property generation (getters/setters)methods.zig- Method wrappers (instance, static, class)gc.zig- Garbage collection support
- All comptime generation preserved - no functionality changes
- Public API unchanged - fully backward compatible
- Split monolithic
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.3.0.tar.gz for the source code.
Quick Start
pyoz init mymodule
cd mymodule
pyoz build
pip install dist/*.whl