cibuildwheel

cibuildwheel

PyPI Build Status Build status

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 Travis CI and Appveyor - 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.3
Python 3.4
Python 3.5
Python 3.6
  • Builds manylinux, macOS and Windows (32 and 64bit) wheels using Travis CI and Appveyor
  • 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 to build Linux and Mac wheels, and Appveyor to build Windows wheels.

cibuildwheel is not intended to run on your development machine. It will try to install packages globally; this is no good. Travis CI and Appveyor run their builds in isolated environments, so are ideal for this kind of script.

Minimal setup

  • Create a .travis.yml file in your repo.

    ”` matrix: include: - sudo: required services: - docker - os: osx

    script:

    • pip install cibuildwheel==0.1.3
    • cibuildwheel –output-dir wheelhouse “`

Then setup a deployment method by following the Travis CI deployment docs.

  • Create an appveyor.yml file in your repo.

    ”` build_script:

    • pip install cibuildwheel==0.1.3
    • cibuildwheel –output-dir wheelhouse artifacts:
    • path: “wheelhouse\*.whl” name: Wheels “`

Appveyor will store the built wheels for you - you can access them from the project console. Alternatively, you may want to store them in the same place as the Travis CI build. See Appveyor deployment docs for more info.

  • Commit those files, enable building of your repo on Travis CI and Appveyor, and push.

All being well, you should get wheels delivered to you in a few minutes.

⚠️ Got an error? Check the checklist below.

Options

usage: cibuildwheel [-h]
                    [--output-dir OUTPUT_DIR]
                    [--platform PLATFORM]
                    [project_dir]
    
Build wheels for all the platforms.

positional arguments:
  project_dir           Path to the project that you want wheels for.
                        Default: the current directory.

optional arguments:
  -h, --help            show this help message and exit
  --platform {auto,linux,macos,windows}
                        Platform to build for. For "linux" you need docker
                        running, on Mac or Linux. For "macos", you need a Mac
                        machine, and note that this script is going to
                        automatically install MacPython on your system, so
                        don't run on your development machine. For "windows",
                        you need to run in Windows, and it will build and test
                        for all versions of Python at C:\PythonXX[-x64].
  --output-dir OUTPUT_DIR
                        Destination folder for the wheels. 

Most of the config is via environment variables. These go into .travis.yml and appveyor.yml nicely.

Environment variable: CIBW_PLATFORM Command line argument: --platform

Options: auto linux macos windows

Default: auto

auto will auto-detect platform using environment variables, such as TRAVIS_OS_NAME/APPVEYOR.

For linux you need Docker running, on Mac or Linux. For macos, you need a Mac machine, and note that this script is going to automatically install MacPython on your system, so don’t run on your development machine. For windows, you need to run in Windows, and it will build and test for all versions of Python at C:\PythonXX[-x64].

Environment variable: CIBW_TEST_COMMAND

Optional.

Shell command to run the tests. The project root should be included in the command as “{project}”. The wheel will be installed automatically and available for import from the tests.

Example: nosetests {project}/tests

Environment variable: CIBW_TEST_REQUIRES

Optional.

Space-separated list of dependencies required for running the tests.

Example: pytest
Example: nose==1.3.7 moto==0.4.31

| Environment variable: CIBW_SKIP |

Related Repositories