Zig's power meets Python's simplicity.
Build blazing-fast Python extensions with zero boilerplate and zero Python C API headaches.
const pyoz = @import("PyOZ");
fn add(a: i64, b: i64) i64 {
return a + b;
}
const MyModule = pyoz.module(.{
.name = "mymodule",
.funcs = &.{
pyoz.func("add", add, "Add two numbers"),
},
});
pub export fn PyInit_mymodule() ?*pyoz.PyObject {
return MyModule.init();
}import mymodule
print(mymodule.add(2, 3)) # 5- Declarative API - Define modules, functions, and classes with simple struct literals
- Automatic Type Conversion - Zig types map naturally to Python types
- Full Class Support - Magic methods, operators, properties, inheritance
- NumPy Integration - Zero-copy array access
- Error Handling - Zig errors become Python exceptions
- Type Stubs - Automatic
.pyigeneration for IDE support - Simple Tooling -
pyoz init,pyoz build,pyoz publish
# Download the latest release
# https://github.com/dzonerzy/PyOZ/releases
# Or build from source
git clone https://github.com/dzonerzy/PyOZ.git
cd PyOZ
zig build# Create a new project
pyoz init myproject
cd myproject
# Build and install for development
pyoz develop
# Test it
python -c "import myproject; print(myproject.add(1, 2))"Full documentation available at pyoz.dev
- Zig 0.15.0+
- Python 3.8 - 3.13
MIT License - see LICENSE for details.
Contributions welcome! Please open an issue or submit a PR.