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, GitHub Actions and CircleCI - and it builds and tests your wheels across all of your platforms.
What does it do?
| | macOS x8664 | Windows 64bit | Windows 32bit | manylinux x8664 | manylinux i686 | manylinux aarch64 | manylinux ppc64le | manylinux s390x |
| CPython 2.7 | ✅ | ✅¹ | ✅¹ | ✅ | ✅ | | | |
| CPython 3.5 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅² | ✅² | ✅³ |
| CPython 3.6 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅² | ✅² | ✅³ |
| CPython 3.7 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅² | ✅² | ✅³ |
| CPython 3.8 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅² | ✅² | ✅³ |
| CPython 3.9 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅² | ✅² | ✅³ |
| PyPy 2.7 v7.3.3 | ✅ | | ✅ | ✅ | | | | |
| PyPy 3.6 v7.3.3 | ✅ | | ✅ | ✅ | | | | |
| PyPy 3.7 (beta) v7.3.3 | ✅ | | ✅ | ✅ | | | | |
¹ Not supported on Travis
² Only supported on Travis
³ Beta support until Travis CI fixes a bug
- Builds manylinux, macOS and Windows wheels for CPython and PyPy 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
cibuildwheel currently works on Travis CI, Azure Pipelines, AppVeyor, GitHub Actions, CircleCI, and Gitlab CI. Check the table below for supported platforms on each service:
| | Linux | macOS | Windows | Linux ARM |
| Azure Pipelines | ✅ | ✅ | ✅ | ✴️¹ |
| Travis CI | ✅ | ✅ | ✅ | ✅ |
| AppVeyor | ✅ | ✅ | ✅ | |
| GitHub Actions | ✅ | ✅ | ✅ | ✴️¹ |
| CircleCI | ✅ | ✅ | | |
| Gitlab CI | ✅ | | | |
¹ Requires a "third-party build host"; expected to work with cibuildwheel but not directly tested by our CI.
cibuildwheel is not intended to run on your development machine. Because it uses system Python from Python.org it will try to install packages globally - not what you expect from a build tool! Instead, isolated CI services like those mentioned above are ideal.
To build manylinux, macOS, and Windows wheels on Travis CI and upload them to PyPI whenever you tag a version, you could use this
# perform a linux build
- services: docker
# and a mac build
- os: osx
# and a windows build
- os: windows
- choco install python --version 3.8.0
- export PATH="/c/Python38:/c/Python38/Scripts:$PATH"
# make sure it's on PATH as 'python3'
- ln -s /c/Python38/python.exe /c/Python38/python3.exe
# Note: TWINE_PASSWORD is set to a PyPI API token in Travis settings
- python3 -m pip install cibuildwheel==1.7.0
build the wheels, put them into './wheelhouse'
- python3 -m cibuildwheel --output-dir wheelhouse
if the release was tagged, upload them to PyPI
if [[ $TRAVIS_TAG ]]; then
python3 -m pip install twine
python3 -m twine upload wheelhouse/*.whl
For more information, including how to build on GitHub Actions, Appveyor, Azure Pipelines, or CircleCI, check out the documentation and the examples.
| | Option | Description |
| Build selection |
CIBW_PLATFORM | Override the auto-detected target platform |
CIBW_SKIP | Choose the Python versions to build |
| Build customization |
CIBW_ENVIRONMENT | Set environment variables needed during the build |
CIBW_BEFORE_ALL | Execute a shell command on the build system before any wheels are built. |
CIBW_BEFORE_BUILD | Execute a shell command preparing each wheel's build |
CIBW_REPAIR_WHEEL_COMMAND | Execute a shell command to repair each (non-pure Python) built wheel |
CIBW_MANYLINUX_S390X_IMAGE | Specify alternative manylinux docker images |
CIBW_DEPENDENCY_VERSIONS | Specify how cibuildwheel controls the versions of the tools it uses |
| Testing |
CIBW_TEST_COMMAND | Execute a shell command to test each built wheel |
CIBW_BEFORE_TEST | Execute a shell command before testing each wheel |
CIBW_TEST_REQUIRES | Install Python dependencies before running the tests |
CIBW_TEST_EXTRAS | Install your wheel for testing using extras_require |
| Other |
CIBW_BUILD_VERBOSITY | Increase/decrease the output of pip wheel |
Here are some repos that use cibuildwheel.
Matplotlib - The venerable Matplotlib, a Python library with C++ portions, built for Linux, Mac, and Windows on Github Actions.
pyinstrument_cext - A simple C extension, without external dependencies, built on Travis CI/Appveyor.
Parselmouth - A Python interface to the Praat software package, using pybind11, C++17 and CMake, with the core Praat static library built only once and shared between wheels; all platforms built on Github Actions.
twisted-iocpsupport - A submodule of Twisted that hooks into native C APIs using Cython. Built on Github CI for Windows.
etebase-py - Python bindings to a Rust library using
sccache for improved speed, built on Travis CI.
xmlstarlet - Python 3.6+ CFFI bindings with true MSVC build and GitHub Actions.
bx-python - A library that includes Cython extensions, built on Travis CI for Mac and Linux.
Add your repo here! Send a PR.
I'd like to include notes here to indicate why an example might be interesting to cibuildwheel users - the styles/technologies/techniques used in each. Please include that in future additions!
cibuildwheel repairs the wheel with
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.
26 November 2020
- ✨ New logging format, that uses 'fold groups' in CI services that support
- 🛠 Update PyPy to 7.3.3 (#460)
- 🐛 Fix a bug where CIBWBEFOREALL runs with a very old version of Python on
31 October 2020
- 🐛 Fix crash on Appveyor during nuget install due to old system CA
certificates. We now use certifi's CA certs to download files. (#455)
12 October 2020
- 🐛 Fix missing SSL certificates on macOS (#447)
- 🛠 Update OpenSSL Python 3.5 patch to 1.1.1h on macOS (#449)
9 October 2020
- ✨ Python 3.9 updated to the final release version - v3.9.0 (#440)
- 🛠 Pypy updated to v7.3.2, adding alpha support for Python 3.7 (#430)
20 September 2020
- 🛠 Add PPC64LE manylinux image supporting Python 3.9. (#436)
- 📚 Add project URLs to PyPI listing (#428)
9 September 2020
- 🌟 Add Python 3.9 support! This initial support uses release candidate
builds. You can start publishing wheels for Python 3.9 now, ahead of
the official release. (#382)
Minor note - if you're building PPC64LE wheels, the manylinux image pinned
by this version is
still on Python 3.9b3, not a
release candidate. We'd advise holding off on distributing 3.9 ppc64le wheels
until a subsequent version of cibuildwheel.
- 🌟 Add Gitlab CI support. Gitlab CI can now build Linux wheels, using
- 🐛 Fix a bug that causes pyproject.toml dependencies to fail to install on
- 📚 Added some information about Windows VC++ runtimes and how they relate
22 July 2020
- 🐛 Fix a bug that would cause command substitutions in CIBW_ENVIRONMENT to
produce no output on Linux (#411)
- 🐛 Fix regression (introduced in 1.5.3) which caused BEFOREBUILD and
BEFOREALL to be executed in the wrong directory (#410)
19 June 2020
- 🐛 Fix a bug that would cause command substitutions in CIBW_ENVIRONMENT
variables to not interpret quotes in commands correctly (#406, #408)
19 July 2020
- 🛠 Update CPython 3.8 to 3.8.3 (#405)
- 🛠 Internal refactoring of Linux build, to move control flow into Python (#386)
8 July 2020
- 🐛 Fix an issue on Windows where pyproject.toml would cause an error when
some requirements formats were used. (#401)
- 🛠 Update CPython 3.7 to 3.7.8 (#394)
25 June 2020
- 🐛 Fix "OSError: [WinError 17] The system cannot move the file to a different
disk drive" on Github Actions (#388, #389)
24 June 2020
- 🌟 Add
option, which lets you run a command on the build machine before any wheels
are built. This is especially useful when building on Linux, to
something external to Python, or to
yum install a dependency. (#342)
- ✨ Added support for projects using pyproject.toml instead of setup.py
- ✨ Added workaround to allow Python 3.5 on Windows to pull dependencies from
- 📚 Improved Github Actions examples and docs (#354, #362)
- 🐛 Ensure pip wheel uses the specified package, and doesn't build a wheel
from PyPI (#369)
- 🛠 Internal changes: using pathlib.Path, precommit hooks, testing
25 May 2020
- 🛠 Dependency updates, including CPython 3.8.3 & manylinux images.
- 🛠 Lots of internal updates - type annotations and checking using mypy, and
a new integration testing system.
- ⚠️ Removed support for running cibuildwheel using Python 3.5. cibuildwheel
will continue to build Python 3.5 wheels until EOL.
4 May 2020
- 🐛 Fix a bug causing programs running inside the i686 manylinux images to
think they were running x86_64 and target the wrong architecture. (#336,
2 May 2020
- 🌟 Deterministic builds. cibuildwheel now locks the versions of the tools it
uses. This means that pinning your version of cibuildwheel pins the versions
of pip, setuptools, manylinux etc. that are used under the hood. This should
make things more reliable. But note that we don't control the entire build
environment on macOS and Windows, where the version of Xcode and Visual
Studio can still effect things.
This can be controlled using the CIBWDEPENDENCYVERSIONS
and manylinux image
options - if you always want to use the latest toolchain, you can still do
that, or you can specify your own pip constraints file and manylinux image.
- ✨ Added
package_dir command line option, meaning we now support building
a package that lives in a subdirectory and pulls in files from the wider
project. See the
package_dir option help
for more information.
Note that this change makes the working directory (where you call
cibuildwheel from) relevant on Linux, as it's considered the 'project' and
will be copied into the Docker container. If your builds are slower on this
version, that's likely the reason.
cd to your project and then call
cibuildwheel from there. (#319, #295)
- 🛠 On macOS, we make
MACOSX_DEPLOYMENT_TARGET default to
10.9 if it's
not set. This should make things more consistent between Python versions.
- 🛠 Dependency updates - CPython 3.7.7, CPython 2.7.18, Pypy 7.3.1.
12 March 2020
- 🌟 Add support for building on Github Actions! Check out the
for information on how to set it up. (#194)
- ✨ Add the
CIBW_BEFORE_TEST option, which lets you run a command to
prepare the environment before your tests are run. (#242)
8 March 2020
- 🌟 Add support for building PyPy wheels, across Manylinux, macOS, and
- 🌟 Added the ability to build ARM64 (aarch64), ppc64le, and s390x wheels,
using manylinux2014 and Travis CI. (#273)
- ✨ You can now build macOS wheels on Appveyor. (#230)
- 🛠 Changed default macOS minimum target to 10.9, from 10.6. This allows the
use of more modern C++ libraries, among other things. (#156)
- 🛠 Stop building universal binaries on macOS. We now only build x86_64
wheels on macOS. (#220)
- ✨ Allow chaining of commands using
|| on Windows inside
CIBWBEFOREBUILD and CIBWTESTCOMMAND. (#293)
- 🛠 Improved error reporting for failed Cython builds due to stale .so files
- 🛠 Update CPython from 3.7.5 to 3.7.6 and from 3.8.0 to 3.8.2 on Mac/Windows
- 🛠 Improved error messages when a bad config breaks cibuildwheel's PATH
- ⚠️ Removed support for running cibuildwheel on Python 2.7. cibuildwheel
will continue to build Python 2.7 wheels for a little while. (#265)
7 December 2019
10 November 2019
- 🌟 Add support for building Python 3.8 wheels! (#180)
- 🌟 Add support for building manylinux2010 wheels. cibuildwheel will now
build using the manylinux2010 images by default. If your project is still
manylinux1 compatible, you should get both manylinux1 and manylinux2010
wheels - you can upload both to PyPI. If you always require manylinux1 wheels, you can
build using the old manylinux1 image using the manylinux image option.
- 📚 Documentation is now on its own mini-site,
rather than on the README (#169)
- ✨ Add support for building Windows wheels on Travis CI. (#160)
- 🛠 If you set
CIBW_TEST_COMMAND, your tests now run in a virtualenv. (#164)
- 🛠 Windows now uses Python as installed by nuget, rather than the versions
installed by the various CI providers. (#180)
- 🛠 Update Python from 2.7.16 to 2.7.17 and 3.7.4 to 3.7.5 on macOS (#171)
- ⚠️ Removed support for Python 3.4 (#168)
29 September 2019
- ✨ Add CIBWTESTEXTRAS option, to allow testing using extrarequire
options. For example, set `CIBWTESTEXTRAS=test,qt
to make the wheel
installed withpip install <wheelfile>[test,qt]`
- 🛠 Update Python from 3.7.2 to 3.7.4 on macOS
- 🛠 Update OpenSSL patch to 1.0.2t on macOS
28 May 2019
- 🐛 Fix missing file in the release tarball, that was causing problems with
Windows builds (#141)
26 May 2019
- 🌟 Add support for building on Azure pipelines! This lets you build all
Linux, Mac and Windows wheels on one service, so it promises to be the
easiest to set up! Check out the quickstart in the docs, or
for an example project. (#126, #132)
- 🛠 Internal change - the end-to-end test projects format was updated, so we
can more precisely assert what should be produced for each one. (#136, #137).
10 March 2019
- 🛠 Revert temporary fix in macOS, that was working around a bug in pip 19 (#129)
- 🛠 Update Python to 2.7.16 on macOS
- 🛠 Update OpenSSL patch to 1.0.2r on macOS
3 February 2019
- 🐛 Fix build stalling on macOS (that was introduced in pip 19) (#122)
- 🐛 Fix "AttributeError: 'Popen' object has no attribute 'args'" on Python 2.7 for Linux builds (#108)
- 🛠 Update Python from 3.6.7, 3.7.1 to 3.6.8, 3.7.2 on macOS
- 🛠 Update openssl patch from 1.0.2p to 1.0.2q on macOS
- 🛠 Sorting build options dict items when printing preamble (#114)
23 September 2018
- 🌟 Add
CIBW_BUILD option, for specifying which specific builds to perform (#101)
- 🌟 Add support for building Mac and Linux on CircleCI (#91, #97)
- 🛠 Improved support for building universal wheels (#95)
- 🛠 Ensure log output is unbuffered and therefore in the correct order (#92)
- 🛠 Improved error reporting for errors that occur inside a package's setup.py (#88)
- ⚠️ Removed support for Python 3.3 on Windows.
29 July 2018
- 🛠 CIBWTESTCOMMAND now runs in a shell on Mac (as well as Linux) (#81)
10 July 2018
- 🛠 Update to Python 3.6.6 on macOS (#82)
- ✨ Add support for building Python 3.7 wheels on Windows (#76)
- ⚠️ Deprecated support for Python 3.3 on Windows.
1 July 2018
- 🛠 Update Python 3.7.0rc1 to 3.7.0 on macOS (#79)
18 June 2018
- 🛠 Removed the need to use
CIBW_BEFORE_BUILD statements, by ensuring the correct version is always on the path at
pip instead. (#60)
- 🛠 We now patch the _ssl module on Python 3.4 and 3.5 so these versions can still make SSL web requests using TLS 1.2 while building. (#71)
18 June 2018
- ✨ Add support for Python 3.7 (#73)
4 May 2018
- ⚠️ Drop support for Python 3.3 on Linux (#67)
- 🐛 Fix TLS by updating setuptools (#69)
2 April 2017
- 🐛 macOS: Fix Pip bugs resulting from PyPI TLS 1.2 enforcement
- 🐛 macOS: Fix brew Python3 version problems in the CI
7 January 2018
9 October 2017
- ✨ On the Linux build, the host filesystem is now accessible via
- 🐛 Fixed a bug where setup.py scripts would run the wrong version of Python when running subprocesses on Linux (#35)
10 September 2017
- 🐛 Fixed a couple of bugs on Python 3.
- ✨ Added experimental support for Mac builds on Bitrise.io
7 September 2017
14 August 2017
- 🐛 Fixed a bug on Windows where subprocess' output was hidden (#23)
- 🐛 Fixed a bug on AppVeyor where logs would appear in the wrong order due to output buffering (#24, thanks @YannickJadoul!)
23 July 2017
27 June 2017
- ⚠️ Removed Python 2.6 support on Linux (#12)
11 June 2017
- 🛠 Changed the build process to install the package before building the wheel - this allows direct dependencies to be installed first (#9, thanks @tgarc!)
- ✨ Added Python 3 support for the main process, for systems where Python 3 is the default (#8, thanks @tgarc).
13 April 2017
- ✨ Added
CIBW_SKIP option, letting users explicitly skip a build
- ✨ Added
CIBW_BEFORE_BUILD option, letting users run a shell command before the build starts
31 March 2017
For more info on how to contribute to cibuildwheel, see the docs.
cibuildwheel stands on the shoulders of giants.
Massive props also to-
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.
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!