Contributions are welcome, and they are greatly appreciated!
You can contribute in many ways:
Report bugs at https://github.com/PyO3/maturin/issues.
Look through the GitHub issues for bugs. Anything tagged with bug
and help wanted
is open to whoever wants to implement it.
Look through the GitHub issues for features.
Maturin could always use more documentation, whether as part of the official guide, in docstrings or even on the web in blog posts, articles and such.
The best way to send feedback is to start a new discussion at https://github.com/PyO3/maturin/discussions.
Ready to contribute? Here's how to setup maturin for local development.
- Fork the maturin repository on GitHub.
- Clone your fork locally:
$ git clone [email protected]:your_name_here/maturin.git
- Install a stable Rust toolchain and of course Python 3.6 or later is also required.
- Create a branch for local development:
Now you can make your changes locally.
$ cd maturin $ git checkout -b branch-name
- When you're done making changes, ensure the tests pass by running
Note that in order to run tests you need to install
$ cargo test
virtualenv
(pip install virtualenv
). - make sure your changes are well formatted and pass the linting checks by
installing pre-commit and running
running
$ pre-commit run --hook-stage manual --all
pre-commit install
will enable running the checks automatically before every commit (except for the slow checks:cargo check
andcargo clippy
which are only run manually). You can also look at.pre-commit-config.yaml
and run the individual checks yourself if you prefer. - Commit your changes and push your branch to GitHub:
$ git add . $ git commit $ git push origin branch-name
- Submit a pull request through the GitHub website.
We provide a pre-configured dev container that could be used in Github Codespaces, VSCode, JetBrains, JuptyerLab.
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests if it adds or changes functionalities.
- Add a changelog entry.
- When command line interface changes, run
python3 test-crates/update_readme.py
to update related documentation.
To build the guide for local viewing, install mdBook and
run mdbook watch guide
from the repository root. The output can then be found at guide/book/index.html
.
The main part is the maturin library, which is completely documented and should be well integrable. The accompanying main.rs
takes care username and password for the pypi upload and otherwise calls into the library.
The sysconfig
folder contains the output of python -m sysconfig
for different python versions and platform, which is helpful during development.
You need to install cffi
and virtualenv
(pip install cffi virtualenv
) to run the tests.
You can set the MATURIN_TEST_PYTHON
environment variable to run the tests against a specific Python version,
for example MATURIN_TEST_PYTHON=python3.11 cargo test
will run the tests against Python 3.11.
There are some optional hacks that can speed up the tests (over 80s to 17s on my machine).
- By running
cargo build --release --manifest-path test-crates/cargo-mock/Cargo.toml
you can activate a cargo cache avoiding to rebuild the pyo3 test crates with every python version. - Delete
target/test-cache
to clear the cache (e.g. after changing a test crate) or removetest-crates/cargo-mock/target/release/cargo
to deactivate it. - By running the tests with the
faster-tests
feature, binaries are stripped and wheels are only stored and not compressed.