github pyozig/PyOZ v0.4.0
PyOZ v0.4.0

latest releases: v0.12.2, v0.12.1, v0.12.0...
8 months ago

What's New in v0.4.0

Added

  • Automatic .pyi stub generation - Type stubs are now generated at compile time

    • Full Python type hints for all exported functions, classes, methods, and properties
    • Supports complex types: list[T], dict[K, V], tuple[...], Optional[T], Union[...]
    • Docstrings are included in generated stubs
    • Stubs are automatically embedded in the compiled binary and extracted during wheel building
    • Works with stripped binaries via dedicated .pyozstub section that survives stripping
    • New --no-stubs flag for pyoz build to disable stub generation
    • New --stubs flag (default) to explicitly enable stub generation
  • Strip support in pyproject.toml - Binary stripping now fully functional

    • Added strip = true option in [tool.pyoz] section
    • Stubs survive stripping via section-based embedding with PYOZSTUB magic header
    • Works with all optimization levels including ReleaseSmall
  • Cross-platform symreader - Extract embedded data from compiled modules

    • Supports ELF (Linux), PE (Windows), and Mach-O (macOS) binary formats
    • Section-based extraction (.pyozstub) for stripped binaries
    • Symbol-based extraction (__pyoz_stubs_data__, __pyoz_stubs_len__) as fallback
    • Comprehensive test suite with cross-compiled test binaries for all formats
  • Symreader tests in build.zig - Test infrastructure for binary format parsing

    • Cross-compiles test stub libraries for x86_64-linux, x86_64-windows, x86_64-macos
    • Tests ELF, PE, and Mach-O parsers with real binaries
    • Uses b.addWriteFiles() to inject test code at build time

Changed

  • Generated build.zig template now includes -Dstrip option support
  • Stubs are embedded in both symbol form (for non-stripped) and section form (for stripped)
  • Section names: .pyozstub (ELF/PE), __DATA,__pyozstub (Mach-O)

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