Skip to main content

Build Python wheels on CI with minimal configuration.

Project description

cibuildwheel

PyPI Documentation Status Build Status Build status CircleCI Build Status

Documentation

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.

What does it do?

macOS 10.6+ intel macOS 10.9+ x86_64 manylinux i686 manylinux x86_64 Windows 32bit Windows 64bit
Python 2.7 ✅¹ ✅¹
Python 3.5
Python 3.6
Python 3.7
Python 3.8

¹ Not supported on Travis

  • 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 on Travis CI and Azure Pipelines to build wheels for all three supported platforms (Linux, macOS, Windows). On CircleCI Linux and macOS wheels can be built, and on AppVeyor Linux and Windows are supported.

Linux macOS Windows
Azure Pipelines
Travis CI
AppVeyor
CircleCI

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 Travis CI, CircleCI, Azure Pipelines and AppVeyor are ideal.

Example setup

To build manylinux, macOS, and Windows wheels on Travis CI and upload them to PyPI whenever you tag a version, you could use this .travis.yml:

language: python

jobs:
  include:
    # perform a linux build
    - services: docker
    # and a mac build
    - os: osx
      language: shell
    # and a windows build
    - os: windows
      language: shell
      before_install:
        - choco install python --version 3.8.0
        - export PATH="/c/Python38:/c/Python38/Scripts:$PATH"

env:
  global:
    - TWINE_USERNAME=joerick
      # Note: TWINE_PASSWORD is set in Travis settings

install:
  - python -m pip install twine cibuildwheel==1.1.0

script:
  # build the wheels, put them into './wheelhouse'
  - python -m cibuildwheel --output-dir wheelhouse

