cibuildwheel
cibuildwheel simplifies the creation of Python wheels for various platforms and Python versions within Continuous Integration (CI) workflows. It builds manylinux, musllinux, macOS, and Windows wheels for CPython, PyPy, and GraalPy across multiple architectures. The library is actively maintained with frequent minor and patch releases, ensuring compatibility with the latest Python versions and CI environments.
Warnings
- deprecated Building for the experimental CPython 3.13 free-threading variant is now deprecated and will be removed in the next minor release. The `enable` option `cpython-freethreading` is also deprecated.
- deprecated cibuildwheel no longer officially supports running on Travis CI. While it may continue to function, it is no longer tested by the project.
- deprecated PyPy 3.10 has reached end-of-life (EOL) and has been moved to the `pypy-eol` group within the `enable` option.
- breaking Setting the `CIBW_FREE_THREADING_SUPPORT` environment variable will now raise an error. This variable is deprecated and likely indicates that 3.13t wheels are missing.
- gotcha Older versions of cibuildwheel (prior to 3.3.0) had known incompatibilities with Docker v29.
- gotcha cibuildwheel is designed for isolated CI environments and is not recommended for running on a local development machine, especially for macOS and Windows. It may install Python packages globally to system locations.
- gotcha When building macOS wheels with native library dependencies (e.g., installed via Homebrew), a common issue is that the libraries are compiled for the build machine's macOS version. This can lead to wheels that are not compatible with older macOS versions, as `MACOSX_DEPLOYMENT_TARGET` might be incorrectly set or ignored by external package managers.
Install
-
pip install cibuildwheel
Quickstart
name: Build
on:
[push, pull_request]
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-15-intel, macos-latest]
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
# Used to host cibuildwheel
- uses: actions/setup-python@v6
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==3.4.1
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
# to supply options, put them in 'env', like:
# env:
# CIBW_SOME_OPTION: value
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl