Build manylinux wheels for a Python package with Rust bindings with maturin as a build back-end.
This action uses the manylinux Docker containers to
build manylinux wheels for a Python package. The wheels are placed in a
new directory <package-path>/dist
and can be uploaded to PyPI in the next step of your workflow.
This is a quite specific use case, but feel free to fork and adapt to your own needs.
- Your project must have a
pyproject.toml
and use poetry for dependency management. You can define which Python packages need to be installed before build that way.poetry update
is run on your package before compilation. - Your build back-end must be maturin, i.e. you have a Python project with Rust extensions.
Minimal:
uses: tmtenbrink/[email protected]
with:
python-versions: 'cp36-cp36m cp37-cp37m'
Using all arguments:
uses: tmtenbrink/[email protected]
with:
py-version: '3.9'
py-pep-425: 'cp39-cp39'
system-packages: 'lrzip-devel zlib-devel'
pre-build-command: 'sh pre-build-script.sh'
package-path: 'my_project'
See test.yml for a complete example that uploads the finished wheels as an artifact. If you want to build for multiple versions of Python, you can use a matrix, for example look at wheels.yml.
name | description | required | default | example(s) |
---|---|---|---|---|
py-version |
Python execution version | required | '3.9' |
'cp36-cp36m cp37-cp37m' |
py-pep-425 |
Python version tagsfor which to build (PEP 425 tags) wheels, as described in the manylinux image documentation | required | 'cp39-cp39' |
'cp36-cp36m' |
build-requirements |
Python (pip) packages required at build time, space-separated | optional | '' |
'cython' or 'cython==0.29.14' |
system-packages |
System (yum) packages required at build time, space-separated | optional | '' |
'lrzip-devel zlib-devel' |
pre-build-command |
Command to run before build, e.g. the execution of a script to perform additional build-environment setup | optional | '' |
'sh pre-build-script.sh' |
package-path |
Path to Python package to build (e.g. where pyproject.toml file is located), relative to repository root |
optional | '' |
'my_project' |
The action creates wheels, by default in the <package-path>/dist
directory.
The manylinux2010_x86_64
container is used by default.
Bugs, questions or suggestions? Feel free to post an issue in the issue tracker or to make a pull request!