cibuildwheel
Python wheels are great. Building them across Mac, Linux, Windows, on multiple versions of Python, is not.
cibuildwheel is here to help. cibuildwheel runs on your CI server - currently it supports Azure Pipelines, Travis CI, AppVeyor, and CircleCI - and it builds and tests your wheels across all of your platforms.
cibuildwheel is in beta. It's brand new - I'd love for you to try it and help make it better!
What does it do?
| macOS 10.6+ | manylinux i686 | manylinux x86_64 | Windows 32bit | Windows 64bit | |
|---|---|---|---|---|---|
| Python 2.7 | ✅ | ✅ | ✅ | ✅ | ✅ |
| Python 3.4 | ✅ | ✅ | ✅ | ✅* | ✅* |
| Python 3.5 | ✅ | ✅ | ✅ | ✅ | ✅ |
| Python 3.6 | ✅ | ✅ | ✅ | ✅ | ✅ |
| Python 3.7 | ✅ | ✅ | ✅ | ✅ | ✅ |
* Not supported on Azure Pipelines
- Builds manylinux, macOS and Windows (32 and 64bit) wheels using Azure Pipelines, Travis CI, AppVeyor, and CircleCI
- Bundles shared library dependencies on Linux and macOS through auditwheel and delocate
- Runs the library test suite against the wheel-installed version of your library
Usage
cibuildwheel currently works Travis CI and CircleCI to build Linux and Mac wheels, and AppVeyor to build Windows wheels. Azure Pipelines supports all three.
| Linux | macOS | Windows | |
|---|---|---|---|
| Azure Pipelines | ✅ | ✅ | ✅ |
| Travis CI | ✅ | ✅ | |
| AppVeyor | ✅ | ||
| CircleCI | ✅ | ✅ |
cibuildwheel is not intended to run on your development machine. It will try to install packages globally; this is no good. Travis CI, CircleCI, and AppVeyor run their builds in isolated environments, so are ideal for this kind of script.
Example setup
To build manylinux and macOS wheels on Travis CI, and upload them to PyPI whenever you tag a version, you could use this .travis.yml:
language: python
matrix:
include:
- sudo: required
services:
- docker
env: PIP=pip
- os: osx
language: generic
env: PIP=pip2
env:
global:
- TWINE_USERNAME=joerick
# Note: TWINE_PASSWORD is set in Travis settings
script:
- $PIP install cibuildwheel==0.12.0
- cibuildwheel --output-dir wheelhouse
- |
if [[ $TRAVIS_TAG ]]; then
python -m pip install twine
python -m twine upload wheelhouse/*.whl
fi
Working examples
Here are some repos that use cibuildwheel.
- pyinstrument_cext
- websockets
- Parselmouth
- python-admesh
- pybase64
- KDEpy
- AutoPy
- apriltags2-ethz
- TgCrypto
- Twisted
Add repo here! Send a PR.
Legal note
Since cibuildwheel runs the wheel through delocate or auditwheel, it might automatically bundle dynamically linked libraries from the build machine.
It helps ensure that the library can run without any dependencies outside of the pip toolchain.
This is similar to static linking, so it might have some licence implications. Check the license for any code you're pulling in to make sure that's allowed.
Maintainers
- Joe Rickerby @joerick
- Tomas Garcia @tgarc
- Yannick Jadoul @YannickJadoul
- Matthieu Darbois @mayeut
Credits
cibuildwheel stands on the shoulders of giants.
- ⭐️ @matthew-brett for matthew-brett/multibuild and matthew-brett/delocate
- @PyPA for the manylinux Docker images pypa/manylinux
- @ogrisel for wheelhouse-uploader and
run_with_env.cmd
Massive props also to-
- @zfrenchee for help debugging many issues
- @lelit for some great bug reports and contributions
- @mayeut for a phenomenal PR patching Python itself for better compatibility!
See also
If you'd like to keep wheel building separate from the package itself, check out astrofrog/autowheel. It builds packages using cibuildwheel from source distributions on PyPI.
If cibuildwheel is too limited for your needs, consider matthew-brett/multibuild. multibuild is a toolbox for building a wheel on various platforms. It can do a lot more than this project - it's used to build SciPy!