setuptools-rust is a setuptools helpers for Rust Python extensions. It supports
PyO3 by default.
For detailed usage, please refer to its README
To build a source code distribution, you need to add the following lines to your
MANIFEST.in file to ensure it correctly packages Rust extension source code.
include Cargo.toml recursive-include src *
Then you can build a source code distribution by (assuming you have already written a
python setup.py sdist
Binary wheel distribution
To build a binary wheel, manylinux would be a natural choice for Linux.
$ docker pull quay.io/pypa/manylinux1_x86_64
Then use the following command to build wheels for supported Python versions:
$ docker run --rm -v `pwd`:/io quay.io/pypa/manylinux1_x86_64 /io/build-wheels.sh
You will find all the wheels in
$ ls dist hello_rust-1.0-cp27-cp27m-linux_x86_64.whl hello_rust-1.0-cp35-cp35m-linux_x86_64.whl hello_rust-1.0-cp27-cp27m-manylinux1_x86_64.whl hello_rust-1.0-cp35-cp35m-manylinux1_x86_64.whl hello_rust-1.0-cp27-cp27mu-linux_x86_64.whl hello_rust-1.0-cp36-cp36m-linux_x86_64.whl hello_rust-1.0-cp27-cp27mu-manylinux1_x86_64.whl hello_rust-1.0-cp36-cp36m-manylinux1_x86_64.whl
*-manylinux1_x86_64.whl files are the
manylinux1 wheels that you can upload to PyPI.