after_success:
  # if the release was tagged, upload them to PyPI
  - if [[ $TRAVIS_TAG ]]; then python -m twine upload wheelhouse/*.whl; fi

For more information, including how to build on Appveyor, Azure, CircleCI, check out the documentation and also check out the examples.

Options

Option Description
Build selection CIBW_PLATFORM Override the auto-detected target platform
CIBW_BUILD CIBW_SKIP Choose the Python versions to build
Build environment CIBW_ENVIRONMENT Set environment variables needed during the build
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_X86_64_IMAGE CIBW_MANYLINUX_I686_IMAGE Specify alternative manylinux docker images
Testing CIBW_TEST_COMMAND Execute a shell command to test each built 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

Working examples

Here are some repos that use cibuildwheel.

Add your repo here! Send a PR.

Legal note

Since cibuildwheel repairs the wheel with 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.

Changelog

1.1.0

7 December 2019

  • ✨ Add support for building manylinux2014 wheels. To use, set CIBW_MANYLINUX_X86_64_IMAGE and CIBW_MANYLINUX_I686_IMAGE to manylinux2014.
  • ✨ Add support for Linux on Appveyor (#204, #207)
  • ✨ Add CIBW_REPAIR_WHEEL_COMMAND env variable, for changing how auditwheel or delocate are invoked, or testing an equivalent on Windows. (#211)
  • 📚 Added some travis example configs - these are available in /examples. (#228)

1.0.0

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. (#155)
  • 📚 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)

0.12.0

29 September 2019

  • ✨ Add CIBW_TEST_EXTRAS option, to allow testing using extra_require options. For example, set CIBW_TEST_EXTRAS=test,qt to make the wheel installed with pip install <wheel_file>[test,qt]
  • 🛠 Update Python from 3.7.2 to 3.7.4 on macOS
  • 🛠 Update OpenSSL patch to 1.0.2t on macOS

0.11.1

28 May 2019

  • 🐛 Fix missing file in the release tarball, that was causing problems with Windows builds (#141)

0.11.0

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 cibuildwheel-azure-example 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).

0.10.2

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

0.10.1

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)

0.10.0

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.

0.9.4

29 July 2018

  • 🛠 CIBW_TEST_COMMAND now runs in a shell on Mac (as well as Linux) (#81)

0.9.3

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.

0.9.2

1 July 2018

  • 🛠 Update Python 3.7.0rc1 to 3.7.0 on macOS (#79)

0.9.1

18 June 2018

  • 🛠 Removed the need to use {python} and {pip} in CIBW_BEFORE_BUILD statements, by ensuring the correct version is always on the path at python and 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)

0.9.0

18 June 2018

  • ✨ Add support for Python 3.7 (#73)

0.8.0

4 May 2018

  • ⚠️ Drop support for Python 3.3 on Linux (#67)
  • 🐛 Fix TLS by updating setuptools (#69)

0.7.1

2 April 2017

  • 🐛 macOS: Fix Pip bugs resulting from PyPI TLS 1.2 enforcement
  • 🐛 macOS: Fix brew Python3 version problems in the CI

0.7.0

7 January 2018

  • ✨ You can now specify a custom docker image using the CIBW_MANYLINUX1_X86_64_IMAGE and CIBW_MANYLINUX1_I686_IMAGE options. (#46)
  • 🐛 Fixed a bug where cibuildwheel would download and build a package from PyPI(!) instead of building the package on the local machine. (#51)

0.6.0

9 October 2017

  • ✨ On the Linux build, the host filesystem is now accessible via /host (#36)
  • 🐛 Fixed a bug where setup.py scripts would run the wrong version of Python when running subprocesses on Linux (#35)

0.5.1

10 September 2017

  • 🐛 Fixed a couple of bugs on Python 3.
  • ✨ Added experimental support for Mac builds on Bitrise.io

0.5.0

7 September 2017

  • CIBW_ENVIRONMENT added. You can now set environment variables for each build, even within the Docker container on Linux. This is a big one! (#21)
  • CIBW_BEFORE_BUILD now runs in a system shell on all platforms. You can now do things like CIBW_BEFORE_BUILD="cmd1 && cmd2". (#32)

0.4.1

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!)

0.4.0

23 July 2017

  • 🐛 Fixed a bug that was increasing the build time by building the wheel twice. This was a problem for large projects that have a long build time. If you're upgrading and you need the old behaviour, use CIBW_BEFORE_BUILD={pip} install ., or install exactly the dependencies you need in CIBW_BEFORE_BUILD. See #18.

0.3.0

27 June 2017

  • ⚠️ Removed Python 2.6 support on Linux (#12)

0.2.1

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).

0.2.0

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

0.1.3

31 March 2017

  • 🌟 First public release!

Contributing

For more info on how to contribute to cibuildwheel, see the docs.

Maintainers

Credits

cibuildwheel stands on the shoulders of giants.

Massive props also to-

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!

Project details


Release history Release notifications | RSS feed

This version

1.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cibuildwheel-1.1.0.tar.gz (25.7 kB view details)

Uploaded Source

Built Distribution

cibuildwheel-1.1.0-py2.py3-none-any.whl (24.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file cibuildwheel-1.1.0.tar.gz.

File metadata

  • Download URL: cibuildwheel-1.1.0.tar.gz
  • Upload date:
  • Size: 25.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16

File hashes

Hashes for cibuildwheel-1.1.0.tar.gz
Algorithm Hash digest
SHA256 a86481df8cc043766a0cd5e1e6d39fead446f418d9c7b4b87595c4a9770341db
MD5 b4564185f68d80b6fe3b00c8e15dcc33
BLAKE2b-256 ca2a8599ccce0181932b6b25fbd1759aab22702057a2c456d0f14185708ee52a

See more details on using hashes here.

File details

Details for the file cibuildwheel-1.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: cibuildwheel-1.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.16

File hashes

Hashes for cibuildwheel-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5e9ffbd9ff8e27ab63b941e81fa030251d7d7577784b636a0d9f045e99212484
MD5 2c49fbec501464c2f509b6b0e90a7e70
BLAKE2b-256 6509a7885588a249020d0101b00a564e2ab738a135c4f05fd5c4f2c77024f73d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page