What problem does it solve?
This Skill provides expert context and patterns for building robust Python bindings for Rust code using PyO3 and Maturin, ensuring efficient, safe, and maintainable extensions.
Core Features & Use Cases
- PyO3 Best Practices: Demonstrates correct usage of PyO3 0.26 features like
gil_used = false, Bound<'_, T>, and class definition patterns.
- Maturin Workflow: Outlines essential commands for development, building wheels, and publishing Python packages from Rust.
- Error Handling & Type Stubs: Details how to convert Rust errors to Python exceptions and generate accurate type stubs (
.pyi) for improved developer experience.
- Use Case: A developer needs to create a high-performance Python library by wrapping existing Rust code. This Skill guides them through the entire process, from Rust implementation to a distributable Python package.
Quick Start
Use the python-bindings skill to build a Python wheel for your Rust project using maturin.