Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ PyOZ Public

PyOZ - Zig's power meets Python's simplicity. Build blazing-fast extensions with zero boilerplate and zero Python C API headaches.

License

Notifications You must be signed in to change notification settings

dzonerzy/PyOZ

Repository files navigation

PyOZ Logo

PyOZ

Zig's power meets Python's simplicity.

Build blazing-fast Python extensions with zero boilerplate and zero Python C API headaches.

GitHub Stars Python Zig License

Documentation | Getting Started | Examples


Quick Example

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

Features

  • 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 .pyi generation for IDE support
  • Simple Tooling - pyoz init, pyoz build, pyoz publish

Installation

# 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

Getting Started

# 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))"

Documentation

Full documentation available at pyoz.dev

Requirements

  • Zig 0.15.0+
  • Python 3.8 - 3.13

License

MIT License - see LICENSE for details.

Contributing

Contributions welcome! Please open an issue or submit a PR.

About

PyOZ - Zig's power meets Python's simplicity. Build blazing-fast extensions with zero boilerplate and zero Python C API headaches.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published