[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-5666":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":23,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":38,"readmeContent":39,"aiSummary":40,"trendingCount":16,"starSnapshotCount":16,"syncStatus":41,"lastSyncTime":42,"discoverSource":43},5666,"maturin","PyO3\u002Fmaturin","PyO3","Build and publish crates with pyo3, cffi and uniffi bindings as well as rust binaries as python packages","https:\u002F\u002Fmaturin.rs",null,"Rust",5646,412,32,36,0,3,15,64,11,38.85,"Apache License 2.0",false,"main",[26,27,28,29,30,31,32,33,34,35,36,37],"cffi","cpython","cross-compile","hacktoberfest","manylinux","packaging","pyo3","pypi","pypy","python","uniffi","wheels","2026-06-12 02:01:13","# Maturin\n\n_formerly pyo3-pack_\n\n[![Maturin User Guide](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fuser-guide-brightgreen?logo=readthedocs&style=flat-square)](https:\u002F\u002Fmaturin.rs)\n[![Crates.io](https:\u002F\u002Fimg.shields.io\u002Fcrates\u002Fv\u002Fmaturin.svg?logo=rust&style=flat-square)](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fmaturin)\n[![PyPI](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fmaturin.svg?logo=python&style=flat-square)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fmaturin)\n[![discord server](https:\u002F\u002Fimg.shields.io\u002Fdiscord\u002F1209263839632424990?logo=discord&style=flat-square)](https:\u002F\u002Fdiscord.gg\u002F33kcChzH7f)\n\nBuild and publish crates with [pyo3, cffi and uniffi bindings](https:\u002F\u002Fmaturin.rs\u002Fbindings) as well as rust binaries as python packages with minimal configuration.\nIt supports building wheels for python 3.8+ on Windows, Linux, macOS and FreeBSD, can upload them to [pypi](https:\u002F\u002Fpypi.org\u002F) and has basic PyPy and GraalPy support.\n\nCheck out the [User Guide](https:\u002F\u002Fmaturin.rs\u002F)!\n\n## Usage\n\nYou can either download binaries from the [latest release](https:\u002F\u002Fgithub.com\u002FPyO3\u002Fmaturin\u002Freleases\u002Flatest) or install it with [pipx](https:\u002F\u002Fpypa.github.io\u002Fpipx\u002F) or [uv](https:\u002F\u002Fgithub.com\u002Fastral-sh\u002Fuv):\n\n```shell\n# pipx\npipx install maturin\n# uv\nuv tool install maturin\n```\n\n> [!NOTE]\n>\n> `pip install maturin` should also work if you don't want to use pipx.\n\nThere are three main commands:\n\n- `maturin new` creates a new cargo project with maturin configured.\n- `maturin build` builds the wheels and stores them in a folder (`target\u002Fwheels` by default), but doesn't upload them. It's recommended to publish packages with [uv](https:\u002F\u002Fgithub.com\u002Fastral-sh\u002Fuv) using `uv publish`.\n- `maturin develop` builds the crate and installs it as a python module directly in the current virtualenv. Note that while `maturin develop` is faster, it doesn't support all the feature that running `pip install` after `maturin build` supports.\n\nmaturin doesn't need extra configuration files and doesn't clash with an existing setuptools-rust configuration.\nYou can even integrate it with testing tools such as [tox](https:\u002F\u002Ftox.readthedocs.io\u002Fen\u002Flatest\u002F).\nThere are examples for the different bindings in the `test-crates` folder.\n\nThe name of the package will be the name of the cargo project, i.e. the name field in the `[package]` section of `Cargo.toml`.\nThe name of the module, which you are using when importing, will be the `name` value in the `[lib]` section (which defaults to the name of the package). For binaries, it's simply the name of the binary generated by cargo.\n\nWhen using `maturin build` and `maturin develop` commands, you can compile a performance-optimized program by adding the `-r` or `--release` flag.\n\n## Python packaging basics\n\nPython packages come in two formats:\nA built form called wheel and source distributions (sdist), both of which are archives.\nA wheel can be compatible with any python version, interpreter (cpython and pypy, mainly), operating system and hardware architecture (for pure python wheels),\ncan be limited to a specific platform and architecture (e.g. when using ctypes or cffi) or to a specific python interpreter and version on a specific architecture and operating system (e.g. with pyo3).\n\nWhen using `pip install` on a package, pip tries to find a matching wheel and install that. If it doesn't find one, it downloads the source distribution and builds a wheel for the current platform,\nwhich requires the right compilers to be installed. Installing a wheel is much faster than installing a source distribution as building wheels is generally slow.\n\nWhen you publish a package to be installable with `pip install`, you upload it to [pypi](https:\u002F\u002Fpypi.org\u002F), the official package repository.\nFor testing, you can use [test pypi](https:\u002F\u002Ftest.pypi.org\u002F) instead, which you can use with `pip install --index-url https:\u002F\u002Ftest.pypi.org\u002Fsimple\u002F`.\nNote that for [publishing for linux](#manylinux-and-auditwheel), you need to use the manylinux docker container or zig, while for publishing from your repository you can use the [PyO3\u002Fmaturin-action](https:\u002F\u002Fgithub.com\u002FPyO3\u002Fmaturin-action) github action.\n\n## Mixed rust\u002Fpython projects\n\nTo create a mixed rust\u002Fpython project, create a folder with your module name (i.e. [`lib.name` in Cargo.toml](https:\u002F\u002Fdoc.rust-lang.org\u002Fcargo\u002Freference\u002Fcargo-targets.html#the-name-field)) next to your Cargo.toml and add your python sources there:\n\n```\nmy-project\n├── Cargo.toml\n├── my_project\n│   ├── __init__.py\n│   └── bar.py\n├── pyproject.toml\n├── README.md\n└── src\n    └── lib.rs\n```\n\nYou can specify a different python source directory in `pyproject.toml` by setting `tool.maturin.python-source`, for example\n\n**pyproject.toml**\n\n```toml\n[tool.maturin]\npython-source = \"python\"\nmodule-name = \"my_project._lib_name\"\n```\n\nthen the project structure would look like this:\n\n```\nmy-project\n├── Cargo.toml\n├── python\n│   └── my_project\n│       ├── __init__.py\n│       └── bar.py\n├── pyproject.toml\n├── README.md\n└── src\n    └── lib.rs\n```\n\n> [!NOTE]\n>\n> This structure is recommended to avoid [a common `ImportError` pitfall](https:\u002F\u002Fgithub.com\u002FPyO3\u002Fmaturin\u002Fissues\u002F490)\n\nmaturin will add the native extension as a module in your python folder. When using develop, maturin will copy the native library and for cffi also the glue code to your python folder. You should add those files to your gitignore.\n\nWith cffi you can do `from .my_project import lib` and then use `lib.my_native_function`, with pyo3 you can directly `from .my_project import my_native_function`.\n\nExample layout with pyo3 after `maturin develop`:\n\n```\nmy-project\n├── Cargo.toml\n├── my_project\n│   ├── __init__.py\n│   ├── bar.py\n│   └── _lib_name.cpython-36m-x86_64-linux-gnu.so\n├── README.md\n└── src\n    └── lib.rs\n```\n\nWhen doing this also be sure to set the module name in your code to match the last part of `module-name` (don't include the package path):\n\n```rust\n#[pymodule]\n#[pyo3(name=\"_lib_name\")]\nfn my_lib_name(m: &Bound\u003C'_, PyModule>) -> PyResult\u003C()> {\n    m.add_class::\u003CMyPythonRustClass>()?;\n    Ok(())\n}\n```\n\n## Python metadata\n\nmaturin supports [PEP 621](https:\u002F\u002Fwww.python.org\u002Fdev\u002Fpeps\u002Fpep-0621\u002F), you can specify python package metadata in `pyproject.toml`.\nmaturin merges metadata from `Cargo.toml` and `pyproject.toml`, `pyproject.toml` takes precedence over `Cargo.toml`.\n\nTo specify python dependencies, add a list `dependencies` in a `[project]` section in the `pyproject.toml`. This list is equivalent to `install_requires` in setuptools:\n\n```toml\n[project]\nname = \"my-project\"\ndependencies = [\"flask~=1.1.0\", \"toml>=0.10.2,\u003C0.11.0\"]\n```\n\nYou can add so called console scripts, which are shell commands that execute some function in your program in the `[project.scripts]` section.\nThe keys are the script names while the values are the path to the function in the format `some.module.path:class.function`, where the `class` part is optional. The function is called with no arguments. Example:\n\n```toml\n[project.scripts]\nget_42 = \"my_project:DummyClass.get_42\"\n```\n\nYou can also specify [trove classifiers](https:\u002F\u002Fpypi.org\u002Fclassifiers\u002F) in your `pyproject.toml` under `project.classifiers`:\n\n```toml\n[project]\nname = \"my-project\"\nclassifiers = [\"Programming Language :: Python\"]\n```\n\n## Source distribution\n\nmaturin supports building through `pyproject.toml`. To use it, create a `pyproject.toml` next to your `Cargo.toml` with the following content:\n\n```toml\n[build-system]\nrequires = [\"maturin>=1.0,\u003C2.0\"]\nbuild-backend = \"maturin\"\n```\n\nIf a `pyproject.toml` with a `[build-system]` entry is present, maturin can build a source distribution of your package when `--sdist` is specified.\nThe source distribution will contain the same files as `cargo package`. To only build a source distribution, pass `--interpreter` without any values.\n\nYou can then e.g. install your package with `pip install .`. With `pip install . -v` you can see the output of cargo and maturin.\n\nYou can use the options `compatibility`, `skip-auditwheel`, `bindings`, `strip` and common Cargo build options such as `features` under `[tool.maturin]` the same way you would when running maturin directly.\nThe `bindings` key is required for cffi and bin projects as those can't be automatically detected. Currently, all builds are in release mode (see [this thread](https:\u002F\u002Fdiscuss.python.org\u002Ft\u002Fpep-517-debug-vs-release-builds\u002F1924) for details).\n\nFor a non-manylinux build with cffi bindings you could use the following:\n\n```toml\n[build-system]\nrequires = [\"maturin>=1.0,\u003C2.0\"]\nbuild-backend = \"maturin\"\n\n[tool.maturin]\nbindings = \"cffi\"\ncompatibility = \"linux\"\n```\n\n`manylinux` option is also accepted as an alias of `compatibility` for backward compatibility with old version of maturin.\n\nTo include arbitrary files in the sdist for use during compilation specify `include` as an array of `path` globs with `format` set to `sdist`:\n\n```toml\n[tool.maturin]\ninclude = [{ path = \"path\u002F**\u002F*\", format = \"sdist\" }]\n```\n\nThere's a `maturin sdist` command for only building a source distribution as workaround for [pypa\u002Fpip#6041](https:\u002F\u002Fgithub.com\u002Fpypa\u002Fpip\u002Fissues\u002F6041).\n\n## Manylinux and auditwheel\n\nFor portability reasons, native python modules on linux must only dynamically link a set of very few libraries which are installed basically everywhere, hence the name manylinux.\nThe pypa offers special docker images and a tool called [auditwheel](https:\u002F\u002Fgithub.com\u002Fpypa\u002Fauditwheel\u002F) to ensure compliance with the [manylinux rules](https:\u002F\u002Fpeps.python.org\u002Fpep-0599\u002F#the-manylinux2014-policy).\nIf you want to publish widely usable wheels for linux pypi, **you need to use a manylinux docker image or build with zig**.\n\nThe Rust compiler since version 1.64 [requires at least glibc 2.17](https:\u002F\u002Fblog.rust-lang.org\u002F2022\u002F08\u002F01\u002FIncreasing-glibc-kernel-requirements.html), so you need to use at least manylinux2014.\nFor publishing, we recommend enforcing the same manylinux version as the image with the manylinux flag, e.g. use `--manylinux 2014` if you are building in `quay.io\u002Fpypa\u002Fmanylinux2014_x86_64`.\nThe [PyO3\u002Fmaturin-action](https:\u002F\u002Fgithub.com\u002FPyO3\u002Fmaturin-action) github action already takes care of this if you set e.g. `manylinux: 2014`.\n\nmaturin contains a reimplementation of auditwheel automatically checks the generated library and gives the wheel the proper platform tag.\nIf your system's glibc is too new or you link other shared libraries, it will assign the `linux` tag.\nYou can also manually disable those checks and directly use native linux target with `--manylinux off`.\n\nFor full manylinux compliance you need to compile in a CentOS docker container. The [pyo3\u002Fmaturin](https:\u002F\u002Fghcr.io\u002Fpyo3\u002Fmaturin) image is based on the manylinux2014 image,\nand passes arguments to the `maturin` binary. You can use it like this:\n\n```\ndocker run --rm -v $(pwd):\u002Fio ghcr.io\u002Fpyo3\u002Fmaturin build --release  # or other maturin arguments\n```\n\nNote that this image is very basic and only contains python, maturin and stable rust. If you need additional tools, you can run commands inside the manylinux container.\nSee [konstin\u002Fcomplex-manylinux-maturin-docker](https:\u002F\u002Fgithub.com\u002Fkonstin\u002Fcomplex-manylinux-maturin-docker) for a small educational example or [nanoporetech\u002Ffast-ctc-decode](https:\u002F\u002Fgithub.com\u002Fnanoporetech\u002Ffast-ctc-decode\u002Fblob\u002Fb226ea0f2b2f4f474eff47349703d57d2ea4801b\u002F.github\u002Fworkflows\u002Fpublish.yml) for a real world setup.\n\nmaturin itself is manylinux compliant when compiled for the musl target.\n\n## Examples\n\n- [agg-python-bindings](https:\u002F\u002Fpypi.org\u002Fproject\u002Fagg-python-bindings) - A Python Library that binds to Asciinema Agg terminal record renderer and Avt terminal emulator\n- [ballista-python](https:\u002F\u002Fgithub.com\u002Fapache\u002Farrow-ballista-python) - A Python library that binds to Apache Arrow distributed query engine Ballista\n- [bleuscore](https:\u002F\u002Fgithub.com\u002Fshenxiangzhuang\u002Fbleuscore) - A BLEU score calculation library, written in pure Rust\n- [chardetng-py](https:\u002F\u002Fgithub.com\u002Fjohn-parton\u002Fchardetng-py) - Python binding for the chardetng character encoding detector.\n- [connector-x](https:\u002F\u002Fgithub.com\u002Fsfu-db\u002Fconnector-x\u002Ftree\u002Fmain\u002Fconnectorx-python) - ConnectorX enables you to load data from databases into Python in the fastest and most memory efficient way\n- [datafusion-python](https:\u002F\u002Fgithub.com\u002Fapache\u002Farrow-datafusion-python) - a Python library that binds to Apache Arrow in-memory query engine DataFusion\n- [deltalake-python](https:\u002F\u002Fgithub.com\u002Fdelta-io\u002Fdelta-rs\u002Ftree\u002Fmain\u002Fpython) - Native Delta Lake Python binding based on delta-rs with Pandas integration\n- [opendal](https:\u002F\u002Fgithub.com\u002Fapache\u002Fincubator-opendal\u002Ftree\u002Fmain\u002Fbindings\u002Fpython) - OpenDAL Python Binding to access data freely\n- [orjson](https:\u002F\u002Fgithub.com\u002Fijl\u002Forjson) - A fast, correct JSON library for Python\n- [polars](https:\u002F\u002Fgithub.com\u002Fpola-rs\u002Fpolars\u002Ftree\u002Fmaster\u002Fpy-polars) - Fast multi-threaded DataFrame library in Rust | Python | Node.js\n- [pydantic-core](https:\u002F\u002Fgithub.com\u002Fpydantic\u002Fpydantic-core) - Core validation logic for pydantic written in Rust\n- [pyrus-cramjam](https:\u002F\u002Fgithub.com\u002Fmilesgranger\u002Fpyrus-cramjam) - Thin Python wrapper to de\u002Fcompression algorithms in Rust\n- [pyxel](https:\u002F\u002Fgithub.com\u002Fkitao\u002Fpyxel) - A retro game engine for Python\n- [roapi](https:\u002F\u002Fgithub.com\u002Froapi\u002Froapi) - ROAPI automatically spins up read-only APIs for static datasets without requiring you to write a single line of code\n- [robyn](https:\u002F\u002Fgithub.com\u002Fsansyrox\u002Frobyn) - A fast and extensible async python web server with a Rust runtime\n- [ruff](https:\u002F\u002Fgithub.com\u002Fcharliermarsh\u002Fruff) - An extremely fast Python linter, written in Rust\n- [rnet](https:\u002F\u002Fgithub.com\u002F0x676e67\u002Frnet) - Asynchronous Python HTTP Client with Black Magic\n- [rustpy-xlsxwriter](https:\u002F\u002Fgithub.com\u002Frahmadafandi\u002Frustpy-xlsxwriter): A high-performance Python library for generating Excel files, utilizing the [rust_xlsxwriter](https:\u002F\u002Fgithub.com\u002Fjmcnamara\u002Frust_xlsxwriter) crate for efficient data handling.\n- [tantivy-py](https:\u002F\u002Fgithub.com\u002Fquickwit-oss\u002Ftantivy-py) - Python bindings for Tantivy\n- [tpchgen-cli](https:\u002F\u002Fgithub.com\u002Fclflushopt\u002Ftpchgen-rs\u002Ftree\u002Fmain\u002Ftpchgen-cli) - Python CLI binding for `tpchgen`, a blazing fast TPC-H benchmark data generator built in pure Rust with zero dependencies.\n- [watchfiles](https:\u002F\u002Fgithub.com\u002Fsamuelcolvin\u002Fwatchfiles) - Simple, modern and high performance file watching and code reload in python\n- [wonnx](https:\u002F\u002Fgithub.com\u002Fwebonnx\u002Fwonnx\u002Ftree\u002Fmaster\u002Fwonnx-py) - Wonnx is a GPU-accelerated ONNX inference run-time written 100% in Rust\n\n## Contributing\n\nEveryone is welcomed to contribute to maturin! There are many ways to support the project, such as:\n\n- help maturin users with issues on GitHub and Gitter\n- improve documentation\n- write features and bugfixes\n- publish blogs and examples of how to use maturin\n\nOur [contributing notes](https:\u002F\u002Fgithub.com\u002FPyO3\u002Fmaturin\u002Fblob\u002Fmain\u002Fguide\u002Fsrc\u002Fcontributing.md) have more resources if you wish to volunteer time for maturin and are searching where to start.\n\nIf you don't have time to contribute yourself but still wish to support the project's future success, some of our maintainers have GitHub sponsorship pages:\n\n- [messense](https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fmessense)\n\n## License\n\nLicensed under either of:\n\n- Apache License, Version 2.0, ([LICENSE-APACHE](https:\u002F\u002Fgithub.com\u002FPyO3\u002Fmaturin\u002Fblob\u002Fmain\u002Flicense-apache) or http:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-2.0)\n- MIT license ([LICENSE-MIT](https:\u002F\u002Fgithub.com\u002FPyO3\u002Fmaturin\u002Fblob\u002Fmain\u002Flicense-mit) or http:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT)\n\nat your option.\n","Maturin 是一个用于构建和发布带有 pyo3、cffi 和 uniffi 绑定的 Rust 项目以及将 Rust 二进制文件打包为 Python 包的工具。它支持在 Windows、Linux、macOS 和 FreeBSD 上为 Python 3.8+ 构建 wheel，并可以上传到 PyPI，同时提供了基本的 PyPy 和 GraalPy 支持。Maturin 的核心功能包括创建新的 Cargo 项目、构建 wheel 以及直接安装为 Python 模块进行开发，且无需额外配置文件即可与现有 setuptools-rust 配置兼容。该工具适用于需要将高性能 Rust 代码集成到 Python 项目中的开发者，特别是在跨平台环境下进行开发时。",2,"2026-06-11 03:04:36","top_language"]