--- id: setuptools-rust version: "1.13.0" license: unclear license_treatment: permissive maintenance: active --- # setuptools-rust — Setuptools Rust extension plugin License: permissive · Maintenance: active · Downloads: 6.9M/mo ## What it is and what it does setuptools-rust bridges the gap between Rust and Python packaging by acting as a setuptools plugin that knows how to compile Rust code into Python extension modules. It handles the build process for extensions written with PyO3 or rust-cpython, letting you distribute them as wheels just like C extensions. The plugin reads configuration from pyproject.toml, invokes the Rust toolchain (cargo), and integrates the compiled binaries into your Python package. You use it by declaring Rust extension modules in your pyproject.toml, pointing to your Cargo.toml and specifying the binding framework (PyO3 or rust-cpython). It then manages compilation during package installation or wheel building. The plugin supports both library modules (for import) and binary executables, and handles cross-compilation via tools like crossenv or cargo-zigbuild. Use it for: - Package a performance-critical Python library written in Rust for distribution on PyPI. - Build a Python extension module that calls Rust code for CPU-intensive tasks. - Distribute a Rust binary tool alongside Python code as a single wheel. - Create a namespace package that mixes Rust extension modules with pure Python code. - Cross-compile Rust extensions for deployment on different architectures. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. setuptools-rust is a setuptools plugin that compiles and packages Python extensions written in Rust, using PyO3 or rust-cpython bindings. Yes, if you are writing Python extensions in Rust. The plugin is actively maintained, has no known vulnerabilities, low install friction, and permissive licensing. It is the standard way to package Rust extensions for PyPI distribution. Install it only in your build-system requirements (pyproject.toml), not as a runtime dependency. ## Install pip install setuptools-rust uv add setuptools-rust poetry add setuptools-rust ## Installing setuptools-rust Before you install: Low install friction; pure Python wheel with only setuptools and semantic_version as runtime dependencies. Actively maintained with recent releases and 677 repository stars. License in practice: MIT-licensed under permissive terms, allowing use in commercial and private projects without significant restrictions. Quickstart: # In pyproject.toml: [build-system] requires = ["setuptools", "setuptools-rust"] build-backend = "setuptools.build_meta" [[tool.setuptools-rust.ext-modules]] target = "my_module._lib" binding = "PyO3" # Then build and install: python -m pip install -e . Requires Rust toolchain (rustc, cargo) installed on the build system; Python 3.9 or later. Verify before relying: - Whether cross-compilation support (crossenv, cross, cargo-zigbuild) is production-ready or experimental. - Performance overhead or compilation time impact compared to C extensions. - Whether binary wheel distribution is supported on all major platforms (Linux, macOS, Windows). ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 6.9M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags rust python extension, setuptools rust plugin, pyo3 packaging, compile rust to python, rust cpython bindings, build rust modules, python rust integration, rust-bindings, extension-building, packaging [View on SkillFed](https://skillfed.io/packages/setuptools-rust) · [View on PyPI](https://pypi.org/project/setuptools-rust/)