dzonerzy/PyOZ
PyOZ - Zig's power meets Python's simplicity. Build blazing-fast extensions with zero boilerplate and zero Python C API headaches.
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
.pyi generation for IDE supportpyoz 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
MIT License - see LICENSE for details.
Contributions welcome! Please open an issue or submit a PR.