Compare commits

...
41 Commits
Author SHA1 Message Date
Joe Rickerby 5e6ffa9f25 Bump version: v2.0.0b2 2021-07-09 22:18:03 +01:00
Joe Rickerby 718335b32d Merge pull request #753 from henryiii/henryiii/fix/revert
fix(action): use bash instead of powershell
2021-07-09 22:16:33 +01:00
Henry Schreiner 55264c914f fix(action): use bash 2021-07-09 16:24:47 -04:00
Joe Rickerby 63720bbc67 Bump version: v2.0.0b1 2021-07-09 18:56:12 +01:00
Henry SchreinerandJoe Rickerby 87499d4230 ci: fix circle ci image (#750)
* ci: fix circle min image

* Apply suggestions from code review

Co-authored-by: Joe Rickerby <joerick@mac.com>

Co-authored-by: Joe Rickerby <joerick@mac.com>
2021-07-09 13:30:06 -04:00
Moritz 0c32cc162e docs: fix toml syntax in example config code. (#751) 2021-07-09 12:23:06 -04:00
Henry SchreinerandJoe Rickerby 4307b52ff2 fix: support space in constraints file path (#738)
* tests: add space in constraints file

* fix: use uri strings in PIP_CONSTRAINTS

* WIP: try using quotes instead of uri

* Update cibuildwheel/windows.py

* Revert "Update cibuildwheel/windows.py"

This reverts commit 0951425524166677fdfd8df7e6bbbc9782ea2fb0.

* Revert "WIP: try using quotes instead of uri"

This reverts commit 5790eda4c6f231d5958f4cbd720683f787eea042.

* fix: work around pip bug with URI handling

* WIP: try biger hack

* fix: try using temporary file

* refactor: use common prefix for install dir on Windows

* Use more flexible type PathOrStr to simplify

* Rename variables to make slightly clearer

Co-authored-by: Joe Rickerby <joerick@mac.com>
2021-07-09 09:16:20 -04:00
Joe Rickerby 30954282fd Merge pull request #739 from pypa/options-table
Update options table in README for CIBW_BUILD_FRONTEND
2021-07-08 09:03:35 +01:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> 9e82a3ea32 [pre-commit.ci] pre-commit autoupdate (#748)
updates:
- [github.com/asottile/pyupgrade: v2.19.4 → v2.20.0](https://github.com/asottile/pyupgrade/compare/v2.19.4...v2.20.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-07-06 00:48:50 +02:00
Joe Rickerby c2ab8392f5 Merge pull request #747 from pypa/update-dependencies-pr
[Bot] Update dependencies
2021-07-05 11:27:46 +01:00
mayeut a49312635c Update dependencies 2021-07-05 06:10:47 +00:00
Matthieu Darbois fcf8892abc chore: update packaging dev requirement (#746)
* chore: update packaging dev requirement

Requires packaging>=21.0
This allows to simplify a bit `bin/update_pythons.py` with regards to typing.

* update packaging dev requirement for pre-commit
2021-07-03 19:07:52 +02:00
Henry Schreiner b552fbd016 fix(action): Output a single stream (#741) 2021-06-30 18:10:01 -04:00
Henry Schreiner 46fd5d9de4 docs: clarify location of dependabot file (#731)
* docs: clarify location of dependabot file

* Update faq.md
2021-06-29 23:33:09 -04:00
Joe Rickerby 79bf489a08 Update options table in README for CIBW_BUILD_FRONTEND 2021-06-29 20:50:16 +01:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> ec424751f5 [pre-commit.ci] pre-commit autoupdate (#737)
updates:
- [github.com/pre-commit/mirrors-mypy: v0.902 → v0.910](https://github.com/pre-commit/mirrors-mypy/compare/v0.902...v0.910)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-06-28 14:13:33 -04:00
cibuildwheel-bot[bot]andmayeut f879db2966 Update dependencies (#736)
Co-authored-by: mayeut <mayeut@users.noreply.github.com>
2021-06-28 09:17:01 -04:00
Joe Rickerby 489d560fff Update changelog 2021-06-25 13:59:08 +01:00
Joe Rickerby d6cf349b1a Bump version: v2.0.0a4 2021-06-25 13:55:15 +01:00
Henry SchreinerandJoe Rickerby 515e9be2c4 feat: support pypa build (#521)
* feat: support pypa build

fix: update `cibuildwheel.linux.troubleshoot` to know about build

Workaround issue with PyPy venv module by installing build[virtualenv]

fix: test_dependency_constraints_file when using build

fix: test/test_pep518.py

fix: use `strtobool` to parse `CIBW_PYPA_BUILD`

fix: update `cibuildwheel.linux.troubleshoot` to know about `python -m pip wheel`

test: use `build_mode` in `test/test_dependency_versions.py` tests

* refactor: use build-backend instead

* Apply suggestions from code review

Co-authored-by: Joe Rickerby <joerick@mac.com>

* refactor: use literal types for build_frontend

* refactor(tests): build_mode -> build_frontend_env

* Update test/test_before_build.py

Co-authored-by: Joe Rickerby <joerick@mac.com>
2021-06-23 10:47:18 -04:00
Henry Schreiner 9e1369e07d docs: add Python 3.8 to the identifer list (#728) 2021-06-22 18:14:57 -04:00
Henry Schreiner 122af66cd1 ci: also update projects displaly in workflow (#724) 2021-06-22 15:11:37 -04:00
Joe Rickerby 501562c572 Bump version: v2.0.0a3 2021-06-22 18:23:12 +01:00
Joe Rickerby 37afff43ad Update changelog 2021-06-22 18:16:31 +01:00
Joe RickerbyandHenry Schreiner b6a862a3ff Add a mkdocs extension to generate the --help output (#720)
* Add a mkdocs extension to generate the --help output

* Add the correct setuptools syntax for relative requirements

* docs: use macro plugin instead

* docs: remove indirection in docs

Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2021-06-22 12:18:22 +00:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> 5db1cf898e [pre-commit.ci] pre-commit autoupdate (#718)
updates:
- [github.com/PyCQA/isort: 5.8.0 → 5.9.1](https://github.com/PyCQA/isort/compare/5.8.0...5.9.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-06-21 14:51:24 -04:00
Henry Schreiner 703f6b9d82 docs: update star counts 2021-06-21 14:49:47 -04:00
Henry Schreiner 967d043895 fix(bin): nox -s update_proj didn't work 2021-06-21 14:49:47 -04:00
Henry Schreiner 68e47e4fcb chore: bump Python versions (3.10 beta 3) 2021-06-21 14:49:47 -04:00
Henry Schreiner e04bd54dd6 chore: update depenencies 2021-06-21 14:49:47 -04:00
f62cbc303a feat: configuration support (#684)
* feat: configuration support

* refactor: include manylinux, minor redesign

* "project global" overrides "default platform"

This allows overriding `repair-wheel-command` in the `[tool.cibuildwheel.global]` section.

* fix: add PyPy images

* refactor: remove global

* fix: support tables and arrays

* docs: add pyproject.toml config to docs

* docs: updates based on feedback

* fix: only join if sensible

* refactor: remove manylinux dict

* docs: examples headers and sections on each

* feat: support changing the config from the command line

* fix: use {package}

* tests: add a few tests and mention config one more place

* Restyle examples tabs to remove indent

* Unrelated docs improvements

* Absorb extra content into the tab

* Make the tabs smaller and to the right

* Copy edits to options

* Fix header ids

* Use fewer [tool.cibuildwheel] headers

* docs: minor additions/fixes

* feat: disallow options on some platforms

* docs: make the examples a tiny bit more tabby

* fix: enforce tables/lists are optionally separate

* Some unrelated fixes to the other tab styling

* Minor fix to tab styling

* Refactor to make code a bit more linear and immutable

* Minor docs changes

Co-authored-by: mayeut <mayeut@users.noreply.github.com>
Co-authored-by: Joe Rickerby <joerick@mac.com>
2021-06-21 12:26:46 -04:00
Joe Rickerby f7bdccfbd7 Merge pull request #717 from henryiii/henryiii/style/config 2021-06-21 00:08:47 +01:00
Henry Schreiner 07fd2fc7b1 chore: mypy extra and mypy types 2021-06-17 17:18:57 -04:00
Henry Schreiner 9c36d85eee docs: update wording on AS (#714)
Python 3.8+ supports this now. Unlikely to ever be back-ported further.
2021-06-16 22:33:32 -04:00
Henry Fredrick Schreiner 0aac8c2221 chore: stricter mypy checking 2021-06-12 14:02:06 -04:00
Henry Fredrick Schreiner 3311a36e65 chore: bump style, more in pyproject.toml 2021-06-12 12:01:40 -04:00
Henry Fredrick Schreiner 506f2dcb9c tests: simpler install 2021-06-12 12:01:40 -04:00
Henry Fredrick Schreiner 74466fb69d style: use bin extra 2021-06-12 11:14:39 -04:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> 31770e9ac7 [pre-commit.ci] pre-commit autoupdate (#713)
updates:
- [github.com/asottile/pyupgrade: v2.19.0 → v2.19.1](https://github.com/asottile/pyupgrade/compare/v2.19.0...v2.19.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-06-08 00:02:36 -04:00
Henry Schreiner e368cebe5a tests: fix for latest dockcross (#712) 2021-06-07 13:41:35 -04:00
Joe Rickerby 688c458172 Bump version: v2.0.0a2 2021-06-01 09:27:24 +01:00
58 changed files with 1753 additions and 667 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ version: 2
jobs: jobs:
osx-python3.6: osx-python3.6:
macos: macos:
xcode: 9.4.1 xcode: 12.5.1
environment: environment:
PYTHON: python3 PYTHON: python3
steps: steps:
+2 -2
View File
@@ -37,7 +37,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install -e ".[dev]" python -m pip install ".[test]"
- name: Sample build - name: Sample build
if: "contains(github.event.pull_request.labels.*.name, 'CI: Sample build')" if: "contains(github.event.pull_request.labels.*.name, 'CI: Sample build')"
@@ -70,7 +70,7 @@ jobs:
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install -r requirements-dev.txt python -m pip install ".[test]"
- name: Set up QEMU - name: Set up QEMU
id: qemu id: qemu
@@ -17,6 +17,8 @@ jobs:
run: nox --force-color -s update_constraints run: nox --force-color -s update_constraints
- name: "Run update: python configs" - name: "Run update: python configs"
run: nox --force-color -s update_pins run: nox --force-color -s update_pins
- name: "Run update: docs user projects"
run: nox --force-color -s update_proj
# we use this step to grab a Github App auth token, so that PRs generated by this workflow # we use this step to grab a Github App auth token, so that PRs generated by this workflow
# run the GHA tests. # run the GHA tests.
+21 -10
View File
@@ -14,7 +14,7 @@ repos:
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v2.19.0 rev: v2.20.0
hooks: hooks:
- id: pyupgrade - id: pyupgrade
name: PyUpgrade 3.6+ name: PyUpgrade 3.6+
@@ -26,12 +26,12 @@ repos:
args: ["--py37-plus"] args: ["--py37-plus"]
- repo: https://github.com/PyCQA/isort - repo: https://github.com/PyCQA/isort
rev: 5.8.0 rev: 5.9.1
hooks: hooks:
- id: isort - id: isort
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 21.5b2 rev: 21.6b0
hooks: hooks:
- id: black - id: black
@@ -42,17 +42,28 @@ repos:
stages: [manual] stages: [manual]
- repo: https://github.com/pre-commit/mirrors-mypy - repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.812 rev: v0.910
hooks: hooks:
- id: mypy - id: mypy
exclude: ^(bin/|cibuildwheel/resources/).*py$ exclude: ^(bin|cibuildwheel/resources|docs)/.*py$
additional_dependencies: [packaging] args: ["--python-version=3.6", "--scripts-are-modules"]
args: ["--python-version=3.6", "--ignore-missing-imports", "--scripts-are-modules"] additional_dependencies:
- packaging
- types-jinja2
- types-certifi
- types-toml
- id: mypy - id: mypy
name: mypy 3.7+ on bin/ name: mypy 3.7+ on bin/
files: ^bin/.*py$ files: ^(bin|docs)/.*py$
additional_dependencies: [packaging] args: ["--python-version=3.7", "--scripts-are-modules"]
args: ["--python-version=3.7", "--ignore-missing-imports", "--scripts-are-modules"] additional_dependencies:
- packaging>=21.0
- rich
- types-jinja2
- types-pyyaml
- types-click
- types-requests
- types-toml
- repo: https://github.com/PyCQA/flake8 - repo: https://github.com/PyCQA/flake8
rev: 3.9.2 rev: 3.9.2
+96 -73
View File
@@ -85,7 +85,7 @@ jobs:
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
- name: Install cibuildwheel - name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.0.0a1 run: python -m pip install cibuildwheel==2.0.0b2
- name: Build wheels - name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse run: python -m cibuildwheel --output-dir wheelhouse
@@ -107,14 +107,15 @@ Options
|---|--------|-------------| |---|--------|-------------|
| **Build selection** | [`CIBW_PLATFORM`](https://cibuildwheel.readthedocs.io/en/stable/options/#platform) | Override the auto-detected target platform | | **Build selection** | [`CIBW_PLATFORM`](https://cibuildwheel.readthedocs.io/en/stable/options/#platform) | Override the auto-detected target platform |
| | [`CIBW_BUILD`](https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip) <br> [`CIBW_SKIP`](https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip) | Choose the Python versions to build | | | [`CIBW_BUILD`](https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip) <br> [`CIBW_SKIP`](https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip) | Choose the Python versions to build |
| | [`CIBW_ARCHS`](https://cibuildwheel.readthedocs.io/en/stable/options/#archs) | Change the architectures built on your machine by default | | | [`CIBW_ARCHS`](https://cibuildwheel.readthedocs.io/en/stable/options/#archs) | Change the architectures built on your machine by default. |
| | [`CIBW_PROJECT_REQUIRES_PYTHON`](https://cibuildwheel.readthedocs.io/en/stable/options/#requires-python) | Manually set the Python compatibility of your project | | | [`CIBW_PROJECT_REQUIRES_PYTHON`](https://cibuildwheel.readthedocs.io/en/stable/options/#requires-python) | Manually set the Python compatibility of your project |
| | [`CIBW_PRERELEASE_PYTHONS`](https://cibuildwheel.readthedocs.io/en/stable/options/#prerelease-pythons) | Enable building with pre-release versions of Python | | | [`CIBW_PRERELEASE_PYTHONS`](https://cibuildwheel.readthedocs.io/en/stable/options/#prerelease-pythons) | Enable building with pre-release versions of Python |
| **Build customization** | [`CIBW_ENVIRONMENT`](https://cibuildwheel.readthedocs.io/en/stable/options/#environment) | Set environment variables needed during the build | | **Build customization** | [`CIBW_BUILD_FRONTEND`](https://cibuildwheel.readthedocs.io/en/stable/options/#build-frontend) | Set the tool to use to build, either "pip" (default for now) or "build" |
| | [`CIBW_ENVIRONMENT`](https://cibuildwheel.readthedocs.io/en/stable/options/#environment) | Set environment variables needed during the build |
| | [`CIBW_BEFORE_ALL`](https://cibuildwheel.readthedocs.io/en/stable/options/#before-all) | Execute a shell command on the build system before any wheels are built. | | | [`CIBW_BEFORE_ALL`](https://cibuildwheel.readthedocs.io/en/stable/options/#before-all) | Execute a shell command on the build system before any wheels are built. |
| | [`CIBW_BEFORE_BUILD`](https://cibuildwheel.readthedocs.io/en/stable/options/#before-build) | Execute a shell command preparing each wheel's build | | | [`CIBW_BEFORE_BUILD`](https://cibuildwheel.readthedocs.io/en/stable/options/#before-build) | Execute a shell command preparing each wheel's build |
| | [`CIBW_REPAIR_WHEEL_COMMAND`](https://cibuildwheel.readthedocs.io/en/stable/options/#repair-wheel-command) | Execute a shell command to repair each (non-pure Python) built wheel | | | [`CIBW_REPAIR_WHEEL_COMMAND`](https://cibuildwheel.readthedocs.io/en/stable/options/#repair-wheel-command) | Execute a shell command to repair each (non-pure Python) built wheel |
| | [`CIBW_MANYLINUX_X86_64_IMAGE`](https://cibuildwheel.readthedocs.io/en/stable/options/#manylinux-image) <br> [`CIBW_MANYLINUX_I686_IMAGE`](https://cibuildwheel.readthedocs.io/en/stable/options/#manylinux-image) <br> [`CIBW_MANYLINUX_PYPY_X86_64_IMAGE`](https://cibuildwheel.readthedocs.io/en/stable/options/#manylinux-image) <br> [`CIBW_MANYLINUX_AARCH64_IMAGE`](https://cibuildwheel.readthedocs.io/en/stable/options/#manylinux-image) <br> [`CIBW_MANYLINUX_PPC64LE_IMAGE`](https://cibuildwheel.readthedocs.io/en/stable/options/#manylinux-image) <br> [`CIBW_MANYLINUX_S390X_IMAGE`](https://cibuildwheel.readthedocs.io/en/stable/options/#manylinux-image) <br> [`CIBW_MANYLINUX_PYPY_AARCH64_IMAGE`](https://cibuildwheel.readthedocs.io/en/stable/options/#manylinux-image) <br> [`CIBW_MANYLINUX_PYPY_I686_IMAGE`](https://cibuildwheel.readthedocs.io/en/stable/options/#manylinux-image) | Specify alternative manylinux docker images | | | [`CIBW_MANYLINUX_*_IMAGE`](https://cibuildwheel.readthedocs.io/en/stable/options/#manylinux-image) | Specify alternative manylinux Docker images |
| | [`CIBW_DEPENDENCY_VERSIONS`](https://cibuildwheel.readthedocs.io/en/stable/options/#dependency-versions) | Specify how cibuildwheel controls the versions of the tools it uses | | | [`CIBW_DEPENDENCY_VERSIONS`](https://cibuildwheel.readthedocs.io/en/stable/options/#dependency-versions) | Specify how cibuildwheel controls the versions of the tools it uses |
| **Testing** | [`CIBW_TEST_COMMAND`](https://cibuildwheel.readthedocs.io/en/stable/options/#test-command) | Execute a shell command to test each built wheel | | **Testing** | [`CIBW_TEST_COMMAND`](https://cibuildwheel.readthedocs.io/en/stable/options/#test-command) | Execute a shell command to test each built wheel |
| | [`CIBW_BEFORE_TEST`](https://cibuildwheel.readthedocs.io/en/stable/options/#before-test) | Execute a shell command before testing each wheel | | | [`CIBW_BEFORE_TEST`](https://cibuildwheel.readthedocs.io/en/stable/options/#before-test) | Execute a shell command before testing each wheel |
@@ -123,6 +124,7 @@ Options
| | [`CIBW_TEST_SKIP`](https://cibuildwheel.readthedocs.io/en/stable/options/#test-skip) | Skip running tests on some builds | | | [`CIBW_TEST_SKIP`](https://cibuildwheel.readthedocs.io/en/stable/options/#test-skip) | Skip running tests on some builds |
| **Other** | [`CIBW_BUILD_VERBOSITY`](https://cibuildwheel.readthedocs.io/en/stable/options/#build-verbosity) | Increase/decrease the output of pip wheel | | **Other** | [`CIBW_BUILD_VERBOSITY`](https://cibuildwheel.readthedocs.io/en/stable/options/#build-verbosity) | Increase/decrease the output of pip wheel |
These options can be specified in a pyproject.toml file, as well; see [configuration](https://cibuildwheel.readthedocs.io/en/stable/options/#configuration).
Working examples Working examples
---------------- ----------------
@@ -156,8 +158,8 @@ Here are some repos that use cibuildwheel.
| [ruptures][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Extensive Cython + NumPy [pyproject.toml](https://github.com/deepcharles/ruptures/blob/master/pyproject.toml) example. | | [ruptures][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Extensive Cython + NumPy [pyproject.toml](https://github.com/deepcharles/ruptures/blob/master/pyproject.toml) example. |
| [aioquic][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | QUIC and HTTP/3 implementation in Python | | [aioquic][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | QUIC and HTTP/3 implementation in Python |
| [pikepdf][] | ![azurepipelines icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A Python library for reading and writing PDF, powered by qpdf | | [pikepdf][] | ![azurepipelines icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A Python library for reading and writing PDF, powered by qpdf |
| [DeepForest][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | An Efficient, Scalable and Optimized Python Framework for Deep Forest (2021.2.1) |
| [google neuroglancer][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | WebGL-based viewer for volumetric data | | [google neuroglancer][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | WebGL-based viewer for volumetric data |
| [DeepForest][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | An Efficient, Scalable and Optimized Python Framework for Deep Forest (2021.2.1) |
| [AutoPy][] | ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Includes a Windows Travis build. | | [AutoPy][] | ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Includes a Windows Travis build. |
| [Parselmouth][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | 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. | | [Parselmouth][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | 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. |
| [python-rapidjson][] | ![travisci icon][] ![gitlab icon][] ![appveyor icon][] | ![windows icon][] ![linux icon][] | Python wrapper around rapidjson | | [python-rapidjson][] | ![travisci icon][] ![gitlab icon][] ![appveyor icon][] | ![windows icon][] ![linux icon][] | Python wrapper around rapidjson |
@@ -173,27 +175,27 @@ Here are some repos that use cibuildwheel.
| [dd-trace-py][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Uses custom alternate arch emulation on GitHub | | [dd-trace-py][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Uses custom alternate arch emulation on GitHub |
| [iminuit][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Jupyter-friendly Python interface for C++ MINUIT2 | | [iminuit][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Jupyter-friendly Python interface for C++ MINUIT2 |
| [time-machine][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Time mocking library using only the CPython C API. | | [time-machine][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Time mocking library using only the CPython C API. |
| [matrixprofile][] | ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A Python 3 library making time series data mining tasks, utilizing matrix profile algorithms, accessible to everyone. |
| [CTranslate2][] | ![github icon][] | ![apple icon][] ![linux icon][] | Includes libraries from the [Intel oneAPI toolkit](https://software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit.html). The Linux wheels also include CUDA libraries for GPU execution. | | [CTranslate2][] | ![github icon][] | ![apple icon][] ![linux icon][] | Includes libraries from the [Intel oneAPI toolkit](https://software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit.html). The Linux wheels also include CUDA libraries for GPU execution. |
| [matrixprofile][] | ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A Python 3 library making time series data mining tasks, utilizing matrix profile algorithms, accessible to everyone. |
| [jq.py][] | ![travisci icon][] | ![apple icon][] ![linux icon][] | Python bindings for jq | | [jq.py][] | ![travisci icon][] | ![apple icon][] ![linux icon][] | Python bindings for jq |
| [Tokenizer][] | ![github icon][] ![travisci icon][] | ![apple icon][] ![linux icon][] | Fast and customizable text tokenization library with BPE and SentencePiece support | | [Tokenizer][] | ![github icon][] ![travisci icon][] | ![apple icon][] ![linux icon][] | Fast and customizable text tokenization library with BPE and SentencePiece support |
| [PyGLM][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Fast OpenGL Mathematics (GLM) for Python | | [PyGLM][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Fast OpenGL Mathematics (GLM) for Python |
| [bx-python][] | ![travisci icon][] | ![apple icon][] ![linux icon][] | A library that includes Cython extensions. | | [bx-python][] | ![travisci icon][] | ![apple icon][] ![linux icon][] | A library that includes Cython extensions. |
| [boost-histogram][] | ![github icon][] ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Supports full range of wheels, including PyPy and alternate archs. |
| [iDynTree][] | ![github icon][] | ![linux icon][] | Uses manylinux_2_24 | | [iDynTree][] | ![github icon][] | ![linux icon][] | Uses manylinux_2_24 |
| [boost-histogram][] | ![github icon][] ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Supports full range of wheels, including PyPy and alternate archs. |
| [TgCrypto][] | ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Includes a Windows Travis build. | | [TgCrypto][] | ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Includes a Windows Travis build. |
| [pybase64][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Fast Base64 encoding/decoding in Python | | [pybase64][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Fast Base64 encoding/decoding in Python |
| [etebase-py][] | ![travisci icon][] | ![linux icon][] | Python bindings to a Rust library using `setuptools-rust`, and `sccache` for improved speed. | | [etebase-py][] | ![travisci icon][] | ![linux icon][] | Python bindings to a Rust library using `setuptools-rust`, and `sccache` for improved speed. |
| [fathon][] | ![travisci icon][] | ![apple icon][] ![linux icon][] | python package for DFA (Detrended Fluctuation Analysis) and related algorithms |
| [pyjet][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | The interface between FastJet and NumPy | | [pyjet][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | The interface between FastJet and NumPy |
| [numpythia][] | ![github icon][] | ![apple icon][] ![linux icon][] | The interface between PYTHIA and NumPy | | [numpythia][] | ![github icon][] | ![apple icon][] ![linux icon][] | The interface between PYTHIA and NumPy |
| [fathon][] | ![travisci icon][] | ![apple icon][] ![linux icon][] | python package for DFA (Detrended Fluctuation Analysis) and related algorithms |
| [polaroid][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Full range of wheels for setuptools rust, with auto release and PyPI deploy. | | [polaroid][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Full range of wheels for setuptools rust, with auto release and PyPI deploy. |
| [GSD][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Cython and NumPy project with 64-bit wheels. | | [GSD][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Cython and NumPy project with 64-bit wheels. |
| [pybind11 scikit_build_example][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | An example combining scikit-build and pybind11 | | [pybind11 scikit_build_example][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | An example combining scikit-build and pybind11 |
| [pyinstrument_cext][] | ![travisci icon][] ![appveyor icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A simple C extension, without external dependencies | | [pyinstrument_cext][] | ![travisci icon][] ![appveyor icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A simple C extension, without external dependencies |
| [Imagecodecs (fork)][] | ![azurepipelines icon][] | ![apple icon][] ![linux icon][] | Over 20 external dependencies in compiled libraries, custom docker image, `libomp`, `openblas` and `install_name_tool` for macOS. |
| [xmlstarlet][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Python 3.6+ CFFI bindings with true MSVC build. | | [xmlstarlet][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Python 3.6+ CFFI bindings with true MSVC build. |
| [CorrectionLib][] | ![github icon][] | ![apple icon][] ![linux icon][] | Structured JSON powered correction library for HEP, designed for the CMS experiment at CERN. | | [CorrectionLib][] | ![github icon][] | ![apple icon][] ![linux icon][] | Structured JSON powered correction library for HEP, designed for the CMS experiment at CERN. |
| [Imagecodecs (fork)][] | ![azurepipelines icon][] | ![apple icon][] ![linux icon][] | Over 20 external dependencies in compiled libraries, custom docker image, `libomp`, `openblas` and `install_name_tool` for macOS. |
| [SiPM][] | ![github icon][] | ![apple icon][] ![linux icon][] | High performance library for SiPM detectors simulation using C++17, OpenMP and AVX2 intrinsics. | | [SiPM][] | ![github icon][] | ![apple icon][] ![linux icon][] | High performance library for SiPM detectors simulation using C++17, OpenMP and AVX2 intrinsics. |
[scikit-learn]: https://github.com/scikit-learn/scikit-learn [scikit-learn]: https://github.com/scikit-learn/scikit-learn
@@ -215,8 +217,8 @@ Here are some repos that use cibuildwheel.
[ruptures]: https://github.com/deepcharles/ruptures [ruptures]: https://github.com/deepcharles/ruptures
[aioquic]: https://github.com/aiortc/aioquic [aioquic]: https://github.com/aiortc/aioquic
[pikepdf]: https://github.com/pikepdf/pikepdf [pikepdf]: https://github.com/pikepdf/pikepdf
[DeepForest]: https://github.com/LAMDA-NJU/Deep-Forest
[google neuroglancer]: https://github.com/google/neuroglancer [google neuroglancer]: https://github.com/google/neuroglancer
[DeepForest]: https://github.com/LAMDA-NJU/Deep-Forest
[AutoPy]: https://github.com/autopilot-rs/autopy [AutoPy]: https://github.com/autopilot-rs/autopy
[Parselmouth]: https://github.com/YannickJadoul/Parselmouth [Parselmouth]: https://github.com/YannickJadoul/Parselmouth
[python-rapidjson]: https://github.com/python-rapidjson/python-rapidjson [python-rapidjson]: https://github.com/python-rapidjson/python-rapidjson
@@ -232,27 +234,27 @@ Here are some repos that use cibuildwheel.
[dd-trace-py]: https://github.com/DataDog/dd-trace-py [dd-trace-py]: https://github.com/DataDog/dd-trace-py
[iminuit]: https://github.com/scikit-hep/iminuit [iminuit]: https://github.com/scikit-hep/iminuit
[time-machine]: https://github.com/adamchainz/time-machine [time-machine]: https://github.com/adamchainz/time-machine
[matrixprofile]: https://github.com/matrix-profile-foundation/matrixprofile
[CTranslate2]: https://github.com/OpenNMT/CTranslate2 [CTranslate2]: https://github.com/OpenNMT/CTranslate2
[matrixprofile]: https://github.com/matrix-profile-foundation/matrixprofile
[jq.py]: https://github.com/mwilliamson/jq.py [jq.py]: https://github.com/mwilliamson/jq.py
[Tokenizer]: https://github.com/OpenNMT/Tokenizer [Tokenizer]: https://github.com/OpenNMT/Tokenizer
[PyGLM]: https://github.com/Zuzu-Typ/PyGLM [PyGLM]: https://github.com/Zuzu-Typ/PyGLM
[bx-python]: https://github.com/bxlab/bx-python [bx-python]: https://github.com/bxlab/bx-python
[boost-histogram]: https://github.com/scikit-hep/boost-histogram
[iDynTree]: https://github.com/robotology/idyntree [iDynTree]: https://github.com/robotology/idyntree
[boost-histogram]: https://github.com/scikit-hep/boost-histogram
[TgCrypto]: https://github.com/pyrogram/tgcrypto [TgCrypto]: https://github.com/pyrogram/tgcrypto
[pybase64]: https://github.com/mayeut/pybase64 [pybase64]: https://github.com/mayeut/pybase64
[etebase-py]: https://github.com/etesync/etebase-py [etebase-py]: https://github.com/etesync/etebase-py
[fathon]: https://github.com/stfbnc/fathon
[pyjet]: https://github.com/scikit-hep/pyjet [pyjet]: https://github.com/scikit-hep/pyjet
[numpythia]: https://github.com/scikit-hep/numpythia [numpythia]: https://github.com/scikit-hep/numpythia
[fathon]: https://github.com/stfbnc/fathon
[polaroid]: https://github.com/daggy1234/polaroid [polaroid]: https://github.com/daggy1234/polaroid
[GSD]: https://github.com/glotzerlab/gsd [GSD]: https://github.com/glotzerlab/gsd
[pybind11 scikit_build_example]: https://github.com/pybind/scikit_build_example [pybind11 scikit_build_example]: https://github.com/pybind/scikit_build_example
[pyinstrument_cext]: https://github.com/joerick/pyinstrument_cext [pyinstrument_cext]: https://github.com/joerick/pyinstrument_cext
[Imagecodecs (fork)]: https://github.com/czaki/imagecodecs_build
[xmlstarlet]: https://github.com/dimitern/xmlstarlet [xmlstarlet]: https://github.com/dimitern/xmlstarlet
[CorrectionLib]: https://github.com/cms-nanoAOD/correctionlib [CorrectionLib]: https://github.com/cms-nanoAOD/correctionlib
[Imagecodecs (fork)]: https://github.com/czaki/imagecodecs_build
[SiPM]: https://github.com/EdoPro98/SimSiPM [SiPM]: https://github.com/EdoPro98/SimSiPM
[appveyor icon]: docs/data/readme_icons/appveyor.svg [appveyor icon]: docs/data/readme_icons/appveyor.svg
@@ -265,64 +267,64 @@ Here are some repos that use cibuildwheel.
[apple icon]: docs/data/readme_icons/apple.svg [apple icon]: docs/data/readme_icons/apple.svg
[linux icon]: docs/data/readme_icons/linux.svg [linux icon]: docs/data/readme_icons/linux.svg
<!-- scikit-learn: 45793, last pushed 0 days ago --> <!-- scikit-learn: 46313, last pushed 0 days ago -->
<!-- Matplotlib: 13636, last pushed 0 days ago --> <!-- Matplotlib: 13847, last pushed 0 days ago -->
<!-- MyPy: 10696, last pushed 0 days ago --> <!-- MyPy: 10969, last pushed 0 days ago -->
<!-- psutil: 7319, last pushed 4 days ago --> <!-- psutil: 7454, last pushed 4 days ago -->
<!-- scikit-image: 4342, last pushed 0 days ago --> <!-- scikit-image: 4405, last pushed 0 days ago -->
<!-- twisted-iocpsupport: 4266, last pushed 0 days ago --> <!-- twisted-iocpsupport: 4293, last pushed 8 days ago -->
<!-- websockets: 3349, last pushed 0 days ago --> <!-- websockets: 3442, last pushed 8 days ago -->
<!-- pyzmq: 2792, last pushed 1 days ago --> <!-- pyzmq: 2832, last pushed 16 days ago -->
<!-- aiortc: 2396, last pushed 32 days ago --> <!-- aiortc: 2457, last pushed 23 days ago -->
<!-- River: 1604, last pushed 0 days ago --> <!-- River: 1722, last pushed 5 days ago -->
<!-- coverage.py: 1592, last pushed 6 days ago --> <!-- coverage.py: 1639, last pushed 11 days ago -->
<!-- numexpr: 1586, last pushed 75 days ago --> <!-- numexpr: 1600, last pushed 123 days ago -->
<!-- h5py: 1517, last pushed 1 days ago --> <!-- h5py: 1533, last pushed 6 days ago -->
<!-- Dependency Injector: 1318, last pushed 20 days ago --> <!-- Dependency Injector: 1422, last pushed 10 days ago -->
<!-- PyAV: 1246, last pushed 2 days ago --> <!-- PyAV: 1286, last pushed 28 days ago -->
<!-- PyTables: 1023, last pushed 53 days ago --> <!-- PyTables: 1037, last pushed 101 days ago -->
<!-- ruptures: 704, last pushed 0 days ago --> <!-- ruptures: 749, last pushed 6 days ago -->
<!-- aioquic: 644, last pushed 13 days ago --> <!-- aioquic: 693, last pushed 20 days ago -->
<!-- pikepdf: 624, last pushed 9 days ago --> <!-- pikepdf: 671, last pushed 4 days ago -->
<!-- DeepForest: 591, last pushed 6 days ago --> <!-- google neuroglancer: 655, last pushed 3 days ago -->
<!-- google neuroglancer: 586, last pushed 3 days ago --> <!-- DeepForest: 627, last pushed 34 days ago -->
<!-- AutoPy: 533, last pushed 251 days ago --> <!-- AutoPy: 544, last pushed 17 days ago -->
<!-- Parselmouth: 511, last pushed 0 days ago --> <!-- Parselmouth: 524, last pushed 11 days ago -->
<!-- python-rapidjson: 420, last pushed 156 days ago --> <!-- python-rapidjson: 423, last pushed 9 days ago -->
<!-- Rtree: 403, last pushed 59 days ago --> <!-- Rtree: 412, last pushed 106 days ago -->
<!-- python-snappy: 398, last pushed 82 days ago --> <!-- python-snappy: 405, last pushed 129 days ago -->
<!-- markupsafe: 390, last pushed 0 days ago --> <!-- markupsafe: 402, last pushed 2 days ago -->
<!-- H3-py: 376, last pushed 0 days ago --> <!-- H3-py: 397, last pushed 22 days ago -->
<!-- pybind11 cmake_example: 271, last pushed 6 days ago --> <!-- pybind11 cmake_example: 285, last pushed 9 days ago -->
<!-- KDEpy: 264, last pushed 7 days ago --> <!-- KDEpy: 280, last pushed 31 days ago -->
<!-- cyvcf2: 260, last pushed 19 days ago --> <!-- cyvcf2: 265, last pushed 66 days ago -->
<!-- pybind11 python_example: 250, last pushed 6 days ago --> <!-- pybind11 python_example: 255, last pushed 12 days ago -->
<!-- sourmash: 241, last pushed 0 days ago --> <!-- sourmash: 252, last pushed 0 days ago -->
<!-- dd-trace-py: 237, last pushed 0 days ago --> <!-- dd-trace-py: 251, last pushed 3 days ago -->
<!-- iminuit: 181, last pushed 0 days ago --> <!-- iminuit: 181, last pushed 0 days ago -->
<!-- time-machine: 160, last pushed 0 days ago --> <!-- time-machine: 178, last pushed 1 days ago -->
<!-- matrixprofile: 158, last pushed 68 days ago --> <!-- CTranslate2: 170, last pushed 3 days ago -->
<!-- CTranslate2: 157, last pushed 0 days ago --> <!-- matrixprofile: 167, last pushed 9 days ago -->
<!-- jq.py: 152, last pushed 15 days ago --> <!-- jq.py: 159, last pushed 12 days ago -->
<!-- Tokenizer: 140, last pushed 14 days ago --> <!-- Tokenizer: 147, last pushed 9 days ago -->
<!-- PyGLM: 103, last pushed 7 days ago --> <!-- PyGLM: 105, last pushed 54 days ago -->
<!-- bx-python: 102, last pushed 47 days ago --> <!-- bx-python: 103, last pushed 20 days ago -->
<!-- boost-histogram: 78, last pushed 0 days ago --> <!-- iDynTree: 82, last pushed 19 days ago -->
<!-- iDynTree: 75, last pushed 3 days ago --> <!-- boost-histogram: 81, last pushed 4 days ago -->
<!-- TgCrypto: 64, last pushed 16 days ago --> <!-- TgCrypto: 66, last pushed 35 days ago -->
<!-- pybase64: 62, last pushed 1 days ago --> <!-- pybase64: 65, last pushed 0 days ago -->
<!-- etebase-py: 50, last pushed 134 days ago --> <!-- etebase-py: 50, last pushed 181 days ago -->
<!-- pyjet: 28, last pushed 6 days ago --> <!-- fathon: 32, last pushed 32 days ago -->
<!-- numpythia: 28, last pushed 15 days ago --> <!-- pyjet: 29, last pushed 46 days ago -->
<!-- fathon: 25, last pushed 65 days ago --> <!-- numpythia: 28, last pushed 11 days ago -->
<!-- polaroid: 16, last pushed 69 days ago --> <!-- polaroid: 18, last pushed 6 days ago -->
<!-- GSD: 16, last pushed 1 days ago --> <!-- GSD: 16, last pushed 3 days ago -->
<!-- pybind11 scikit_build_example: 14, last pushed 6 days ago --> <!-- pybind11 scikit_build_example: 14, last pushed 12 days ago -->
<!-- pyinstrument_cext: 10, last pushed 95 days ago --> <!-- pyinstrument_cext: 10, last pushed 4 days ago -->
<!-- xmlstarlet: 7, last pushed 29 days ago --> <!-- Imagecodecs (fork): 10, last pushed 9 days ago -->
<!-- CorrectionLib: 5, last pushed 5 days ago --> <!-- xmlstarlet: 7, last pushed 76 days ago -->
<!-- Imagecodecs (fork): 3, last pushed 19 days ago --> <!-- CorrectionLib: 6, last pushed 12 days ago -->
<!-- SiPM: 2, last pushed 15 days ago --> <!-- SiPM: 4, last pushed 1 days ago -->
<!-- END bin/projects.py --> <!-- END bin/projects.py -->
@@ -350,14 +352,35 @@ Changelog
_This release is currently in prerelease. The below release notes will be condensed into a single entry when we do a final release._ _This release is currently in prerelease. The below release notes will be condensed into a single entry when we do a final release._
_v2.0.0a1 (1 Jun 2021)_ _v2.0.0b2 (9 July 2021)_
- 🐛 Bug fix to the GitHub action (#753)
_v2.0.0b1 (9 July 2021)_
- 🐛 Bug fixes & docs improvements
_v2.0.0a4 (25 June 2021)_
- 🌟 Added support for building wheels with [build](https://github.com/pypa/build), as well as pip. This feature is controlled with the [`CIBW_BUILD_FRONTEND`](https://cibuildwheel.readthedocs.io/en/latest/options/#build-frontend) option.
_v2.0.0a3 (22 June 2021)_
- 🌟 You can now configure cibuildwheel options inside your project's `pyproject.toml`! Environment variables still work of course. Check out the [documentation](https://cibuildwheel.readthedocs.io/en/latest/options/#setting-options) for more info.
_v2.0.0a2 (1 June 2021)_
- 🌟 Added the ability to test building wheels on CPython 3.10! Because CPython 3.10 is in beta, these wheels should not be distributed, because they might not be compatible with the final release, but it's available to build for testing purposes. Use the flag [`--prerelease-pythons` or `CIBW_PRERELEASE_PYTHONS`](https://cibuildwheel.readthedocs.io/en/latest/options/#prerelease-pythons) to test. (#675) - 🌟 Added the ability to test building wheels on CPython 3.10! Because CPython 3.10 is in beta, these wheels should not be distributed, because they might not be compatible with the final release, but it's available to build for testing purposes. Use the flag [`--prerelease-pythons` or `CIBW_PRERELEASE_PYTHONS`](https://cibuildwheel.readthedocs.io/en/latest/options/#prerelease-pythons) to test. (#675)
- ✨ Added the ability to build CPython 3.8 wheels on Apple Silicon. (#704) - ✨ Added the ability to build CPython 3.8 wheels for Apple Silicon. (#704)
- 🛠 Update to the latest build dependencies, including auditwheel 4. (#633) - 🛠 Update to the latest build dependencies, including auditwheel 4. (#633)
- 🛠 Use the unified pypa/manylinux images to build PyPy (#671) - 🛠 Use the unified pypa/manylinux images to build PyPy (#671)
- ⚠️ Removed support for building Python 2.7 and Python 3.5 wheels, for both CPython and PyPy. If you still need to build on these versions, please use the latest v1.x version. (#596) - ⚠️ Removed support for building Python 2.7 and Python 3.5 wheels, for both CPython and PyPy. If you still need to build on these versions, please use the latest v1.x version. (#596)
### v1.12.0
_22 June 2021_
- ✨ Adds support building macOS universal2/arm64 wheels on Python 3.8.
### v1.11.1 ### v1.11.1
+4 -4
View File
@@ -17,12 +17,12 @@ runs:
using: composite using: composite
steps: steps:
# This needs powershell-core because github.action path is a Windows-style # Redirecting stderr to stdout to fix interleaving issue in Actions.
# path on Windows. Powershell-core understands both types of paths.
- run: > - run: >
pipx run pipx run
--spec ${{ github.action_path }} --spec '${{ github.action_path }}'
cibuildwheel cibuildwheel
${{ inputs.package-dir }} ${{ inputs.package-dir }}
--output-dir ${{ inputs.output-dir }} --output-dir ${{ inputs.output-dir }}
shell: pwsh 2>&1
shell: bash
Executable → Regular
+1 -1
View File
@@ -62,7 +62,7 @@ class Project:
print(f"Broken: {self.stars_repo}") print(f"Broken: {self.stars_repo}")
raise raise
self.num_stars = repo.stargazers_count self.num_stars: int = repo.stargazers_count
self.pushed_at = repo.pushed_at self.pushed_at = repo.pushed_at
if not self.notes: if not self.notes:
notes = repo.description notes = repo.description
+6 -6
View File
@@ -6,7 +6,7 @@ import copy
import difflib import difflib
import logging import logging
from pathlib import Path from pathlib import Path
from typing import Any, Iterable, Union, cast from typing import Any, Union
import click import click
import requests import requests
@@ -86,7 +86,7 @@ class WindowsVersions:
# Specifier.filter selects all non pre-releases that match the spec, # Specifier.filter selects all non pre-releases that match the spec,
# unless there are only pre-releases, then it selects pre-releases # unless there are only pre-releases, then it selects pre-releases
# instead (like pip) # instead (like pip)
unsorted_versions = cast(Iterable[Version], spec.filter(self.version_dict)) unsorted_versions = spec.filter(self.version_dict)
versions = sorted(unsorted_versions, reverse=True) versions = sorted(unsorted_versions, reverse=True)
log.debug(f"Windows {self.arch} {spec} has {', '.join(str(v) for v in versions)}") log.debug(f"Windows {self.arch} {spec} has {', '.join(str(v) for v in versions)}")
@@ -122,7 +122,7 @@ class PyPyVersions:
self.arch = arch_str self.arch = arch_str
def get_arch_file(self, release: dict[str, Any]) -> str: def get_arch_file(self, release: dict[str, Any]) -> str:
urls = [ urls: list[str] = [
rf["download_url"] rf["download_url"]
for rf in release["files"] for rf in release["files"]
if "" in rf["platform"] == f"win{self.arch}" if "" in rf["platform"] == f"win{self.arch}"
@@ -131,7 +131,7 @@ class PyPyVersions:
def update_version_windows(self, spec: Specifier) -> ConfigWinCP: def update_version_windows(self, spec: Specifier) -> ConfigWinCP:
releases = [r for r in self.releases if spec.contains(r["python_version"])] releases = [r for r in self.releases if spec.contains(r["python_version"])]
releases = sorted(releases, key=lambda r: r["pypy_version"]) releases = sorted(releases, key=lambda r: r["pypy_version"]) # type: ignore
releases = [r for r in releases if self.get_arch_file(r)] releases = [r for r in releases if self.get_arch_file(r)]
if not releases: if not releases:
@@ -156,7 +156,7 @@ class PyPyVersions:
raise RuntimeError("Other archs not supported yet on macOS") raise RuntimeError("Other archs not supported yet on macOS")
releases = [r for r in self.releases if spec.contains(r["python_version"])] releases = [r for r in self.releases if spec.contains(r["python_version"])]
releases = sorted(releases, key=lambda r: r["pypy_version"]) releases = sorted(releases, key=lambda r: r["pypy_version"]) # type: ignore
if not releases: if not releases:
raise RuntimeError(f"PyPy macOS {self.arch} not found for {spec}!") raise RuntimeError(f"PyPy macOS {self.arch} not found for {spec}!")
@@ -201,7 +201,7 @@ class CPythonVersions:
) -> ConfigMacOS | None: ) -> ConfigMacOS | None:
# see note above on Specifier.filter # see note above on Specifier.filter
unsorted_versions = cast(Iterable[Version], spec.filter(self.versions_dict)) unsorted_versions = spec.filter(self.versions_dict)
sorted_versions = sorted(unsorted_versions, reverse=True) sorted_versions = sorted(unsorted_versions, reverse=True)
if version <= Version("3.8.9999"): if version <= Version("3.8.9999"):
+1 -1
View File
@@ -1 +1 @@
__version__ = "2.0.0a1" __version__ = "2.0.0b2"
+75 -95
View File
@@ -5,7 +5,7 @@ import textwrap
import traceback import traceback
from configparser import ConfigParser from configparser import ConfigParser
from pathlib import Path from pathlib import Path
from typing import Dict, List, Optional, Set, Union, overload from typing import Dict, List, Optional, Set, Union
from packaging.specifiers import SpecifierSet from packaging.specifiers import SpecifierSet
@@ -16,9 +16,11 @@ import cibuildwheel.util
import cibuildwheel.windows import cibuildwheel.windows
from cibuildwheel.architecture import Architecture, allowed_architectures_check from cibuildwheel.architecture import Architecture, allowed_architectures_check
from cibuildwheel.environment import EnvironmentParseError, parse_environment from cibuildwheel.environment import EnvironmentParseError, parse_environment
from cibuildwheel.options import ConfigOptions
from cibuildwheel.projectfiles import get_requires_python_str from cibuildwheel.projectfiles import get_requires_python_str
from cibuildwheel.typing import PLATFORMS, PlatformName, assert_never from cibuildwheel.typing import PLATFORMS, PlatformName, assert_never
from cibuildwheel.util import ( from cibuildwheel.util import (
BuildFrontend,
BuildOptions, BuildOptions,
BuildSelector, BuildSelector,
DependencyConstraints, DependencyConstraints,
@@ -28,39 +30,16 @@ from cibuildwheel.util import (
resources_dir, resources_dir,
) )
MANYLINUX_ARCHS = (
@overload "x86_64",
def get_option_from_environment( "i686",
option_name: str, *, platform: Optional[str] = None, default: str "pypy_x86_64",
) -> str: "aarch64",
... # noqa: E704 "ppc64le",
"s390x",
"pypy_aarch64",
@overload "pypy_i686",
def get_option_from_environment( )
option_name: str, *, platform: Optional[str] = None, default: None = None
) -> Optional[str]:
... # noqa: E704 E302
def get_option_from_environment(
option_name: str, *, platform: Optional[str] = None, default: Optional[str] = None
) -> Optional[str]: # noqa: E302
"""
Returns an option from the environment, optionally scoped by the platform.
Example:
get_option_from_environment('CIBW_COLOR', platform='macos')
This will return the value of CIBW_COLOR_MACOS if it exists, otherwise the value of
CIBW_COLOR.
"""
if platform:
option = os.environ.get(f"{option_name}_{platform.upper()}")
if option is not None:
return option
return os.environ.get(option_name, default)
def main() -> None: def main() -> None:
@@ -69,8 +48,9 @@ def main() -> None:
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Build wheels for all the platforms.", description="Build wheels for all the platforms.",
epilog=""" epilog="""
Most options are supplied via environment variables. Most options are supplied via environment variables or in
See https://github.com/pypa/cibuildwheel#options for info. --config-file (pyproject.toml usually). See
https://github.com/pypa/cibuildwheel#options for info.
""", """,
) )
@@ -104,10 +84,17 @@ def main() -> None:
parser.add_argument( parser.add_argument(
"--output-dir", "--output-dir",
default=os.environ.get("CIBW_OUTPUT_DIR", "wheelhouse"),
help="Destination folder for the wheels.", help="Destination folder for the wheels.",
) )
parser.add_argument(
"--config-file",
help="""
TOML config file for cibuildwheel. Defaults to pyproject.toml, but
can be overridden with this option.
""",
)
parser.add_argument( parser.add_argument(
"package_dir", "package_dir",
default=".", default=".",
@@ -176,53 +163,64 @@ def main() -> None:
sys.exit(2) sys.exit(2)
package_dir = Path(args.package_dir) package_dir = Path(args.package_dir)
output_dir = Path(args.output_dir)
if platform == "linux": manylinux_identifiers = {
repair_command_default = "auditwheel repair -w {dest_dir} {wheel}" f"manylinux-{build_platform}-image" for build_platform in MANYLINUX_ARCHS
elif platform == "macos": }
repair_command_default = "delocate-listdeps {wheel} && delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}" disallow = {
elif platform == "windows": "linux": {"dependency-versions"},
repair_command_default = "" "macos": manylinux_identifiers,
else: "windows": manylinux_identifiers,
assert_never(platform) }
options = ConfigOptions(package_dir, args.config_file, platform=platform, disallow=disallow)
output_dir = Path(
args.output_dir
if args.output_dir is not None
else os.environ.get("CIBW_OUTPUT_DIR", "wheelhouse")
)
build_config = options("build", env_plat=False, sep=" ") or "*"
skip_config = options("skip", env_plat=False, sep=" ")
test_skip = options("test-skip", env_plat=False, sep=" ")
archs_config_str = args.archs or options("archs", sep=" ")
build_frontend_str = options("build-frontend", env_plat=False)
environment_config = options("environment", table={"item": '{k}="{v}"', "sep": " "})
before_all = options("before-all", sep=" && ")
before_build = options("before-build", sep=" && ")
repair_command = options("repair-wheel-command", sep=" && ")
dependency_versions = options("dependency-versions")
test_command = options("test-command", sep=" && ")
before_test = options("before-test", sep=" && ")
test_requires = options("test-requires", sep=" ").split()
test_extras = options("test-extras", sep=",")
build_verbosity_str = options("build-verbosity")
build_config = os.environ.get("CIBW_BUILD") or "*"
skip_config = os.environ.get("CIBW_SKIP", "")
test_skip = os.environ.get("CIBW_TEST_SKIP", "")
environment_config = get_option_from_environment(
"CIBW_ENVIRONMENT", platform=platform, default=""
)
before_all = get_option_from_environment("CIBW_BEFORE_ALL", platform=platform, default="")
before_build = get_option_from_environment("CIBW_BEFORE_BUILD", platform=platform)
repair_command = get_option_from_environment(
"CIBW_REPAIR_WHEEL_COMMAND", platform=platform, default=repair_command_default
)
dependency_versions = get_option_from_environment(
"CIBW_DEPENDENCY_VERSIONS", platform=platform, default="pinned"
)
test_command = get_option_from_environment("CIBW_TEST_COMMAND", platform=platform)
before_test = get_option_from_environment("CIBW_BEFORE_TEST", platform=platform)
test_requires = get_option_from_environment(
"CIBW_TEST_REQUIRES", platform=platform, default=""
).split()
test_extras = get_option_from_environment("CIBW_TEST_EXTRAS", platform=platform, default="")
build_verbosity_str = get_option_from_environment(
"CIBW_BUILD_VERBOSITY", platform=platform, default=""
)
prerelease_pythons = args.prerelease_pythons or cibuildwheel.util.strtobool( prerelease_pythons = args.prerelease_pythons or cibuildwheel.util.strtobool(
os.environ.get("CIBW_PRERELEASE_PYTHONS", "0") os.environ.get("CIBW_PRERELEASE_PYTHONS", "0")
) )
build_frontend: BuildFrontend
if build_frontend_str == "build":
build_frontend = "build"
elif build_frontend_str == "pip":
build_frontend = "pip"
else:
msg = f"cibuildwheel: Unrecognised build frontend '{build_frontend}', only 'pip' and 'build' are supported"
print(msg, file=sys.stderr)
sys.exit(2)
package_files = {"setup.py", "setup.cfg", "pyproject.toml"} package_files = {"setup.py", "setup.cfg", "pyproject.toml"}
if not any(package_dir.joinpath(name).exists() for name in package_files): if not any(package_dir.joinpath(name).exists() for name in package_files):
names = ", ".join(sorted(package_files, reverse=True)) names = ", ".join(sorted(package_files, reverse=True))
print( msg = f"cibuildwheel: Could not find any of {{{names}}} at root of package"
f"cibuildwheel: Could not find any of {{{names}}} at root of package", file=sys.stderr print(msg, file=sys.stderr)
)
sys.exit(2) sys.exit(2)
# This is not supported in tool.cibuildwheel, as it comes from a standard location.
# Passing this in as an environment variable will override pyproject.toml, setup.cfg, or setup.py # Passing this in as an environment variable will override pyproject.toml, setup.cfg, or setup.py
requires_python_str: Optional[str] = os.environ.get( requires_python_str: Optional[str] = os.environ.get(
"CIBW_PROJECT_REQUIRES_PYTHON" "CIBW_PROJECT_REQUIRES_PYTHON"
@@ -270,13 +268,6 @@ def main() -> None:
# This needs to be passed on to the docker container in linux.py # This needs to be passed on to the docker container in linux.py
os.environ["CIBUILDWHEEL"] = "1" os.environ["CIBUILDWHEEL"] = "1"
if args.archs is not None:
archs_config_str = args.archs
else:
archs_config_str = get_option_from_environment(
"CIBW_ARCHS", platform=platform, default="auto"
)
archs = Architecture.parse_config(archs_config_str, platform=platform) archs = Architecture.parse_config(archs_config_str, platform=platform)
identifiers = get_build_identifiers(platform, build_selector, archs) identifiers = get_build_identifiers(platform, build_selector, archs)
@@ -286,7 +277,7 @@ def main() -> None:
print(identifier) print(identifier)
sys.exit(0) sys.exit(0)
manylinux_images: Optional[Dict[str, str]] = None manylinux_images: Dict[str, str] = {}
if platform == "linux": if platform == "linux":
pinned_docker_images_file = resources_dir / "pinned_docker_images.cfg" pinned_docker_images_file = resources_dir / "pinned_docker_images.cfg"
all_pinned_docker_images = ConfigParser() all_pinned_docker_images = ConfigParser()
@@ -297,22 +288,10 @@ def main() -> None:
# 'pypy_x86_64': {'manylinux2010': '...' } # 'pypy_x86_64': {'manylinux2010': '...' }
# ... } # ... }
manylinux_images = {} for build_platform in MANYLINUX_ARCHS:
for build_platform in [
"x86_64",
"i686",
"pypy_x86_64",
"aarch64",
"ppc64le",
"s390x",
"pypy_aarch64",
"pypy_i686",
]:
pinned_images = all_pinned_docker_images[build_platform] pinned_images = all_pinned_docker_images[build_platform]
config_name = f"CIBW_MANYLINUX_{build_platform.upper()}_IMAGE" config_value = options(f"manylinux-{build_platform}-image")
config_value = os.environ.get(config_name)
if config_value is None: if config_value is None:
# default to manylinux2010 if it's available, otherwise manylinux2014 # default to manylinux2010 if it's available, otherwise manylinux2014
@@ -340,7 +319,8 @@ def main() -> None:
repair_command=repair_command, repair_command=repair_command,
environment=environment, environment=environment,
dependency_constraints=dependency_constraints, dependency_constraints=dependency_constraints,
manylinux_images=manylinux_images, manylinux_images=manylinux_images or None,
build_frontend=build_frontend,
) )
# Python is buffering by default when running on the CI platforms, giving problems interleaving subprocess call output with unflushed calls to 'print' # Python is buffering by default when running on the CI platforms, giving problems interleaving subprocess call output with unflushed calls to 'print'
+30 -7
View File
@@ -7,7 +7,7 @@ from typing import List, NamedTuple, Set
from .architecture import Architecture from .architecture import Architecture
from .docker_container import DockerContainer from .docker_container import DockerContainer
from .logger import log from .logger import log
from .typing import PathOrStr from .typing import PathOrStr, assert_never
from .util import ( from .util import (
BuildOptions, BuildOptions,
BuildSelector, BuildSelector,
@@ -145,7 +145,7 @@ def build(options: BuildOptions) -> None:
env, executor=docker.environment_executor env, executor=docker.environment_executor
) )
# check config python and pip are still on PATH # check config python is still on PATH
which_python = docker.call( which_python = docker.call(
["which", "python"], env=env, capture_output=True ["which", "python"], env=env, capture_output=True
).strip() ).strip()
@@ -180,18 +180,38 @@ def build(options: BuildOptions) -> None:
docker.call(["rm", "-rf", built_wheel_dir]) docker.call(["rm", "-rf", built_wheel_dir])
docker.call(["mkdir", "-p", built_wheel_dir]) docker.call(["mkdir", "-p", built_wheel_dir])
verbosity_flags = get_build_verbosity_extra_flags(options.build_verbosity)
if options.build_frontend == "pip":
docker.call( docker.call(
[ [
"python",
"-m",
"pip", "pip",
"wheel", "wheel",
container_package_dir, container_package_dir,
"--wheel-dir", f"--wheel-dir={built_wheel_dir}",
built_wheel_dir,
"--no-deps", "--no-deps",
*get_build_verbosity_extra_flags(options.build_verbosity), *verbosity_flags,
], ],
env=env, env=env,
) )
elif options.build_frontend == "build":
config_setting = " ".join(verbosity_flags)
docker.call(
[
"python",
"-m",
"build",
container_package_dir,
"--wheel",
f"--outdir={built_wheel_dir}",
f"--config-setting={config_setting}",
],
env=env,
)
else:
assert_never(options.build_frontend)
built_wheel = docker.glob(built_wheel_dir, "*.whl")[0] built_wheel = docker.glob(built_wheel_dir, "*.whl")[0]
@@ -291,8 +311,11 @@ def build(options: BuildOptions) -> None:
def troubleshoot(package_dir: Path, error: Exception) -> None: def troubleshoot(package_dir: Path, error: Exception) -> None:
if isinstance(error, subprocess.CalledProcessError) and error.cmd[0:2] == ["pip", "wheel"]: if isinstance(error, subprocess.CalledProcessError) and (
# the 'pip wheel' step failed. error.cmd[0:4] == ["python", "-m", "pip", "wheel"]
or error.cmd[0:3] == ["python", "-m", "build"]
):
# the wheel build step failed
print("Checking for common errors...") print("Checking for common errors...")
so_files = list(package_dir.glob("**/*.so")) so_files = list(package_dir.glob("**/*.so"))
+54 -5
View File
@@ -12,13 +12,15 @@ from typing import Any, Dict, List, NamedTuple, Optional, Sequence, Set, Tuple,
from .architecture import Architecture from .architecture import Architecture
from .environment import ParsedEnvironment from .environment import ParsedEnvironment
from .logger import log from .logger import log
from .typing import Literal, PathOrStr from .typing import Literal, PathOrStr, assert_never
from .util import ( from .util import (
BuildFrontend,
BuildOptions, BuildOptions,
BuildSelector, BuildSelector,
NonPlatformWheelError, NonPlatformWheelError,
download, download,
get_build_verbosity_extra_flags, get_build_verbosity_extra_flags,
get_pip_version,
install_certifi_script, install_certifi_script,
prepare_command, prepare_command,
read_python_configs, read_python_configs,
@@ -178,7 +180,9 @@ def setup_python(
python_configuration: PythonConfiguration, python_configuration: PythonConfiguration,
dependency_constraint_flags: Sequence[PathOrStr], dependency_constraint_flags: Sequence[PathOrStr],
environment: ParsedEnvironment, environment: ParsedEnvironment,
build_frontend: BuildFrontend,
) -> Dict[str, str]: ) -> Dict[str, str]:
implementation_id = python_configuration.identifier.split("-")[0] implementation_id = python_configuration.identifier.split("-")[0]
log.step(f"Installing Python {implementation_id}...") log.step(f"Installing Python {implementation_id}...")
@@ -308,6 +312,7 @@ def setup_python(
env.setdefault("SDKROOT", arm64_compatible_sdks[0]) env.setdefault("SDKROOT", arm64_compatible_sdks[0])
log.step("Installing build tools...") log.step("Installing build tools...")
if build_frontend == "pip":
call( call(
[ [
"pip", "pip",
@@ -320,6 +325,20 @@ def setup_python(
], ],
env=env, env=env,
) )
elif build_frontend == "build":
call(
[
"pip",
"install",
"--upgrade",
"delocate",
"build[virtualenv]",
*dependency_constraint_flags,
],
env=env,
)
else:
assert_never(build_frontend)
return env return env
@@ -356,7 +375,12 @@ def build(options: BuildOptions) -> None:
options.dependency_constraints.get_for_python_version(config.version), options.dependency_constraints.get_for_python_version(config.version),
] ]
env = setup_python(config, dependency_constraint_flags, options.environment) env = setup_python(
config,
dependency_constraint_flags,
options.environment,
options.build_frontend,
)
if options.before_build: if options.before_build:
log.step("Running before_build...") log.step("Running before_build...")
@@ -370,20 +394,45 @@ def build(options: BuildOptions) -> None:
shutil.rmtree(built_wheel_dir) shutil.rmtree(built_wheel_dir)
built_wheel_dir.mkdir(parents=True) built_wheel_dir.mkdir(parents=True)
verbosity_flags = get_build_verbosity_extra_flags(options.build_verbosity)
if options.build_frontend == "pip":
# Path.resolve() is needed. Without it pip wheel may try to fetch package from pypi.org # Path.resolve() is needed. Without it pip wheel may try to fetch package from pypi.org
# see https://github.com/pypa/cibuildwheel/pull/369 # see https://github.com/pypa/cibuildwheel/pull/369
call( call(
[ [
"python",
"-m",
"pip", "pip",
"wheel", "wheel",
options.package_dir.resolve(), options.package_dir.resolve(),
"--wheel-dir", f"--wheel-dir={built_wheel_dir}",
built_wheel_dir,
"--no-deps", "--no-deps",
*get_build_verbosity_extra_flags(options.build_verbosity), *verbosity_flags,
], ],
env=env, env=env,
) )
elif options.build_frontend == "build":
config_setting = " ".join(verbosity_flags)
build_env = env.copy()
if options.dependency_constraints:
constr = options.dependency_constraints.get_for_python_version(config.version)
build_env["PIP_CONSTRAINT"] = constr.as_uri()
build_env["VIRTUALENV_PIP"] = get_pip_version(env)
call(
[
"python",
"-m",
"build",
options.package_dir,
"--wheel",
f"--outdir={built_wheel_dir}",
f"--config-setting={config_setting}",
],
env=build_env,
)
else:
assert_never(options.build_frontend)
built_wheel = next(built_wheel_dir.glob("*.whl")) built_wheel = next(built_wheel_dir.glob("*.whl"))
+171
View File
@@ -0,0 +1,171 @@
import os
from pathlib import Path
from typing import Any, Dict, List, Mapping, Optional, Set, Tuple, Union
import toml
from .typing import PLATFORMS, TypedDict
from .util import resources_dir
Setting = Union[Dict[str, str], List[str], str]
class TableFmt(TypedDict):
item: str
sep: str
class ConfigOptionError(KeyError):
pass
def _dig_first(*pairs: Tuple[Mapping[str, Any], str]) -> Setting:
"""
Return the first dict item that matches from pairs of dicts and keys.
Final result is will throw a KeyError if missing.
_dig_first((dict1, "key1"), (dict2, "key2"), ...)
"""
(dict_like, key), *others = pairs
return dict_like.get(key, _dig_first(*others)) if others else dict_like[key]
class ConfigOptions:
"""
Gets options from the environment, config or defaults, optionally scoped
by the platform.
Example:
>>> options = ConfigOptions(package_dir, platform='macos')
>>> options('cool-color')
This will return the value of CIBW_COOL_COLOR_MACOS if it exists,
otherwise the value of CIBW_COOL_COLOR, otherwise
'tool.cibuildwheel.macos.cool-color' or 'tool.cibuildwheel.cool-color'
from pyproject.toml, or from cibuildwheel/resources/defaults.toml. An
error is thrown if there are any unexpected keys or sections in
tool.cibuildwheel.
"""
def __init__(
self,
package_path: Path,
config_file: Optional[str] = None,
*,
platform: str,
disallow: Optional[Dict[str, Set[str]]] = None,
) -> None:
self.platform = platform
self.disallow = disallow or {}
# Open defaults.toml, loading both global and platform sections
defaults_path = resources_dir / "defaults.toml"
self.default_options, self.default_platform_options = self._load_file(defaults_path)
# load the project config file
config_options: Dict[str, Any] = {}
config_platform_options: Dict[str, Any] = {}
if config_file is not None:
config_path = Path(config_file.format(package=package_path))
config_options, config_platform_options = self._load_file(config_path)
else:
# load pyproject.toml, if it's available
pyproject_toml_path = package_path / "pyproject.toml"
if pyproject_toml_path.exists():
config_options, config_platform_options = self._load_file(pyproject_toml_path)
# validate project config
for option_name in config_options:
if not self._is_valid_global_option(option_name):
raise ConfigOptionError(f'Option "{option_name}" not supported in a config file')
for option_name in config_platform_options:
if not self._is_valid_platform_option(option_name):
raise ConfigOptionError(
f'Option "{option_name}" not supported in the "{self.platform}" section'
)
self.config_options = config_options
self.config_platform_options = config_platform_options
def _is_valid_global_option(self, name: str) -> bool:
"""
Returns True if an option with this name is allowed in the
[tool.cibuildwheel] section of a config file.
"""
allowed_option_names = self.default_options.keys() | PLATFORMS
return name in allowed_option_names
def _is_valid_platform_option(self, name: str) -> bool:
"""
Returns True if an option with this name is allowed in the
[tool.cibuildwheel.<current-platform>] section of a config file.
"""
disallowed_platform_options = self.disallow.get(self.platform, set())
if name in disallowed_platform_options:
return False
allowed_option_names = self.default_options.keys() | self.default_platform_options.keys()
return name in allowed_option_names
def _load_file(self, filename: Path) -> Tuple[Dict[str, Any], Dict[str, Any]]:
"""
Load a toml file, returns global and platform as separate dicts.
"""
config = toml.load(filename)
global_options = config.get("tool", {}).get("cibuildwheel", {})
platform_options = global_options.get(self.platform, {})
return global_options, platform_options
def __call__(
self,
name: str,
*,
env_plat: bool = True,
sep: Optional[str] = None,
table: Optional[TableFmt] = None,
) -> str:
"""
Get and return the value for the named option from environment,
configuration file, or the default. If env_plat is False, then don't
accept platform versions of the environment variable. If this is an
array it will be merged with "sep" before returning. If it is a table,
it will be formatted with "table['item']" using {k} and {v} and merged
with "table['sep']".
"""
if name not in self.default_options and name not in self.default_platform_options:
raise ConfigOptionError(f"{name} must be in cibuildwheel/resources/defaults.toml file")
# Environment variable form
envvar = f"CIBW_{name.upper().replace('-', '_')}"
plat_envvar = f"{envvar}_{self.platform.upper()}"
# get the option from the environment, then the config file, then finally the default.
# platform-specific options are preferred, if they're allowed.
result = _dig_first(
(os.environ if env_plat else {}, plat_envvar), # type: ignore
(os.environ, envvar),
(self.config_platform_options, name),
(self.config_options, name),
(self.default_platform_options, name),
(self.default_options, name),
)
if isinstance(result, dict):
if table is None:
raise ConfigOptionError(f"{name} does not accept a table")
return table["sep"].join(table["item"].format(k=k, v=v) for k, v in result.items())
elif isinstance(result, list):
if sep is None:
raise ConfigOptionError(f"{name} does not accept a list")
return sep.join(result)
elif isinstance(result, int):
return str(result)
else:
return result
+10 -10
View File
@@ -37,12 +37,12 @@ python_configurations = [
{ identifier = "cp38-macosx_x86_64", version = "3.8", url = "https://www.python.org/ftp/python/3.8.10/python-3.8.10-macosx10.9.pkg" }, { identifier = "cp38-macosx_x86_64", version = "3.8", url = "https://www.python.org/ftp/python/3.8.10/python-3.8.10-macosx10.9.pkg" },
{ identifier = "cp38-macosx_arm64", version = "3.8", url = "https://www.python.org/ftp/python/3.8.10/python-3.8.10-macosx10.9.pkg" }, { identifier = "cp38-macosx_arm64", version = "3.8", url = "https://www.python.org/ftp/python/3.8.10/python-3.8.10-macosx10.9.pkg" },
{ identifier = "cp38-macosx_universal2", version = "3.8", url = "https://www.python.org/ftp/python/3.8.10/python-3.8.10-macosx10.9.pkg" }, { identifier = "cp38-macosx_universal2", version = "3.8", url = "https://www.python.org/ftp/python/3.8.10/python-3.8.10-macosx10.9.pkg" },
{ identifier = "cp39-macosx_x86_64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.5/python-3.9.5-macos11.pkg" }, { identifier = "cp39-macosx_x86_64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.6/python-3.9.6-macos11.pkg" },
{ identifier = "cp39-macosx_arm64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.5/python-3.9.5-macos11.pkg" }, { identifier = "cp39-macosx_arm64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.6/python-3.9.6-macos11.pkg" },
{ identifier = "cp39-macosx_universal2", version = "3.9", url = "https://www.python.org/ftp/python/3.9.5/python-3.9.5-macos11.pkg" }, { identifier = "cp39-macosx_universal2", version = "3.9", url = "https://www.python.org/ftp/python/3.9.6/python-3.9.6-macos11.pkg" },
{ identifier = "cp310-macosx_x86_64", version = "3.10", url = "https://www.python.org/ftp/python/3.10.0/python-3.10.0b1-macos11.pkg" }, { identifier = "cp310-macosx_x86_64", version = "3.10", url = "https://www.python.org/ftp/python/3.10.0/python-3.10.0b3-macos11.pkg" },
{ identifier = "cp310-macosx_arm64", version = "3.10", url = "https://www.python.org/ftp/python/3.10.0/python-3.10.0b1-macos11.pkg" }, { identifier = "cp310-macosx_arm64", version = "3.10", url = "https://www.python.org/ftp/python/3.10.0/python-3.10.0b3-macos11.pkg" },
{ identifier = "cp310-macosx_universal2", version = "3.10", url = "https://www.python.org/ftp/python/3.10.0/python-3.10.0b1-macos11.pkg" }, { identifier = "cp310-macosx_universal2", version = "3.10", url = "https://www.python.org/ftp/python/3.10.0/python-3.10.0b3-macos11.pkg" },
{ identifier = "pp37-macosx_x86_64", version = "3.7", url = "https://downloads.python.org/pypy/pypy3.7-v7.3.5-osx64.tar.bz2" }, { identifier = "pp37-macosx_x86_64", version = "3.7", url = "https://downloads.python.org/pypy/pypy3.7-v7.3.5-osx64.tar.bz2" },
] ]
@@ -54,9 +54,9 @@ python_configurations = [
{ identifier = "cp37-win_amd64", version = "3.7.9", arch = "64" }, { identifier = "cp37-win_amd64", version = "3.7.9", arch = "64" },
{ identifier = "cp38-win32", version = "3.8.10", arch = "32" }, { identifier = "cp38-win32", version = "3.8.10", arch = "32" },
{ identifier = "cp38-win_amd64", version = "3.8.10", arch = "64" }, { identifier = "cp38-win_amd64", version = "3.8.10", arch = "64" },
{ identifier = "cp39-win32", version = "3.9.5", arch = "32" }, { identifier = "cp39-win32", version = "3.9.6", arch = "32" },
{ identifier = "cp39-win_amd64", version = "3.9.5", arch = "64" }, { identifier = "cp39-win_amd64", version = "3.9.6", arch = "64" },
{ identifier = "cp310-win32", version = "3.10.0-b1", arch = "32" }, { identifier = "cp310-win32", version = "3.10.0-b3", arch = "32" },
{ identifier = "cp310-win_amd64", version = "3.10.0-b1", arch = "64" }, { identifier = "cp310-win_amd64", version = "3.10.0-b3", arch = "64" },
{ identifier = "pp37-win_amd64", version = "3.7", arch = "64", url = "https://downloads.python.org/pypy/pypy3.7-v7.3.5-win64.zip" }, { identifier = "pp37-win_amd64", version = "3.7", arch = "64", url = "https://downloads.python.org/pypy/pypy3.7-v7.3.5-win64.zip" },
] ]
@@ -1,5 +1,5 @@
# #
# This file is autogenerated by pip-compile # This file is autogenerated by pip-compile with python 3.6
# To update, run: # To update, run:
# #
# bin/update_dependencies.py # bin/update_dependencies.py
@@ -8,31 +8,31 @@ appdirs==1.4.4
# via virtualenv # via virtualenv
delocate==0.8.2 delocate==0.8.2
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
distlib==0.3.1 distlib==0.3.2
# via virtualenv # via virtualenv
filelock==3.0.12 filelock==3.0.12
# via virtualenv # via virtualenv
importlib-metadata==4.0.1 importlib-metadata==4.6.1
# via virtualenv # via virtualenv
importlib-resources==5.1.3 importlib-resources==5.2.0
# via virtualenv # via virtualenv
six==1.16.0 six==1.16.0
# via virtualenv # via virtualenv
typing-extensions==3.10.0.0 typing-extensions==3.10.0.0
# via importlib-metadata # via importlib-metadata
virtualenv==20.4.6 virtualenv==20.4.7
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
wheel==0.36.2 wheel==0.36.2
# via # via
# -r cibuildwheel/resources/constraints.in # -r cibuildwheel/resources/constraints.in
# delocate # delocate
zipp==3.4.1 zipp==3.5.0
# via # via
# importlib-metadata # importlib-metadata
# importlib-resources # importlib-resources
# The following packages are considered to be unsafe in a requirements file: # The following packages are considered to be unsafe in a requirements file:
pip==21.1.1 pip==21.1.3
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
setuptools==56.2.0 setuptools==57.1.0
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
@@ -1,5 +1,5 @@
# #
# This file is autogenerated by pip-compile # This file is autogenerated by pip-compile with python 3.7
# To update, run: # To update, run:
# #
# bin/update_dependencies.py # bin/update_dependencies.py
@@ -8,27 +8,27 @@ appdirs==1.4.4
# via virtualenv # via virtualenv
delocate==0.8.2 delocate==0.8.2
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
distlib==0.3.1 distlib==0.3.2
# via virtualenv # via virtualenv
filelock==3.0.12 filelock==3.0.12
# via virtualenv # via virtualenv
importlib-metadata==4.0.1 importlib-metadata==4.6.1
# via virtualenv # via virtualenv
six==1.16.0 six==1.16.0
# via virtualenv # via virtualenv
typing-extensions==3.10.0.0 typing-extensions==3.10.0.0
# via importlib-metadata # via importlib-metadata
virtualenv==20.4.6 virtualenv==20.4.7
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
wheel==0.36.2 wheel==0.36.2
# via # via
# -r cibuildwheel/resources/constraints.in # -r cibuildwheel/resources/constraints.in
# delocate # delocate
zipp==3.4.1 zipp==3.5.0
# via importlib-metadata # via importlib-metadata
# The following packages are considered to be unsafe in a requirements file: # The following packages are considered to be unsafe in a requirements file:
pip==21.1.1 pip==21.1.3
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
setuptools==56.2.0 setuptools==57.1.0
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
@@ -1,5 +1,5 @@
# #
# This file is autogenerated by pip-compile # This file is autogenerated by pip-compile with python 3.8
# To update, run: # To update, run:
# #
# bin/update_dependencies.py # bin/update_dependencies.py
@@ -8,13 +8,13 @@ appdirs==1.4.4
# via virtualenv # via virtualenv
delocate==0.8.2 delocate==0.8.2
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
distlib==0.3.1 distlib==0.3.2
# via virtualenv # via virtualenv
filelock==3.0.12 filelock==3.0.12
# via virtualenv # via virtualenv
six==1.16.0 six==1.16.0
# via virtualenv # via virtualenv
virtualenv==20.4.6 virtualenv==20.4.7
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
wheel==0.36.2 wheel==0.36.2
# via # via
@@ -22,7 +22,7 @@ wheel==0.36.2
# delocate # delocate
# The following packages are considered to be unsafe in a requirements file: # The following packages are considered to be unsafe in a requirements file:
pip==21.1.1 pip==21.1.3
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
setuptools==56.2.0 setuptools==57.1.0
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
@@ -1,5 +1,5 @@
# #
# This file is autogenerated by pip-compile # This file is autogenerated by pip-compile with python 3.9
# To update, run: # To update, run:
# #
# bin/update_dependencies.py # bin/update_dependencies.py
@@ -8,13 +8,13 @@ appdirs==1.4.4
# via virtualenv # via virtualenv
delocate==0.8.2 delocate==0.8.2
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
distlib==0.3.1 distlib==0.3.2
# via virtualenv # via virtualenv
filelock==3.0.12 filelock==3.0.12
# via virtualenv # via virtualenv
six==1.16.0 six==1.16.0
# via virtualenv # via virtualenv
virtualenv==20.4.6 virtualenv==20.4.7
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
wheel==0.36.2 wheel==0.36.2
# via # via
@@ -22,7 +22,7 @@ wheel==0.36.2
# delocate # delocate
# The following packages are considered to be unsafe in a requirements file: # The following packages are considered to be unsafe in a requirements file:
pip==21.1.1 pip==21.1.3
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
setuptools==56.2.0 setuptools==57.1.0
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
+5 -5
View File
@@ -1,5 +1,5 @@
# #
# This file is autogenerated by pip-compile # This file is autogenerated by pip-compile with python 3.9
# To update, run: # To update, run:
# #
# bin/update_dependencies.py # bin/update_dependencies.py
@@ -8,13 +8,13 @@ appdirs==1.4.4
# via virtualenv # via virtualenv
delocate==0.8.2 delocate==0.8.2
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
distlib==0.3.1 distlib==0.3.2
# via virtualenv # via virtualenv
filelock==3.0.12 filelock==3.0.12
# via virtualenv # via virtualenv
six==1.16.0 six==1.16.0
# via virtualenv # via virtualenv
virtualenv==20.4.6 virtualenv==20.4.7
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
wheel==0.36.2 wheel==0.36.2
# via # via
@@ -22,7 +22,7 @@ wheel==0.36.2
# delocate # delocate
# The following packages are considered to be unsafe in a requirements file: # The following packages are considered to be unsafe in a requirements file:
pip==21.1.1 pip==21.1.3
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
setuptools==56.2.0 setuptools==57.1.0
# via -r cibuildwheel/resources/constraints.in # via -r cibuildwheel/resources/constraints.in
+40
View File
@@ -0,0 +1,40 @@
[tool.cibuildwheel]
build = "*"
skip = ""
test-skip = ""
archs = ["auto"]
build-frontend = "pip"
dependency-versions = "pinned"
environment = {}
build-verbosity = ""
before-all = ""
before-build = ""
repair-wheel-command = ""
test-command = ""
before-test = ""
test-requires = []
test-extras = []
manylinux-x86_64-image = "manylinux2010"
manylinux-i686-image = "manylinux2010"
manylinux-aarch64-image = "manylinux2014"
manylinux-ppc64le-image = "manylinux2014"
manylinux-s390x-image = "manylinux2014"
manylinux-pypy_x86_64-image = "manylinux2010"
manylinux-pypy_i686-image = "manylinux2010"
manylinux-pypy_aarch64-image = "manylinux2014"
[tool.cibuildwheel.linux]
repair-wheel-command = "auditwheel repair -w {dest_dir} {wheel}"
[tool.cibuildwheel.macos]
repair-wheel-command = [
"delocate-listdeps {wheel}",
"delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}",
]
[tool.cibuildwheel.windows]
+22 -22
View File
@@ -1,38 +1,38 @@
[x86_64] [x86_64]
manylinux1 = quay.io/pypa/manylinux1_x86_64:2021-05-24-df68af6 manylinux1 = quay.io/pypa/manylinux1_x86_64:2021-07-04-13bcf48
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2021-05-24-84874a2 manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2021-07-04-1e3ce39
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2021-05-24-84874a2 manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2021-07-04-1e3ce39
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2021-05-24-84874a2 manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2021-07-04-1e3ce39
[i686] [i686]
manylinux1 = quay.io/pypa/manylinux1_i686:2021-05-24-df68af6 manylinux1 = quay.io/pypa/manylinux1_i686:2021-07-04-13bcf48
manylinux2010 = quay.io/pypa/manylinux2010_i686:2021-05-24-84874a2 manylinux2010 = quay.io/pypa/manylinux2010_i686:2021-07-04-1e3ce39
manylinux2014 = quay.io/pypa/manylinux2014_i686:2021-05-24-84874a2 manylinux2014 = quay.io/pypa/manylinux2014_i686:2021-07-04-1e3ce39
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2021-05-24-84874a2 manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2021-07-04-1e3ce39
[pypy_x86_64] [pypy_x86_64]
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2021-05-24-84874a2 manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2021-07-04-1e3ce39
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2021-05-24-84874a2 manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2021-07-04-1e3ce39
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2021-05-24-84874a2 manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2021-07-04-1e3ce39
[pypy_i686] [pypy_i686]
manylinux2010 = quay.io/pypa/manylinux2010_i686:2021-05-24-84874a2 manylinux2010 = quay.io/pypa/manylinux2010_i686:2021-07-04-1e3ce39
manylinux2014 = quay.io/pypa/manylinux2014_i686:2021-05-24-84874a2 manylinux2014 = quay.io/pypa/manylinux2014_i686:2021-07-04-1e3ce39
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2021-05-24-84874a2 manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2021-07-04-1e3ce39
[aarch64] [aarch64]
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2021-05-24-84874a2 manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2021-07-04-1e3ce39
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2021-05-24-84874a2 manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2021-07-04-1e3ce39
[ppc64le] [ppc64le]
manylinux2014 = quay.io/pypa/manylinux2014_ppc64le:2021-05-24-84874a2 manylinux2014 = quay.io/pypa/manylinux2014_ppc64le:2021-07-04-1e3ce39
manylinux_2_24 = quay.io/pypa/manylinux_2_24_ppc64le:2021-05-24-84874a2 manylinux_2_24 = quay.io/pypa/manylinux_2_24_ppc64le:2021-07-04-1e3ce39
[s390x] [s390x]
manylinux2014 = quay.io/pypa/manylinux2014_s390x:2021-05-24-84874a2 manylinux2014 = quay.io/pypa/manylinux2014_s390x:2021-07-04-1e3ce39
manylinux_2_24 = quay.io/pypa/manylinux_2_24_s390x:2021-05-24-84874a2 manylinux_2_24 = quay.io/pypa/manylinux_2_24_s390x:2021-07-04-1e3ce39
[pypy_aarch64] [pypy_aarch64]
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2021-05-24-84874a2 manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2021-07-04-1e3ce39
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2021-05-24-84874a2 manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2021-07-04-1e3ce39
+21 -1
View File
@@ -4,6 +4,8 @@ import itertools
import os import os
import re import re
import ssl import ssl
import subprocess
import sys
import textwrap import textwrap
import time import time
import urllib.request import urllib.request
@@ -20,12 +22,14 @@ from packaging.version import Version
from .architecture import Architecture from .architecture import Architecture
from .environment import ParsedEnvironment from .environment import ParsedEnvironment
from .typing import PathOrStr, PlatformName from .typing import Literal, PathOrStr, PlatformName
resources_dir = Path(__file__).parent / "resources" resources_dir = Path(__file__).parent / "resources"
install_certifi_script = resources_dir / "install_certifi.py" install_certifi_script = resources_dir / "install_certifi.py"
BuildFrontend = Literal["pip", "build"]
def prepare_command(command: str, **kwargs: PathOrStr) -> str: def prepare_command(command: str, **kwargs: PathOrStr) -> str:
""" """
@@ -218,6 +222,7 @@ class BuildOptions(NamedTuple):
test_requires: List[str] test_requires: List[str]
test_extras: str test_extras: str
build_verbosity: int build_verbosity: int
build_frontend: BuildFrontend
class NonPlatformWheelError(Exception): class NonPlatformWheelError(Exception):
@@ -300,3 +305,18 @@ def print_new_wheels(msg: str, output_dir: Path) -> Iterator[None]:
s = time.time() - start_time s = time.time() - start_time
m = s / 60 m = s / 60
print(msg.format(n=n, s=s, m=m), *sorted(f" {f.name}" for f in new_contents), sep="\n") print(msg.format(n=n, s=s, m=m), *sorted(f" {f.name}" for f in new_contents), sep="\n")
def get_pip_version(env: Dict[str, str]) -> str:
# we use shell=True here for windows, even though we don't need a shell due to a bug
# https://bugs.python.org/issue8557
shell = sys.platform.startswith("win")
versions_output_text = subprocess.check_output(
["python", "-m", "pip", "freeze", "--all"], universal_newlines=True, shell=shell, env=env
)
(pip_version,) = (
version[5:]
for version in versions_output_text.strip().splitlines()
if version.startswith("pip==")
)
return pip_version
+82 -13
View File
@@ -10,20 +10,24 @@ from zipfile import ZipFile
from .architecture import Architecture from .architecture import Architecture
from .environment import ParsedEnvironment from .environment import ParsedEnvironment
from .logger import log from .logger import log
from .typing import PathOrStr from .typing import PathOrStr, assert_never
from .util import ( from .util import (
BuildFrontend,
BuildOptions, BuildOptions,
BuildSelector, BuildSelector,
NonPlatformWheelError, NonPlatformWheelError,
download, download,
get_build_verbosity_extra_flags, get_build_verbosity_extra_flags,
get_pip_version,
prepare_command, prepare_command,
read_python_configs, read_python_configs,
) )
CIBW_INSTALL_PATH = Path("C:\\cibw")
def call( def call(
args: Sequence[PathOrStr], env: Optional[Dict[str, str]] = None, cwd: Optional[str] = None args: Sequence[PathOrStr], env: Optional[Dict[str, str]] = None, cwd: Optional[PathOrStr] = None
) -> None: ) -> None:
print("+ " + " ".join(str(a) for a in args)) print("+ " + " ".join(str(a) for a in args))
# we use shell=True here, even though we don't need a shell due to a bug # we use shell=True here, even though we don't need a shell due to a bug
@@ -31,7 +35,9 @@ def call(
subprocess.run([str(a) for a in args], env=env, cwd=cwd, shell=True, check=True) subprocess.run([str(a) for a in args], env=env, cwd=cwd, shell=True, check=True)
def shell(command: str, env: Optional[Dict[str, str]] = None, cwd: Optional[str] = None) -> None: def shell(
command: str, env: Optional[Dict[str, str]] = None, cwd: Optional[PathOrStr] = None
) -> None:
print(f"+ {command}") print(f"+ {command}")
subprocess.run(command, env=env, cwd=cwd, shell=True, check=True) subprocess.run(command, env=env, cwd=cwd, shell=True, check=True)
@@ -47,7 +53,7 @@ def get_nuget_args(version: str, arch: str) -> List[str]:
"-FallbackSource", "-FallbackSource",
"https://api.nuget.org/v3/index.json", "https://api.nuget.org/v3/index.json",
"-OutputDirectory", "-OutputDirectory",
"C:\\cibw\\python", str(CIBW_INSTALL_PATH / "python"),
] ]
@@ -100,9 +106,9 @@ def install_pypy(version: str, arch: str, url: str) -> Path:
zip_filename = url.rsplit("/", 1)[-1] zip_filename = url.rsplit("/", 1)[-1]
extension = ".zip" extension = ".zip"
assert zip_filename.endswith(extension) assert zip_filename.endswith(extension)
installation_path = Path("C:\\cibw") / zip_filename[: -len(extension)] installation_path = CIBW_INSTALL_PATH / zip_filename[: -len(extension)]
if not installation_path.exists(): if not installation_path.exists():
pypy_zip = Path("C:\\cibw") / zip_filename pypy_zip = CIBW_INSTALL_PATH / zip_filename
download(url, pypy_zip) download(url, pypy_zip)
# Extract to the parent directory because the zip file still contains a directory # Extract to the parent directory because the zip file still contains a directory
extract_zip(pypy_zip, installation_path.parent) extract_zip(pypy_zip, installation_path.parent)
@@ -114,8 +120,10 @@ def setup_python(
python_configuration: PythonConfiguration, python_configuration: PythonConfiguration,
dependency_constraint_flags: Sequence[PathOrStr], dependency_constraint_flags: Sequence[PathOrStr],
environment: ParsedEnvironment, environment: ParsedEnvironment,
build_frontend: BuildFrontend,
) -> Dict[str, str]: ) -> Dict[str, str]:
nuget = Path("C:\\cibw\\nuget.exe")
nuget = CIBW_INSTALL_PATH / "nuget.exe"
if not nuget.exists(): if not nuget.exists():
log.step("Downloading nuget...") log.step("Downloading nuget...")
download("https://dist.nuget.org/win-x86-commandline/latest/nuget.exe", nuget) download("https://dist.nuget.org/win-x86-commandline/latest/nuget.exe", nuget)
@@ -180,7 +188,7 @@ def setup_python(
requires_reinstall = not (installation_path / "Scripts" / "pip.exe").exists() requires_reinstall = not (installation_path / "Scripts" / "pip.exe").exists()
if requires_reinstall: if requires_reinstall:
# maybe pip isn't installed at all. ensurepip resolves that. # maybe pip isn't installed at all. ensurepip resolves that.
call(["python", "-m", "ensurepip"], env=env, cwd="C:\\cibw") call(["python", "-m", "ensurepip"], env=env, cwd=CIBW_INSTALL_PATH)
# upgrade pip to the version matching our constraints # upgrade pip to the version matching our constraints
# if necessary, reinstall it to ensure that it's available on PATH as 'pip.exe' # if necessary, reinstall it to ensure that it's available on PATH as 'pip.exe'
@@ -195,7 +203,7 @@ def setup_python(
*dependency_constraint_flags, *dependency_constraint_flags,
], ],
env=env, env=env,
cwd="C:\\cibw", cwd=CIBW_INSTALL_PATH,
) )
assert (installation_path / "Scripts" / "pip.exe").exists() assert (installation_path / "Scripts" / "pip.exe").exists()
@@ -214,10 +222,26 @@ def setup_python(
sys.exit(1) sys.exit(1)
call(["pip", "--version"], env=env) call(["pip", "--version"], env=env)
if build_frontend == "pip":
call( call(
["pip", "install", "--upgrade", "setuptools", "wheel", *dependency_constraint_flags], [
"pip",
"install",
"--upgrade",
"setuptools",
"wheel",
*dependency_constraint_flags,
],
env=env, env=env,
) )
elif build_frontend == "build":
call(
["pip", "install", "--upgrade", "build[virtualenv]", *dependency_constraint_flags],
env=env,
)
else:
assert_never(build_frontend)
return env return env
@@ -251,7 +275,12 @@ def build(options: BuildOptions) -> None:
] ]
# install Python # install Python
env = setup_python(config, dependency_constraint_flags, options.environment) env = setup_python(
config,
dependency_constraint_flags,
options.environment,
options.build_frontend,
)
# run the before_build command # run the before_build command
if options.before_build: if options.before_build:
@@ -265,20 +294,60 @@ def build(options: BuildOptions) -> None:
if built_wheel_dir.exists(): if built_wheel_dir.exists():
shutil.rmtree(built_wheel_dir) shutil.rmtree(built_wheel_dir)
built_wheel_dir.mkdir(parents=True) built_wheel_dir.mkdir(parents=True)
verbosity_flags = get_build_verbosity_extra_flags(options.build_verbosity)
if options.build_frontend == "pip":
# Path.resolve() is needed. Without it pip wheel may try to fetch package from pypi.org # Path.resolve() is needed. Without it pip wheel may try to fetch package from pypi.org
# see https://github.com/pypa/cibuildwheel/pull/369 # see https://github.com/pypa/cibuildwheel/pull/369
call( call(
[ [
"python",
"-m",
"pip", "pip",
"wheel", "wheel",
options.package_dir.resolve(), options.package_dir.resolve(),
"-w", f"--wheel-dir={built_wheel_dir}",
built_wheel_dir,
"--no-deps", "--no-deps",
*get_build_verbosity_extra_flags(options.build_verbosity), *get_build_verbosity_extra_flags(options.build_verbosity),
], ],
env=env, env=env,
) )
elif options.build_frontend == "build":
config_setting = " ".join(verbosity_flags)
build_env = env.copy()
if options.dependency_constraints:
constraints_path = options.dependency_constraints.get_for_python_version(
config.version
)
# Bug in pip <= 21.1.3 - we can't have a space in the
# constraints file, and pip doesn't support drive letters
# in uhi. After probably pip 21.2, we can use uri. For
# now, use a temporary file.
if " " in str(constraints_path):
tmp_file = tempfile.NamedTemporaryFile(
"w", suffix="constraints.txt", delete=False, dir=CIBW_INSTALL_PATH
)
with tmp_file as new_constraints_file, open(constraints_path) as f:
new_constraints_file.write(f.read())
constraints_path = Path(new_constraints_file.name)
build_env["PIP_CONSTRAINT"] = str(constraints_path)
build_env["VIRTUALENV_PIP"] = get_pip_version(env)
call(
[
"python",
"-m",
"build",
options.package_dir,
"--wheel",
f"--outdir={built_wheel_dir}",
f"--config-setting={config_setting}",
],
env=build_env,
)
else:
assert_never(options.build_frontend)
built_wheel = next(built_wheel_dir.glob("*.whl")) built_wheel = next(built_wheel_dir.glob("*.whl"))
+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" role="img" viewBox="0 0 24 24" width="16px" fill="#606060"><title>Azure Pipelines icon</title><path d="M1.8 18H0v6h6v-1.8H1.8zM23 0h-8.93a2 2 0 0 0-1.67.89L9 5.99H1a1 1 0 0 0-1 1v5.5l3.5 3.61 1.2-1.29 1.5 1.5L5 17.53l1.48 1.48 1.22-1.22 1.5 1.51L8 20.5l3.5 3.5H17a1 1 0 0 0 1-1v-8l5.11-3.4A2 2 0 0 0 24 9.92V1a1 1 0 0 0-1-1zm-5 9a3 3 0 1 1 0-6 3 3 0 0 1 0 6z"/></svg> <svg xmlns="http://www.w3.org/2000/svg" role="img" viewBox="0 0 24 24" width="16px" fill="#606060"><title>Azure Pipelines icon</title><path d="M1.7997 22.1998h4.2001V24H.0004v-6.0002h1.7993v4.2zM12.6229 9.8975l-7.6353 7.6353 1.4792 1.4792 7.6345-7.6362-1.4784-1.4783zM4.365 15.1793l-.391-.3908c-.5042-.5042-.5828-1.3004-.1869-1.8934l4.6036-6.8958H.9979c-.5513.0014-.9975.4487-.9975 1v5.5002l3.5021 3.6036.8625-.9238zM23.9996.9999v8.9306a2 2 0 0 1-.8893 1.6632l-12.2834 8.2005a.9999.9999 0 0 1-1.2622-.1246L8.04 18.1457c.3313-.3313 6.4656-6.4672 6.7684-6.7698l-2.1855-2.1855L5.8533 15.96l-1.5258-1.525a1.0001 1.0001 0 0 1-.1246-1.2623L12.4034.8893A2 2 0 0 1 14.0666 0h8.9331c.5522 0 .9999.4477.9999.9999zm-2.9997 5.0003c0-1.6567-1.343-2.9997-2.9997-2.9997s-2.9997 1.343-2.9997 2.9997 1.343 2.9997 2.9997 2.9997 2.9997-1.343 2.9997-2.9997zM10.272 20.4625c-.4008 0-.7776-.156-1.0609-.4392l-.368-.3679-.8435.8417 3.4996 3.4996h5.5003c.5522 0 .9999-.4477.9999-.9999v-7.3899L11.1045 20.21a1.4944 1.4944 0 0 1-.8325.2525z"/></svg>

Before

Width:  |  Height:  |  Size: 407 B

After

Width:  |  Height:  |  Size: 1023 B

+71 -6
View File
@@ -1,6 +1,10 @@
/* Global styles */ /* Global styles */
body {
overflow-wrap: break-word;
}
p { p {
margin-bottom: 12px; margin-bottom: 12px;
line-height: 26px; line-height: 26px;
@@ -20,7 +24,7 @@ code, pre, tt {
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace; font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
} }
.hljs { pre code, pre code.hljs {
padding: 1em; padding: 1em;
background-color: #f6f8fa; background-color: #f6f8fa;
} }
@@ -112,7 +116,21 @@ h1, h2, h3, h4, h5, h6 {
background-color: white; background-color: white;
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
border-bottom: 2px solid #ccc; overflow-x: auto;
overflow-y: hidden;
position: relative;
}
.tabs-header::before {
position: absolute;
content: "";
bottom: 0;
left: 0;
right: 0;
height: 2px;
background: #ccc;
}
.tabs-header > * {
position: relative;
} }
/* Style the buttons that are used to open the tab content */ /* Style the buttons that are used to open the tab content */
@@ -126,15 +144,13 @@ h1, h2, h3, h4, h5, h6 {
font-size: 0.9em; font-size: 0.9em;
font-weight: 600; font-weight: 600;
padding: 8px 16px; padding: 8px 16px;
border-bottom: 2px solid transparent; border-bottom: 2px solid #ccc;
/* put the border on top of the parent border */
margin-bottom: -2px;
} }
.tabs-header button:focus-visible { .tabs-header button:focus-visible {
/* preserve an outline for accesibility purposes */ /* preserve an outline for accesibility purposes */
outline: 1px solid currentColor; outline: 1px solid currentColor;
outline-offset: -1px;
} }
/* Change background color of buttons on hover */ /* Change background color of buttons on hover */
@@ -153,4 +169,53 @@ h1, h2, h3, h4, h5, h6 {
background-color: #f1f6fa; background-color: #f1f6fa;
padding: 1px 1em; padding: 1px 1em;
padding-top: 0.8em; padding-top: 0.8em;
/* don't collapse inner margins */
overflow-y: hidden;
}
/* Examples tabs styling */
.tabs.examples .tabs-header {
justify-content: flex-end;
background-color: transparent;
border-bottom-style: none;
padding: 0;
}
.tabs.examples .tabs-header::before {
height: 0;
}
.tabs.examples .tabs-header button {
padding: 6px 12px;
border-bottom: none;
color: rgba(0, 0, 0, 0.3);
font-size: 0.8em;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.tabs-header button:hover {
background-color: unset;
}
.tabs.examples .tabs-header button.active {
border-bottom-style: none;
background: #f6f8fa;
color: inherit;
}
.tabs.examples .tabs-content {
padding: 0;
background-color: transparent;
background-color: #f6f8fa;
}
.tabs.examples .tabs-content .tab > * {
padding-left: 0.8em;
padding-right: 0.8em;
}
.tabs.examples .tabs-content .tab > pre {
padding-left: 0;
padding-right: 0;
margin-bottom: 0.5em;
}
.tabs.examples pre:first-child {
margin-top: 0;
} }
+11
View File
@@ -20,6 +20,17 @@ while (true) {
tabContainer.insertBefore(firstTab); tabContainer.insertBefore(firstTab);
tabContainer.append(headerContainer, contentContainer) tabContainer.append(headerContainer, contentContainer)
// add extra classes from the first tab to the container
const classes = Array.from(firstTab[0].classList)
for (let i = 0; i < classes.length; i++) {
const element = classes[i];
if (element == 'tab' || element == 'admonition') {
continue
}
tabContainer.addClass(element)
}
const selectTab = function (index) { const selectTab = function (index) {
headerContainer.children().removeClass('active') headerContainer.children().removeClass('active')
headerContainer.children().eq(index).addClass('active') headerContainer.children().eq(index).addClass('active')
+5 -5
View File
@@ -84,7 +84,7 @@ by default, and require opt-in by setting `CIBW_ARCHS_MACOS`.
!!! note !!! note
Your runner needs Xcode Command Line Tools 12.2 or later to build `universal2` or `arm64`. Your runner needs Xcode Command Line Tools 12.2 or later to build `universal2` or `arm64`.
So far, only CPython 3.9 supports `universal2` and `arm64` wheels. Only CPython 3.8 and newer support `universal2` and `arm64` wheels.
Here's an example GitHub Actions workflow with a job that builds for Apple Silicon: Here's an example GitHub Actions workflow with a job that builds for Apple Silicon:
@@ -210,12 +210,12 @@ There are two suggested methods for keeping cibuildwheel up to date that instead
If you use GitHub Actions for builds, you can use cibuildwheel as an action: If you use GitHub Actions for builds, you can use cibuildwheel as an action:
```yaml ```yaml
uses: pypa/cibuildwheel@v2.0.0a1 uses: pypa/cibuildwheel@v2.0.0b2
``` ```
This is a composite step that just runs cibuildwheel using pipx. You can set command-line options as `with:` parameters, and use `env:` as normal. This is a composite step that just runs cibuildwheel using pipx. You can set command-line options as `with:` parameters, and use `env:` as normal.
Then, your `dependabot.yml` file could look like this: Then, your `.github/dependabot.yml` file could look like this:
```yaml ```yaml
version: 2 version: 2
@@ -236,10 +236,10 @@ The second option, and the only one that supports other CI systems, is using a `
```bash ```bash
# requirements-cibw.txt # requirements-cibw.txt
cibuildwheel==2.0.0a1 cibuildwheel==2.0.0b2
``` ```
Then your install step would have `python -m pip install -r requirements-cibw.txt` in it. Your `dependabot.yml` file could look like this: Then your install step would have `python -m pip install -r requirements-cibw.txt` in it. Your `.github/dependabot.yml` file could look like this:
```yaml ```yaml
version: 2 version: 2
+13
View File
@@ -0,0 +1,13 @@
import subprocess
from typing import Any
# Requires Python 3.7+
def define_env(env: Any) -> None:
"Hook function for mkdocs-macros"
@env.macro
def subprocess_run(*args: str) -> str:
"Run a subprocess and return the stdout"
return subprocess.run(args, check=True, capture_output=True, text=True).stdout
+483 -105
View File
@@ -1,15 +1,12 @@
## Options summary
<div class="options-toc"></div>
## Setting options ## Setting options
cibuildwheel is configured using environment variables that can be set using cibuildwheel can either be configured using environment variables, or from
your CI config. config file such as `pyproject.toml`.
For example, to configure cibuildwheel to run tests, add the following YAML to ### Environment variables {: #environment-variables}
your CI config file:
Environment variables can be set in your CI config. For example, to configure
cibuildwheel to run tests, add the following YAML to your CI config file:
!!! tab "GitHub Actions" !!! tab "GitHub Actions"
@@ -76,7 +73,43 @@ your CI config file:
CIBW_TEST_COMMAND: "pytest {project}/tests" CIBW_TEST_COMMAND: "pytest {project}/tests"
``` ```
### Configuration file {: #configuration-file}
You can configure cibuildwheel with a config file, such as `pyproject.toml`.
Options have the same names as the environment variable overrides, but are
placed in `[tool.cibuildwheel]` and are lower case, with dashes, following
common [TOML][] practice. Anything placed in subsections `linux`, `windows`,
or `macos` will only affect those platforms. Lists can be used instead of
strings for items that are natually a list. Multiline strings also work just
like in in the environment variables. Environment variables will take
precedence if defined.
The example above using environment variables could have been written like this:
```toml
[tool.cibuildwheel]
test-requires = "pytest"
test-command = "pytest {project}/tests"
```
The complete set of defaults for the current version of cibuildwheel are shown below:
```toml
{% include "../cibuildwheel/resources/defaults.toml" %}
```
!!! tip
Static configuration works across all CI systems, and can be used locally if
you run `cibuildwheel --plat linux`. This is preferred, but environment
variables are better if you need to change per-matrix element
(`CIBW_BUILD` is often in this category, for example), or if you cannot or do
not want to change a `pyproject.toml` file. You can specify a different file to
use with `--config-file` on the command line, as well.
## Options summary
<div class="options-toc"></div>
## Build selection ## Build selection
@@ -94,7 +127,7 @@ Default: `auto`
- For `macos`, you need a Mac machine. Note that cibuildwheel is going to install MacPython on your system, so you probably don't want to run this on your development machine. - For `macos`, you need a Mac machine. Note that cibuildwheel is going to install MacPython on your system, so you probably don't want to run this on your development machine.
- For `windows`, you need to run in Windows. cibuildwheel will install required versions of Python to `C:\cibw\python` using NuGet. - For `windows`, you need to run in Windows. cibuildwheel will install required versions of Python to `C:\cibw\python` using NuGet.
This option can also be set using the [command-line option](#command-line) `--platform`. This option can also be set using the [command-line option](#command-line) `--platform`. This option is not available in the `pyproject.toml` config.
!!! tip !!! tip
If you have Docker installed, you can locally debug your cibuildwheel Linux config, instead of pushing to CI to test every change. For example: If you have Docker installed, you can locally debug your cibuildwheel Linux config, instead of pushing to CI to test every change. For example:
@@ -110,7 +143,7 @@ This option can also be set using the [command-line option](#command-line) `--pl
> Choose the Python versions to build > Choose the Python versions to build
Space-separated list of builds to build and skip. Each build has an identifier like `cp38-manylinux_x86_64` or `cp37-macosx_x86_64` - you can list specific ones to build and cibuildwheel will only build those, and/or list ones to skip and cibuildwheel won't try to build them. List of builds to build and skip. Each build has an identifier like `cp38-manylinux_x86_64` or `cp37-macosx_x86_64` - you can list specific ones to build and cibuildwheel will only build those, and/or list ones to skip and cibuildwheel won't try to build them.
When both options are specified, both conditions are applied and only builds with a tag that matches `CIBW_BUILD` and does not match `CIBW_SKIP` will be built. When both options are specified, both conditions are applied and only builds with a tag that matches `CIBW_BUILD` and does not match `CIBW_SKIP` will be built.
@@ -122,7 +155,7 @@ When setting the options, you can use shell-style globbing syntax, as per [fnmat
|--------------|---------------------------------------------------------------------|-------------------------------|-----------------------------------------------|----------------------------------------------------------------------------| |--------------|---------------------------------------------------------------------|-------------------------------|-----------------------------------------------|----------------------------------------------------------------------------|
| Python 3.6 | cp36-macosx_x86_64 | cp36-win_amd64<br/>cp36-win32 | cp36-manylinux_x86_64<br/>cp36-manylinux_i686 | cp36-manylinux_aarch64<br/>cp36-manylinux_ppc64le<br/>cp36-manylinux_s390x | | Python 3.6 | cp36-macosx_x86_64 | cp36-win_amd64<br/>cp36-win32 | cp36-manylinux_x86_64<br/>cp36-manylinux_i686 | cp36-manylinux_aarch64<br/>cp36-manylinux_ppc64le<br/>cp36-manylinux_s390x |
| Python 3.7 | cp37-macosx_x86_64 | cp37-win_amd64<br/>cp37-win32 | cp37-manylinux_x86_64<br/>cp37-manylinux_i686 | cp37-manylinux_aarch64<br/>cp37-manylinux_ppc64le<br/>cp37-manylinux_s390x | | Python 3.7 | cp37-macosx_x86_64 | cp37-win_amd64<br/>cp37-win32 | cp37-manylinux_x86_64<br/>cp37-manylinux_i686 | cp37-manylinux_aarch64<br/>cp37-manylinux_ppc64le<br/>cp37-manylinux_s390x |
| Python 3.8 | cp38-macosx_x86_64 | cp38-win_amd64<br/>cp38-win32 | cp38-manylinux_x86_64<br/>cp38-manylinux_i686 | cp38-manylinux_aarch64<br/>cp38-manylinux_ppc64le<br/>cp38-manylinux_s390x | | Python 3.8 | cp38-macosx_x86_64<br/>cp38-macosx_universal2<br/>cp38-macosx_arm64 | cp38-win_amd64<br/>cp38-win32 | cp38-manylinux_x86_64<br/>cp38-manylinux_i686 | cp38-manylinux_aarch64<br/>cp38-manylinux_ppc64le<br/>cp38-manylinux_s390x |
| Python 3.9 | cp39-macosx_x86_64<br/>cp39-macosx_universal2<br/>cp39-macosx_arm64 | cp39-win_amd64<br/>cp39-win32 | cp39-manylinux_x86_64<br/>cp39-manylinux_i686 | cp39-manylinux_aarch64<br/>cp39-manylinux_ppc64le<br/>cp39-manylinux_s390x | | Python 3.9 | cp39-macosx_x86_64<br/>cp39-macosx_universal2<br/>cp39-macosx_arm64 | cp39-win_amd64<br/>cp39-win32 | cp39-manylinux_x86_64<br/>cp39-manylinux_i686 | cp39-manylinux_aarch64<br/>cp39-manylinux_ppc64le<br/>cp39-manylinux_s390x |
| PyPy3.7 v7.3 | pp37-macosx_x86_64 | pp37-win_amd64 | pp37-manylinux_x86_64 | | | PyPy3.7 v7.3 | pp37-macosx_x86_64 | pp37-win_amd64 | pp37-manylinux_x86_64 | |
@@ -136,6 +169,8 @@ See the [cibuildwheel 1 documentation](https://cibuildwheel.readthedocs.io/en/1.
#### Examples #### Examples
!!! tab examples "Environment variables"
```yaml ```yaml
# Only build on CPython 3.6 # Only build on CPython 3.6
CIBW_BUILD: cp36-* CIBW_BUILD: cp36-*
@@ -168,6 +203,47 @@ CIBW_SKIP: "*-win32 *-manylinux_i686"
CIBW_SKIP: pp* CIBW_SKIP: pp*
``` ```
Separate multiple selectors with a space.
!!! tab examples "pyproject.toml"
```toml
[tool.cibuildwheel]
# Only build on CPython 3.6
build = "cp36-*"
# Skip building on CPython 3.6 on the Mac
skip = "cp36-macosx_x86_64"
# Skip building on CPython 3.8 on the Mac
skip = "cp38-macosx_x86_64"
# Skip building on CPython 3.6 on all platforms
skip = "cp36-*"
# Skip CPython 3.6 on Windows
skip = "cp36-win*"
# Skip CPython 3.6 on 32-bit Windows
skip = "cp36-win32"
# Skip CPython 3.6 and CPython 3.7
skip = ["cp36-*", "cp37-*"]
# Skip Python 3.6 on Linux
skip = "cp36-manylinux*"
# Skip 32-bit builds
skip = ["*-win32", "*-manylinux_i686"]
# Disable building PyPy wheels on all platforms
skip = "pp*"
```
It is generally recommened to set `CIBW_BUILD` as an environment variable, though `skip`
tends to be useful in a config file; you can statically declare that you don't
support pypy, for example.
<style> <style>
.build-id-table-marker + table { .build-id-table-marker + table {
font-size: 90%; font-size: 90%;
@@ -191,7 +267,7 @@ CIBW_SKIP: pp*
### `CIBW_ARCHS` {: #archs} ### `CIBW_ARCHS` {: #archs}
> Change the architectures built on your machine by default. > Change the architectures built on your machine by default.
A space-separated list of architectures to build. A list of architectures to build.
On macOS, this option can be used to cross-compile between `x86_64`, On macOS, this option can be used to cross-compile between `x86_64`,
`universal2` and `arm64` for Apple Silicon support. `universal2` and `arm64` for Apple Silicon support.
@@ -226,13 +302,15 @@ If not listed above, `auto` is the same as `native`.
[setup-qemu-action]: https://github.com/docker/setup-qemu-action [setup-qemu-action]: https://github.com/docker/setup-qemu-action
[binfmt]: https://hub.docker.com/r/tonistiigi/binfmt [binfmt]: https://hub.docker.com/r/tonistiigi/binfmt
Platform-specific variants also available:<br/> Platform-specific environment variables are also available:<br/>
`CIBW_ARCHS_MACOS` | `CIBW_ARCHS_WINDOWS` | `CIBW_ARCHS_LINUX` `CIBW_ARCHS_MACOS` | `CIBW_ARCHS_WINDOWS` | `CIBW_ARCHS_LINUX`
This option can also be set using the [command-line option](#command-line) `--archs`. This option can also be set using the [command-line option](#command-line) `--archs`.
#### Examples #### Examples
!!! tab examples "Environment variables"
```yaml ```yaml
# Build `universal2` and `arm64` wheels on an Intel runner. # Build `universal2` and `arm64` wheels on an Intel runner.
# Note that the `arm64` wheel and the `arm64` part of the `universal2` # Note that the `arm64` wheel and the `arm64` part of the `universal2`
@@ -243,6 +321,26 @@ CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
CIBW_ARCHS_LINUX: "auto aarch64" CIBW_ARCHS_LINUX: "auto aarch64"
``` ```
Separate multiple archs with a space.
!!! tab examples "pyproject.toml"
```toml
# Build `universal2` and `arm64` wheels on an Intel runner.
# Note that the `arm64` wheel and the `arm64` part of the `universal2`
# wheel cannot be tested in this configuration.
[tool.cibuildwheel.macos]
archs = ["x86_64", "universal2", "arm64"]
# On an Linux Intel runner with qemu installed, build Intel and ARM wheels
[tool.cibuildwheel.linux]
archs = ["auto", "aarch64"]
```
It is generally recommmended to use the environment variable or
command-line option for Linux, as selecting archs often depends
on your specific runner having qemu installed.
### `CIBW_PROJECT_REQUIRES_PYTHON` {: #requires-python} ### `CIBW_PROJECT_REQUIRES_PYTHON` {: #requires-python}
> Manually set the Python compatibility of your project > Manually set the Python compatibility of your project
@@ -293,8 +391,16 @@ the package is compatible with all versions of Python that it can build.
[options] [options]
python_requires = ">=3.6" python_requires = ">=3.6"
This option is not available in `pyproject.toml` under
`tool.cibuildwheel.project-requires-python`, since it should be set with the
[PEP621](https://www.python.org/dev/peps/pep-0621/) location instead,
`project.requires-python`.
#### Examples #### Examples
!!! tab examples "Environment variables"
```yaml ```yaml
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.6" CIBW_PROJECT_REQUIRES_PYTHON: ">=3.6"
``` ```
@@ -316,10 +422,12 @@ like to test wheel building with these versions, you can enable this flag.
Default: Off (0) if Python is available in beta phase. No effect otherwise. Default: Off (0) if Python is available in beta phase. No effect otherwise.
This option can also be set using the [command-line option](#command-line) `--prerelease-pythons`. This option can also be set using the [command-line option](#command-line) `--prerelease-pythons`. This option is not available in the `pyproject.toml` config.
#### Examples #### Examples
!!! tab examples "Environment variables"
```yaml ```yaml
# Include latest Python beta # Include latest Python beta
CIBW_PRERELEASE_PYTHONS: True CIBW_PRERELEASE_PYTHONS: True
@@ -327,10 +435,49 @@ CIBW_PRERELEASE_PYTHONS: True
## Build customization ## Build customization
### `CIBW_BUILD_FRONTEND` {: #build-frontend}
> Set the tool to use to build, either "pip" (default for now) or "build"
Choose which build backend to use. Can either be "pip", which will run
`python -m pip wheel`, or "build", which will run `python -m build --wheel`.
!!! tip
Until v2.0.0, [pip] was the only way to build wheels, and is still the
default. However, we expect that at some point in the future, cibuildwheel
will change the default to [build], in line with the PyPA's recommendation.
If you want to try `build` before this, you can use this option.
[pip]: https://pip.pypa.io/en/stable/cli/pip_wheel/
[build]: https://github.com/pypa/build/
#### Examples
!!! tab examples "Environment variables"
```yaml
# Switch to using build
CIBW_BUILD_FRONTEND: "build"
# Ensure pip is used even if the default changes in the future
CIBW_BUILD_FRONTEND: "pip"
```
!!! tab examples "pyproject.toml"
```toml
[tool.cibuildwheel]
# Switch to using build
build-frontend = "build"
# Ensure pip is used even if the default changes in the future
build-frontend = "pip"
```
### `CIBW_ENVIRONMENT` {: #environment} ### `CIBW_ENVIRONMENT` {: #environment}
> Set environment variables needed during the build > Set environment variables needed during the build
A space-separated list of environment variables to set during the build. Bash syntax should be used, even on Windows. A list of environment variables to set during the build. Bash syntax should be used, even on Windows.
You must set this variable to pass variables to Linux builds (since they execute in a Docker container). It also works for the other platforms. You must set this variable to pass variables to Linux builds (since they execute in a Docker container). It also works for the other platforms.
@@ -338,10 +485,13 @@ You can use `$PATH` syntax to insert other variables, or the `$(pwd)` syntax to
To specify more than one environment variable, separate the assignments by spaces. To specify more than one environment variable, separate the assignments by spaces.
Platform-specific variants also available:<br/> Platform-specific environment variables are also available:<br/>
`CIBW_ENVIRONMENT_MACOS` | `CIBW_ENVIRONMENT_WINDOWS` | `CIBW_ENVIRONMENT_LINUX` `CIBW_ENVIRONMENT_MACOS` | `CIBW_ENVIRONMENT_WINDOWS` | `CIBW_ENVIRONMENT_LINUX`
#### Examples #### Examples
!!! tab examples "Environment variables"
```yaml ```yaml
# Set some compiler flags # Set some compiler flags
CIBW_ENVIRONMENT: "CFLAGS='-g -Wall' CXXFLAGS='-Wall'" CIBW_ENVIRONMENT: "CFLAGS='-g -Wall' CXXFLAGS='-Wall'"
@@ -355,10 +505,43 @@ CIBW_ENVIRONMENT: "BUILD_TIME=$(date)"
# Supply options to `pip` to affect how it downloads dependencies # Supply options to `pip` to affect how it downloads dependencies
CIBW_ENVIRONMENT: "PIP_EXTRA_INDEX_URL=https://pypi.myorg.com/simple" CIBW_ENVIRONMENT: "PIP_EXTRA_INDEX_URL=https://pypi.myorg.com/simple"
# Set two flags # Set two flags on linux only
CIBW_ENVIRONMENT: "BUILD_TIME=$(date) SAMPLE_TEXT=\"sample text\"" CIBW_ENVIRONMENT_LINUX: "BUILD_TIME=$(date) SAMPLE_TEXT=\"sample text\""
``` ```
Separate multiple values with a space.
!!! tab examples "pyproject.toml"
```toml
[tool.cibuildwheel]
# Set some compiler flags
environment = "CFLAGS='-g -Wall' CXXFLAGS='-Wall'"
# Set some compiler flags using a TOML table
environment = { CFLAGS="-g -Wall", CXXFLAGS="-Wall" }
# Append a directory to the PATH variable (this is expanded in the build environment)
environment = { PATH="$PATH:/usr/local/bin" }
# Set BUILD_TIME to the output of the `date` command
environment = { BUILD_TIME="$(date)" }
# Supply options to `pip` to affect how it downloads dependencies
environment = { PIP_EXTRA_INDEX_URL="https://pypi.myorg.com/simple" }
# Set two flags on linux only
[tool.cibuildwheel.linux]
environment = { BUILD_TIME="$(date)", SAMPLE_TEXT="sample text" }
# Alternate form with out-of-line table for setting a few values
[tool.cibuildwheel.linux.environment]
BUILD_TIME = "$(date)"
SAMPLE_TEXT = "sample text"
```
In configuration mode, you can use a [TOML][] table instead of a raw string as shown above.
!!! note !!! note
cibuildwheel always defines the environment variable `CIBUILDWHEEL=1`. This can be useful for [building wheels with optional extensions](faq.md#building-packages-with-optional-c-extensions). cibuildwheel always defines the environment variable `CIBUILDWHEEL=1`. This can be useful for [building wheels with optional extensions](faq.md#building-packages-with-optional-c-extensions).
@@ -367,24 +550,57 @@ CIBW_ENVIRONMENT: "BUILD_TIME=$(date) SAMPLE_TEXT=\"sample text\""
Shell command to prepare a common part of the project (e.g. build or install libraries which does not depend on the specific version of Python). Shell command to prepare a common part of the project (e.g. build or install libraries which does not depend on the specific version of Python).
This option is very useful for the Linux build, where builds take place in isolated Docker containers managed by cibuildwheel. This command will run inside the container before the wheel builds start. Note, if you're building both x86_64 and i686 wheels (the default), your build uses two different Docker images. In that case, this command will execute twice - once per build container. This option is very useful for the Linux build, where builds take place in isolated Docker containers managed by cibuildwheel. This command will run inside the container before the wheel builds start. Note, if you're building both `x86_64` and `i686` wheels (the default), your build uses two different Docker images. In that case, this command will execute twice - once per build container.
The placeholder `{package}` can be used here; it will be replaced by the path to the package being built by cibuildwheel. The placeholder `{package}` can be used here; it will be replaced by the path to the package being built by cibuildwheel.
On Windows and macOS, the version of Python available inside `CIBW_BEFORE_ALL` is whatever is available on the host machine. On Linux, a modern Python version is available on PATH. On Windows and macOS, the version of Python available inside `CIBW_BEFORE_ALL` is whatever is available on the host machine. On Linux, a modern Python version is available on PATH.
Platform-specific variants also available:<br/> Platform-specific environment variables also available:<br/>
`CIBW_BEFORE_ALL_MACOS` | `CIBW_BEFORE_ALL_WINDOWS` | `CIBW_BEFORE_ALL_LINUX` `CIBW_BEFORE_ALL_MACOS` | `CIBW_BEFORE_ALL_WINDOWS` | `CIBW_BEFORE_ALL_LINUX`
#### Examples #### Examples
!!! tab examples "Environment variables"
```yaml ```yaml
# build third party library # Build third party library
CIBW_BEFORE_ALL: make -C third_party_lib CIBW_BEFORE_ALL: make -C third_party_lib
# install system library # Install system library
CIBW_BEFORE_ALL_LINUX: yum install -y libffi-dev CIBW_BEFORE_ALL_LINUX: yum install -y libffi-dev
# Chain multiple commands using && and > in a YAML file, like:
CIBW_BEFORE_ALL: >
yum install bzip2 -y &&
make third_party
``` ```
For multiline commands, see the last example. The character `>` means that
whitespace is collapsed to a single line, and '&&' between each command
ensures that errors are not ignored. [Further reading on multiline YAML
here.](https://yaml-multiline.info).
!!! tab examples "pyproject.toml"
```toml
# Build third party library
[tool.cibuildwheel]
before-all = "make -C third_party_lib"
# Install system library
[tool.cibuildwheel.linux]
before-all = "yum install -y libffi-dev"
# Run multiple commands using an array
before-all = [
"yum install bzip2 -y",
"make third_party",
]
```
In configuration files, you can use a TOML array, and each line will be run sequentially - joined with `&&`.
Note that manylinux2_24 builds occur inside a Debian9 docker, where Note that manylinux2_24 builds occur inside a Debian9 docker, where
manylinux2010 and manylinux2014 builds occur inside a CentOS one. So for manylinux2010 and manylinux2014 builds occur inside a CentOS one. So for
`manylinux2_24` the `CIBW_BEFORE_ALL_LINUX` command must use `apt-get -y` `manylinux2_24` the `CIBW_BEFORE_ALL_LINUX` command must use `apt-get -y`
@@ -395,33 +611,63 @@ instead.
A shell command to run before building the wheel. This option allows you to run a command in **each** Python environment before the `pip wheel` command. This is useful if you need to set up some dependency so it's available during the build. A shell command to run before building the wheel. This option allows you to run a command in **each** Python environment before the `pip wheel` command. This is useful if you need to set up some dependency so it's available during the build.
If dependencies are required to build your wheel (for example if you include a header from a Python module), instead of using this command, we recommend adding requirements to a pyproject.toml file. This is reproducible, and users who do not get your wheels (such as Alpine or ClearLinux users) will still benefit. If dependencies are required to build your wheel (for example if you include a header from a Python module), instead of using this command, we recommend adding requirements to a `pyproject.toml` file's `build-system.requires` array instead. This is reproducible, and users who do not get your wheels (such as Alpine or ClearLinux users) will still benefit.
The active Python binary can be accessed using `python`, and pip with `pip`; cibuildwheel makes sure the right version of Python and pip will be executed. The placeholder `{package}` can be used here; it will be replaced by the path to the package being built by cibuildwheel. The active Python binary can be accessed using `python`, and pip with `pip`; cibuildwheel makes sure the right version of Python and pip will be executed. The placeholder `{package}` can be used here; it will be replaced by the path to the package being built by cibuildwheel.
The command is run in a shell, so you can write things like `cmd1 && cmd2`. The command is run in a shell, so you can write things like `cmd1 && cmd2`.
Platform-specific variants also available:<br/> Platform-specific environment variables are also available:<br/>
`CIBW_BEFORE_BUILD_MACOS` | `CIBW_BEFORE_BUILD_WINDOWS` | `CIBW_BEFORE_BUILD_LINUX` `CIBW_BEFORE_BUILD_MACOS` | `CIBW_BEFORE_BUILD_WINDOWS` | `CIBW_BEFORE_BUILD_LINUX`
#### Examples #### Examples
!!! tab examples "Environment variables"
```yaml ```yaml
# install something required for the build (you might want to use pyproject.toml instead) # Install something required for the build (you might want to use pyproject.toml instead)
CIBW_BEFORE_BUILD: pip install pybind11 CIBW_BEFORE_BUILD: pip install pybind11
# chain commands using && # Chain commands using &&
CIBW_BEFORE_BUILD_LINUX: yum install -y libffi-dev && make clean CIBW_BEFORE_BUILD_LINUX: python scripts/install-deps.py && make clean
# run a script that's inside your project # Run a script that's inside your project
CIBW_BEFORE_BUILD: bash scripts/prepare_for_build.sh CIBW_BEFORE_BUILD: bash scripts/prepare_for_build.sh
# if cibuildwheel is called with a package_dir argument, it's available as {package} # If cibuildwheel is called with a package_dir argument, it's available as {package}
CIBW_BEFORE_BUILD: "{package}/script/prepare_for_build.sh" CIBW_BEFORE_BUILD: "{package}/script/prepare_for_build.sh"
``` ```
!!! tab examples "pyproject.toml"
```toml
[tool.cibuildwheel]
# Install something required for the build
# (you might want to use build-system.requires instead)
before-build = "pip install pybind11"
# Chain commands using && or make an array.
before-build = "python scripts/install-deps.py && make clean"
before-build = [
"python scripts/install-deps.py",
"make clean",
]
# Run a script that's inside your project
before-build = "bash scripts/prepare_for_build.sh"
# If cibuildwheel is called with a package_dir argument, it's available as {package}
before-build = "{package}/script/prepare_for_build.sh"
```
In configuration mode, you can use a array, and the items will be joined with `&&`. In TOML, using a single-quote string will avoid escapes - useful for
Windows paths.
!!! note !!! note
If you need dependencies installed for the build, we recommend using If you need Python dependencies installed for the build, we recommend using
`pyproject.toml`. This is an example `pyproject.toml` file: `pyproject.toml`'s `build-system.requires` instead. This is an example
`pyproject.toml` file:
[build-system] [build-system]
requires = [ requires = [
@@ -445,6 +691,7 @@ CIBW_BEFORE_BUILD: "{package}/script/prepare_for_build.sh"
[PEP 517]: https://www.python.org/dev/peps/pep-0517/ [PEP 517]: https://www.python.org/dev/peps/pep-0517/
[PEP 518]: https://www.python.org/dev/peps/pep-0517/ [PEP 518]: https://www.python.org/dev/peps/pep-0517/
### `CIBW_REPAIR_WHEEL_COMMAND` {: #repair-wheel-command} ### `CIBW_REPAIR_WHEEL_COMMAND` {: #repair-wheel-command}
> Execute a shell command to repair each (non-pure Python) built wheel > Execute a shell command to repair each (non-pure Python) built wheel
@@ -465,7 +712,7 @@ The following placeholders must be used inside the command and will be replaced
The command is run in a shell, so you can run multiple commands like `cmd1 && cmd2`. The command is run in a shell, so you can run multiple commands like `cmd1 && cmd2`.
Platform-specific variants also available:<br/> Platform-specific environment variables are also available:<br/>
`CIBW_REPAIR_WHEEL_COMMAND_MACOS` | `CIBW_REPAIR_WHEEL_COMMAND_WINDOWS` | `CIBW_REPAIR_WHEEL_COMMAND_LINUX` `CIBW_REPAIR_WHEEL_COMMAND_MACOS` | `CIBW_REPAIR_WHEEL_COMMAND_WINDOWS` | `CIBW_REPAIR_WHEEL_COMMAND_LINUX`
!!! tip !!! tip
@@ -479,19 +726,39 @@ Platform-specific variants also available:<br/>
#### Examples #### Examples
!!! tab examples "Environment variables"
```yaml ```yaml
# use delvewheel on windows (only works on Python 3.6+) # Use delvewheel on windows
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel" CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}" CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}"
# don't repair macOS wheels # Don't repair macOS wheels
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "" CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
# pass the `--lib-sdir .` flag to auditwheel on Linux # Pass the `--lib-sdir .` flag to auditwheel on Linux
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel repair --lib-sdir . -w {dest_dir} {wheel}" CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel repair --lib-sdir . -w {dest_dir} {wheel}"
``` ```
!!! tab examples "pyproject.toml"
```toml
# Use delvewheel on windows
[tool.cibuildwheel.windows]
before_build = "pip install delvewheel"
repair_wheel_command = "delvewheel repair -w {dest_dir} {wheel}"
# Don't repair macOS wheels
[tool.cibuildwheel.macos]
repair_wheel_command = ""
# Pass the `--lib-sdir .` flag to auditwheel on Linux
[tool.cibuildwheel.linux]
repair_wheel_command = "auditwheel repair --lib-sdir . -w {dest_dir} {wheel}"
```
In configuration mode, you can use an inline array, and the items will be joined with `&&`.
### CIBW_MANYLINUX_*_IMAGE {: #manylinux-image} ### CIBW_MANYLINUX_*_IMAGE {: #manylinux-image}
> Specify alternative manylinux Docker images > Specify alternative manylinux Docker images
@@ -519,31 +786,62 @@ Auditwheel detects the version of the manylinux standard in the Docker image thr
#### Examples #### Examples
!!! tab examples "Environment variables"
```yaml ```yaml
# build using the manylinux1 image to ensure manylinux1 wheels are produced # Build using the manylinux1 image to ensure manylinux1 wheels are produced
# skip PyPy, since there is no PyPy manylinux1 image # Not setting PyPy to manylinux1, since there is no manylinux1 PyPy image.
CIBW_MANYLINUX_X86_64_IMAGE: manylinux1 CIBW_MANYLINUX_X86_64_IMAGE: manylinux1
CIBW_MANYLINUX_I686_IMAGE: manylinux1 CIBW_MANYLINUX_I686_IMAGE: manylinux1
CIBW_SKIP: pp*
# build using the manylinux2014 image # Build using the manylinux2014 image
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014 CIBW_MANYLINUX_I686_IMAGE: manylinux2014
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux2014 CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_PYPY_I686_IMAGE: manylinux2014 CIBW_MANYLINUX_PYPY_I686_IMAGE: manylinux2014
# build using the latest manylinux2010 release, instead of the cibuildwheel # Build using the latest manylinux2010 release, instead of the cibuildwheel
# pinned version # pinned version
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux2010_x86_64:latest CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux2010_x86_64:latest
CIBW_MANYLINUX_I686_IMAGE: quay.io/pypa/manylinux2010_i686:latest CIBW_MANYLINUX_I686_IMAGE: quay.io/pypa/manylinux2010_i686:latest
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: quay.io/pypa/manylinux2010_x86_64:latest CIBW_MANYLINUX_PYPY_X86_64_IMAGE: quay.io/pypa/manylinux2010_x86_64:latest
CIBW_MANYLINUX_PYPY_I686_IMAGE: quay.io/pypa/manylinux2010_i686:latest CIBW_MANYLINUX_PYPY_I686_IMAGE: quay.io/pypa/manylinux2010_i686:latest
# build using a different image from the docker registry # Build using a different image from the docker registry
CIBW_MANYLINUX_X86_64_IMAGE: dockcross/manylinux-x64 CIBW_MANYLINUX_X86_64_IMAGE: dockcross/manylinux-x64
CIBW_MANYLINUX_I686_IMAGE: dockcross/manylinux-x86 CIBW_MANYLINUX_I686_IMAGE: dockcross/manylinux-x86
``` ```
!!! tab examples "pyproject.toml"
```toml
[tool.cibuildwheel]
# Build using the manylinux1 image to ensure manylinux1 wheels are produced
# Not setting PyPy to manylinux1, since there is no manylinux1 PyPy image.
manylinux-x86_64-image = "manylinux1"
manylinux-i686-image = "manylinux1"
# Build using the manylinux2014 image
manylinux-x86_64_image = "manylinux2014"
manylinux-i686-image = "manylinux2014"
manylinux-pypy_x86_64-image = "manylinux2014"
manylinux-pypy_i686-image = "manylinux2014"
# Build using the latest manylinux2010 release, instead of the cibuildwheel
# pinned version
manylinux-x86_64-image = "quay.io/pypa/manylinux2010_x86_64:latest"
manylinux-i686-image = "quay.io/pypa/manylinux2010_i686:latest"
manylinux-pypy_x86_64-image = "quay.io/pypa/manylinux2010_x86_64:latest"
manylinux-pypy_i686-image = "quay.io/pypa/manylinux2010_i686:latest"
# Build using a different image from the docker registry
manylinux-x86_64-image = "dockcross/manylinux-x64"
manylinux-i686-image = "dockcross/manylinux-x86"
```
Like any other option, these can be placed in `[tool.cibuildwheel.linux]`
if you perfer; they have no effect on `macos` and `windows`.
### `CIBW_DEPENDENCY_VERSIONS` {: #dependency-versions} ### `CIBW_DEPENDENCY_VERSIONS` {: #dependency-versions}
> Specify how cibuildwheel controls the versions of the tools it uses > Specify how cibuildwheel controls the versions of the tools it uses
@@ -572,7 +870,7 @@ here and it will be used instead.
`./constraints-python37.txt` on Python 3.7, or fallback to `./constraints-python37.txt` on Python 3.7, or fallback to
`./constraints.txt` if that's not found. `./constraints.txt` if that's not found.
Platform-specific variants also available:<br/> Platform-specific environment variables are also available:<br/>
`CIBW_DEPENDENCY_VERSIONS_MACOS` | `CIBW_DEPENDENCY_VERSIONS_WINDOWS` `CIBW_DEPENDENCY_VERSIONS_MACOS` | `CIBW_DEPENDENCY_VERSIONS_WINDOWS`
!!! note !!! note
@@ -583,17 +881,32 @@ Platform-specific variants also available:<br/>
#### Examples #### Examples
!!! tab examples "Environment variables"
```yaml ```yaml
# use tools versions that are bundled with cibuildwheel (this is the default) # Use tools versions that are bundled with cibuildwheel (this is the default)
CIBW_DEPENDENCY_VERSIONS: pinned CIBW_DEPENDENCY_VERSIONS: pinned
# use the latest versions available on PyPI # Use the latest versions available on PyPI
CIBW_DEPENDENCY_VERSIONS: latest CIBW_DEPENDENCY_VERSIONS: latest
# use your own pip constraints file # Use your own pip constraints file
CIBW_DEPENDENCY_VERSIONS: ./constraints.txt CIBW_DEPENDENCY_VERSIONS: ./constraints.txt
``` ```
!!! tab examples "pyproject.toml"
```toml
[tool.cibuildwheel]
# Use tools versions that are bundled with cibuildwheel (this is the default)
dependency-versions = "pinned"
# Use the latest versions available on PyPI
dependency-versions = "latest"
# Use your own pip constraints file
dependency-versions = "./constraints.txt"
```
## Testing ## Testing
@@ -614,22 +927,40 @@ not be installed after building.
The command is run in a shell, so you can write things like `cmd1 && cmd2`. The command is run in a shell, so you can write things like `cmd1 && cmd2`.
Platform-specific variants also available:<br/> Platform-specific environment variables are also available:<br/>
`CIBW_TEST_COMMAND_MACOS` | `CIBW_TEST_COMMAND_WINDOWS` | `CIBW_TEST_COMMAND_LINUX` `CIBW_TEST_COMMAND_MACOS` | `CIBW_TEST_COMMAND_WINDOWS` | `CIBW_TEST_COMMAND_LINUX`
#### Examples #### Examples
!!! tab examples "Environment variables"
```yaml ```yaml
# run the project tests against the installed wheel using `nose` # Run the project tests against the installed wheel using `nose`
CIBW_TEST_COMMAND: nosetests {project}/tests CIBW_TEST_COMMAND: nosetests {project}/tests
# run the package tests using `pytest` # Run the package tests using `pytest`
CIBW_TEST_COMMAND: pytest {package}/tests CIBW_TEST_COMMAND: pytest {package}/tests
# trigger an install of the package, but run nothing of note # Trigger an install of the package, but run nothing of note
CIBW_TEST_COMMAND: "echo Wheel installed" CIBW_TEST_COMMAND: "echo Wheel installed"
``` ```
!!! tab examples "pyproject.toml"
```toml
[tool.cibuildwheel]
# Run the project tests against the installed wheel using `nose`
test-command = "nosetests {project}/tests"
# Run the package tests using `pytest`
test-command = "pytest {package}/tests"
# Trigger an install of the package, but run nothing of note
test-command = "echo Wheel installed"
```
In configuration files, you can use an array, and the items will be joined with `&&`.
### `CIBW_BEFORE_TEST` {: #before-test} ### `CIBW_BEFORE_TEST` {: #before-test}
> Execute a shell command before testing each wheel > Execute a shell command before testing each wheel
@@ -641,73 +972,137 @@ The active Python binary can be accessed using `python`, and pip with `pip`; cib
The command is run in a shell, so you can write things like `cmd1 && cmd2`. The command is run in a shell, so you can write things like `cmd1 && cmd2`.
Platform-specific variants also available:<br/> Platform-specific environment variables are also available:<br/>
`CIBW_BEFORE_TEST_MACOS` | `CIBW_BEFORE_TEST_WINDOWS` | `CIBW_BEFORE_TEST_LINUX` `CIBW_BEFORE_TEST_MACOS` | `CIBW_BEFORE_TEST_WINDOWS` | `CIBW_BEFORE_TEST_LINUX`
#### Examples #### Examples
!!! tab examples "Environment variables"
```yaml ```yaml
# install test dependencies with overwritten environment variables. # Install test dependencies with overwritten environment variables.
CIBW_BEFORE_TEST: CC=gcc CXX=g++ pip install -r requirements.txt CIBW_BEFORE_TEST: CC=gcc CXX=g++ pip install -r requirements.txt
# chain commands using && # Chain commands using &&
CIBW_BEFORE_TEST: rm -rf ./data/cache && mkdir -p ./data/cache CIBW_BEFORE_TEST: rm -rf ./data/cache && mkdir -p ./data/cache
# install non pip python package # Install non pip python package
CIBW_BEFORE_TEST: cd some_dir; ./configure; make; make install CIBW_BEFORE_TEST: cd some_dir; ./configure; make; make install
# install python packages that are required to install test dependencies # Install python packages that are required to install test dependencies
CIBW_BEFORE_TEST: pip install cmake scikit-build CIBW_BEFORE_TEST: pip install cmake scikit-build
``` ```
!!! tab examples "pyproject.toml"
```toml
[tool.cibuildwheel]
# Install test dependencies with overwritten environment variables.
before-test = "CC=gcc CXX=g++ pip install -r requirements.txt"
# Chain commands using && or using an array
before-test = "rm -rf ./data/cache && mkdir -p ./data/cache"
before-test = [
"rm -rf ./data/cache",
"mkdir -p ./data/cache",
]
# Install non pip python package
before-test = [
"cd some_dir",
"./configure",
"make",
"make install",
]
# Install python packages that are required to install test dependencies
[tool.cibuildwheel]
before-test = "pip install cmake scikit-build"
```
In configuration files, you can use an array, and the items will be joined with `&&`.
### `CIBW_TEST_REQUIRES` {: #test-requires} ### `CIBW_TEST_REQUIRES` {: #test-requires}
> Install Python dependencies before running the tests > Install Python dependencies before running the tests
Space-separated list of dependencies required for running the tests. Space-separated list of dependencies required for running the tests.
Platform-specific variants also available:<br/> Platform-specific environment variables are also available:<br/>
`CIBW_TEST_REQUIRES_MACOS` | `CIBW_TEST_REQUIRES_WINDOWS` | `CIBW_TEST_REQUIRES_LINUX` `CIBW_TEST_REQUIRES_MACOS` | `CIBW_TEST_REQUIRES_WINDOWS` | `CIBW_TEST_REQUIRES_LINUX`
#### Examples #### Examples
!!! tab examples "Environment variables"
```yaml ```yaml
# install pytest before running CIBW_TEST_COMMAND # Install pytest before running CIBW_TEST_COMMAND
CIBW_TEST_REQUIRES: pytest CIBW_TEST_REQUIRES: pytest
# install specific versions of test dependencies # Install specific versions of test dependencies
CIBW_TEST_REQUIRES: nose==1.3.7 moto==0.4.31 CIBW_TEST_REQUIRES: nose==1.3.7 moto==0.4.31
``` ```
!!! tab examples "pyproject.toml"
```toml
# Install pytest before running CIBW_TEST_COMMAND
[tool.cibuildwheel]
test-requires = "pytest"
# Install specific versions of test dependencies
[tool.cibuildwheel]
test-requires = ["nose==1.3.7", "moto==0.4.31"]
```
In configuration files, you can use an array, and the items will be joined with a space.
### `CIBW_TEST_EXTRAS` {: #test-extras} ### `CIBW_TEST_EXTRAS` {: #test-extras}
> Install your wheel for testing using `extras_require` > Install your wheel for testing using `extras_require`
Comma-separated list of List of
[extras_require](https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies) [extras_require](https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies)
options that should be included when installing the wheel prior to running the options that should be included when installing the wheel prior to running the
tests. This can be used to avoid having to redefine test dependencies in tests. This can be used to avoid having to redefine test dependencies in
`CIBW_TEST_REQUIRES` if they are already defined in `setup.py` or `CIBW_TEST_REQUIRES` if they are already defined in `setup.py` or
`setup.cfg`. `setup.cfg`.
Platform-specific variants also available:<br/> Platform-specific environment variables are also available:<br/>
`CIBW_TEST_EXTRAS_MACOS` | `CIBW_TEST_EXTRAS_WINDOWS` | `CIBW_TEST_EXTRAS_LINUX` `CIBW_TEST_EXTRAS_MACOS` | `CIBW_TEST_EXTRAS_WINDOWS` | `CIBW_TEST_EXTRAS_LINUX`
#### Examples #### Examples
!!! tab examples "Environment variables"
```yaml ```yaml
# will cause the wheel to be installed with `pip install <wheel_file>[test,qt]` # Will cause the wheel to be installed with `pip install <wheel_file>[test,qt]`
CIBW_TEST_EXTRAS: test,qt CIBW_TEST_EXTRAS: "test,qt"
``` ```
Seperate multiple items with a comma.
!!! tab examples "pyproject.toml"
```toml
[tool.cibuildwheel]
# Will cause the wheel to be installed with `pip install <wheel_file>[test,qt]`
test-extras: ["test", "qt"]
```
In configuration files, you can use an inline array, and the items will be joined with a comma.
### `CIBW_TEST_SKIP` {: #test-skip} ### `CIBW_TEST_SKIP` {: #test-skip}
> Skip running tests on some builds > Skip running tests on some builds
This will skip testing on any identifiers that match the given skip patterns (see [`CIBW_SKIP`](#build-skip)). This can be used to mask out tests for wheels that have missing dependencies upstream that are slow or hard to build, or to skip slow tests on emulated architectures. This will skip testing on any identifiers that match the given skip patterns (see [`CIBW_SKIP`](#build-skip)). This can be used to mask out tests for wheels that have missing dependencies upstream that are slow or hard to build, or to skip slow tests on emulated architectures.
With macOS `universal2` wheels, you can also skip the the individual archs inside the wheel using an `:arch` suffix. For example, `cp39-macosx_universal2:x86_64` or `cp39-macosx_universal2:arm64`. With macOS `universal2` wheels, you can also skip the individual archs inside the wheel using an `:arch` suffix. For example, `cp39-macosx_universal2:x86_64` or `cp39-macosx_universal2:arm64`.
#### Examples #### Examples
!!! tab examples "Environment variables"
```yaml ```yaml
# Will avoid testing on emulated architectures # Will avoid testing on emulated architectures
CIBW_TEST_SKIP: "*-manylinux_{aarch64,ppc64le,s390x}" CIBW_TEST_SKIP: "*-manylinux_{aarch64,ppc64le,s390x}"
@@ -716,6 +1111,16 @@ CIBW_TEST_SKIP: "*-manylinux_{aarch64,ppc64le,s390x}"
CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64" CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64"
``` ```
!!! tab examples "pyproject.toml"
```toml
[tool.cibuildwheel]
# Will avoid testing on emulated architectures
test-skip = "*-manylinux_{aarch64,ppc64le,s390x}"
# Skip trying to test arm64 builds on Intel Macs
test-skip = "*-macosx_arm64 *-macosx_universal2:arm64"
```
## Other ## Other
@@ -724,60 +1129,31 @@ CIBW_TEST_SKIP: "*-macosx_arm64 *-macosx_universal2:arm64"
An number from 1 to 3 to increase the level of verbosity (corresponding to invoking pip with `-v`, `-vv`, and `-vvv`), between -1 and -3 (`-q`, `-qq`, and `-qqq`), or just 0 (default verbosity). These flags are useful while debugging a build when the output of the actual build invoked by `pip wheel` is required. An number from 1 to 3 to increase the level of verbosity (corresponding to invoking pip with `-v`, `-vv`, and `-vvv`), between -1 and -3 (`-q`, `-qq`, and `-qqq`), or just 0 (default verbosity). These flags are useful while debugging a build when the output of the actual build invoked by `pip wheel` is required.
Platform-specific variants also available:<br/> Platform-specific environment variables are also available:<br/>
`CIBW_BUILD_VERBOSITY_MACOS` | `CIBW_BUILD_VERBOSITY_WINDOWS` | `CIBW_BUILD_VERBOSITY_LINUX` `CIBW_BUILD_VERBOSITY_MACOS` | `CIBW_BUILD_VERBOSITY_WINDOWS` | `CIBW_BUILD_VERBOSITY_LINUX`
#### Examples #### Examples
!!! tab examples "Environment variables"
```yaml ```yaml
# increase pip debugging output # Increase pip debugging output
CIBW_BUILD_VERBOSITY: 1 CIBW_BUILD_VERBOSITY: 1
``` ```
!!! tab examples "pyproject.toml"
```toml
[tool.cibuildwheel]
# Increase pip debugging output
build-verbosity = 1
```
## Command line options {: #command-line} ## Command line options {: #command-line}
```text ```text
usage: cibuildwheel [-h] [--platform {auto,linux,macos,windows}] « subprocess_run("cibuildwheel", "--help") »
[--archs ARCHS] [--output-dir OUTPUT_DIR]
[--print-build-identifiers] [--allow-empty]
[--prerelease-pythons]
[package_dir]
Build wheels for all the platforms.
positional arguments:
package_dir Path to the package that you want wheels for. Must be
a subdirectory of the working directory. When set, the
working directory is still considered the 'project'
and is copied into the Docker container on Linux.
Default: the working 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. Default: auto.
--archs ARCHS Comma-separated list of CPU architectures to build
for. When set to 'auto', builds the architectures
natively supported on this machine. Set this option to
build an architecture via emulation, for example,
using binfmt_misc and QEMU. Default: auto. Choices:
auto, auto64, auto32, native, all, x86_64, i686,
aarch64, ppc64le, s390x, universal2, arm64, x86, AMD64
--output-dir OUTPUT_DIR
Destination folder for the wheels.
--print-build-identifiers
Print the build identifiers matched by the current
invocation and exit.
--allow-empty Do not report an error code if the build does not
match any wheels.
--prerelease-pythons Enable pre-release Python versions if available.
``` ```
<style> <style>
@@ -899,3 +1275,5 @@ optional arguments:
console.log('readme options markdown\n', markdown) console.log('readme options markdown\n', markdown)
}); });
</script> </script>
[TOML]: https://toml.io
+2 -2
View File
@@ -46,7 +46,7 @@ To build Linux, Mac, and Windows wheels using GitHub Actions, create a `.github/
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Build wheels - name: Build wheels
run: pipx run cibuildwheel==2.0.0a1 run: pipx run cibuildwheel==2.0.0b2
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
@@ -81,7 +81,7 @@ To build Linux, Mac, and Windows wheels using GitHub Actions, create a `.github/
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
- name: Install cibuildwheel - name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.0.0a1 run: python -m pip install cibuildwheel==2.0.0b2
- name: Build wheels - name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse run: python -m cibuildwheel --output-dir wheelhouse
+1 -1
View File
@@ -12,7 +12,7 @@ stack: python 3.7
init: init:
- cmd: set PATH=C:\Python37;C:\Python37\Scripts;%PATH% - cmd: set PATH=C:\Python37;C:\Python37\Scripts;%PATH%
install: python -m pip install cibuildwheel==2.0.0a1 install: python -m pip install cibuildwheel==2.0.0b2
build_script: python -m cibuildwheel --output-dir wheelhouse build_script: python -m cibuildwheel --output-dir wheelhouse
+3 -3
View File
@@ -6,7 +6,7 @@ jobs:
- bash: | - bash: |
set -o errexit set -o errexit
python3 -m pip install --upgrade pip python3 -m pip install --upgrade pip
pip3 install cibuildwheel==2.0.0a1 pip3 install cibuildwheel==2.0.0b2
displayName: Install dependencies displayName: Install dependencies
- bash: cibuildwheel --output-dir wheelhouse . - bash: cibuildwheel --output-dir wheelhouse .
displayName: Build wheels displayName: Build wheels
@@ -20,7 +20,7 @@ jobs:
- bash: | - bash: |
set -o errexit set -o errexit
python3 -m pip install --upgrade pip python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel==2.0.0a1 python3 -m pip install cibuildwheel==2.0.0b2
displayName: Install dependencies displayName: Install dependencies
- bash: cibuildwheel --output-dir wheelhouse . - bash: cibuildwheel --output-dir wheelhouse .
displayName: Build wheels displayName: Build wheels
@@ -34,7 +34,7 @@ jobs:
- bash: | - bash: |
set -o errexit set -o errexit
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install cibuildwheel==2.0.0a1 pip install cibuildwheel==2.0.0b2
displayName: Install dependencies displayName: Install dependencies
- bash: cibuildwheel --output-dir wheelhouse . - bash: cibuildwheel --output-dir wheelhouse .
displayName: Build wheels displayName: Build wheels
+3 -3
View File
@@ -11,7 +11,7 @@ jobs:
- run: - run:
name: Build the Linux wheels. name: Build the Linux wheels.
command: | command: |
pip3 install --user cibuildwheel==2.0.0a1 pip3 install --user cibuildwheel==2.0.0b2
cibuildwheel --output-dir wheelhouse cibuildwheel --output-dir wheelhouse
- store_artifacts: - store_artifacts:
path: wheelhouse/ path: wheelhouse/
@@ -19,13 +19,13 @@ jobs:
osx-wheels: osx-wheels:
working_directory: ~/osx-wheels working_directory: ~/osx-wheels
macos: macos:
xcode: 10.0.0 xcode: 12.5.1
steps: steps:
- checkout - checkout
- run: - run:
name: Build the OS X wheels. name: Build the OS X wheels.
command: | command: |
pip3 install cibuildwheel==2.0.0a1 pip3 install cibuildwheel==2.0.0b2
cibuildwheel --output-dir wheelhouse cibuildwheel --output-dir wheelhouse
- store_artifacts: - store_artifacts:
path: wheelhouse/ path: wheelhouse/
+1 -1
View File
@@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Build wheels - name: Build wheels
uses: pypa/cibuildwheel@v2.0.0a1 uses: pypa/cibuildwheel@v2.0.0b2
env: env:
CIBW_ARCHS_MACOS: x86_64 universal2 CIBW_ARCHS_MACOS: x86_64 universal2
+1 -1
View File
@@ -27,7 +27,7 @@ jobs:
python-version: '3.8' python-version: '3.8'
- name: Build wheels - name: Build wheels
uses: pypa/cibuildwheel@v2.0.0a1 uses: pypa/cibuildwheel@v2.0.0b2
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
+1 -1
View File
@@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Build wheels - name: Build wheels
uses: pypa/cibuildwheel@v2.0.0a1 uses: pypa/cibuildwheel@v2.0.0b2
# to supply options, put them in 'env', like: # to supply options, put them in 'env', like:
# env: # env:
# CIBW_SOME_OPTION: value # CIBW_SOME_OPTION: value
+1 -1
View File
@@ -25,7 +25,7 @@ jobs:
platforms: all platforms: all
- name: Build wheels - name: Build wheels
uses: pypa/cibuildwheel@v2.0.0a1 uses: pypa/cibuildwheel@v2.0.0b2
env: env:
# configure cibuildwheel to build native archs ('auto'), and some # configure cibuildwheel to build native archs ('auto'), and some
# emulated ones # emulated ones
+1 -1
View File
@@ -12,7 +12,7 @@ linux:
DOCKER_TLS_CERTDIR: "" DOCKER_TLS_CERTDIR: ""
script: script:
- curl -sSL https://get.docker.com/ | sh - curl -sSL https://get.docker.com/ | sh
- python -m pip install cibuildwheel==2.0.0a1 - python -m pip install cibuildwheel==2.0.0b2
- cibuildwheel --output-dir wheelhouse - cibuildwheel --output-dir wheelhouse
artifacts: artifacts:
paths: paths:
+1 -1
View File
@@ -19,7 +19,7 @@ jobs:
- ln -s /c/Python38/python.exe /c/Python38/python3.exe - ln -s /c/Python38/python.exe /c/Python38/python3.exe
install: install:
- python3 -m pip install cibuildwheel==2.0.0a1 - python3 -m pip install cibuildwheel==2.0.0b2
script: script:
# build the wheels, put them into './wheelhouse' # build the wheels, put them into './wheelhouse'
+1 -1
View File
@@ -25,7 +25,7 @@ jobs:
- ln -s /c/Python38/python.exe /c/Python38/python3.exe - ln -s /c/Python38/python.exe /c/Python38/python3.exe
install: install:
- python3 -m pip install cibuildwheel==2.0.0a1 - python3 -m pip install cibuildwheel==2.0.0b2
script: script:
# build the wheels, put them into './wheelhouse' # build the wheels, put them into './wheelhouse'
+2 -2
View File
@@ -57,7 +57,7 @@ jobs:
- stage: deploy - stage: deploy
name: Build and deploy Linux wheels name: Build and deploy Linux wheels
services: docker services: docker
install: python3 -m pip install cibuildwheel==2.0.0a1 install: python3 -m pip install cibuildwheel==2.0.0b2
script: python3 -m cibuildwheel --output-dir wheelhouse script: python3 -m cibuildwheel --output-dir wheelhouse
after_success: | after_success: |
python3 -m pip install twine python3 -m pip install twine
@@ -67,7 +67,7 @@ jobs:
name: Build and deploy Windows wheels name: Build and deploy Windows wheels
os: windows os: windows
language: shell language: shell
install: python3 -m pip install cibuildwheel==2.0.0a1 install: python3 -m pip install cibuildwheel==2.0.0b2
script: python3 -m cibuildwheel --output-dir wheelhouse script: python3 -m cibuildwheel --output-dir wheelhouse
after_success: | after_success: |
python3 -m pip install twine python3 -m pip install twine
+4
View File
@@ -41,3 +41,7 @@ markdown_extensions:
plugins: plugins:
- include-markdown - include-markdown
- search - search
- macros:
module_name: docs/main
j2_variable_start_string: «
j2_variable_end_string: »
+3 -3
View File
@@ -48,7 +48,7 @@ def update_pins(session):
""" """
Update the python and docker pins version inplace. Update the python and docker pins version inplace.
""" """
session.install("-e", ".[dev]") session.install("-e", ".[bin]")
session.run("python", "bin/update_pythons.py", "--force") session.run("python", "bin/update_pythons.py", "--force")
session.run("python", "bin/update_docker.py") session.run("python", "bin/update_docker.py")
@@ -58,8 +58,8 @@ def update_proj(session):
""" """
Update the README inplace. Update the README inplace.
""" """
session.install("-e", ".[dev]") session.install("-e", ".[bin]")
session.run("./bin/projects.py", "docs/data/projects.yml", "--readme=README.md") session.run("python", "bin/projects.py", "docs/data/projects.yml", "--readme=README.md")
@nox.session @nox.session
+56
View File
@@ -6,6 +6,62 @@ requires = [
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
[tool.black] [tool.black]
line-length = 100 line-length = 100
target-version = ['py36', 'py37', 'py38', 'py39'] target-version = ['py36', 'py37', 'py38', 'py39']
[tool.isort]
profile = "black"
multi_line_output = 3
[tool.pytest.ini_options]
minversion = 6.0
junit_family = "xunit2"
testpaths = [
"test",
"unit_test",
]
[tool.mypy]
python_version = 3.7
files = [
"cibuildwheel/*.py",
"test/**/*.py",
"unit_test/**/*.py",
"bin/*.py"
]
warn_unused_configs = true
warn_redundant_casts = true
no_implicit_reexport = true
strict_equality = true
warn_unused_ignores = true
check_untyped_defs = true
disallow_subclassing_any = true
disallow_any_generics = true
warn_return_any = true
no_implicit_optional = true
[[tool.mypy.overrides]]
module = "cibuildwheel.*"
disallow_untyped_defs = true
disallow_untyped_calls = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
[[tool.mypy.overrides]]
module = [
"setuptools",
"pytest", # ignored in pre-commit to speed up check
"bashlex",
"toml.encoder", # encoder missing from stub package
"bracex",
"importlib_resources",
"nox",
"github",
]
ignore_missing_imports = true
+1 -55
View File
@@ -1,6 +1,6 @@
[metadata] [metadata]
name = cibuildwheel name = cibuildwheel
version = 2.0.0a1 version = 2.0.0b2
description = Build Python wheels on CI with minimal configuration. description = Build Python wheels on CI with minimal configuration.
long_description = file: README.md long_description = file: README.md
long_description_content_type = text/markdown long_description_content_type = text/markdown
@@ -65,57 +65,3 @@ exclude =
env??/, env??/,
.venv/, .venv/,
site/ site/
[tool:pytest]
junit_family = xunit2
testpaths =
test
unit_test
[mypy]
python_version = 3.7
files = cibuildwheel/*.py,test/**/*.py,unit_test/**/*.py,bin/*.py
warn_unused_configs = True
warn_redundant_casts = True
[mypy-test.*,mypy-unit_test.*]
check_untyped_defs = True
[mypy-cibuildwheel.*]
disallow_any_generics = True
disallow_subclassing_any = True
disallow_untyped_calls = True
disallow_untyped_defs = True
disallow_incomplete_defs = True
check_untyped_defs = True
disallow_untyped_decorators = True
no_implicit_optional = True
warn_unused_ignores = True
warn_return_any = True
no_implicit_reexport = True
strict_equality = True
[mypy-setuptools.*]
ignore_missing_imports = True
# Ignored for pre-commit to speed up check
# Not ignored if manually running and pytest installed
[mypy-pytest.*]
ignore_missing_imports = True
[mypy-bashlex.*]
ignore_missing_imports = True
# Has type stubs, but no pyproject.toml or .pyi files in the wheel.
[mypy-toml.*]
ignore_missing_imports = True
[mypy-bracex.*]
ignore_missing_imports = True
[mypy-importlib_resources.*]
ignore_missing_imports = True
[tool:isort]
profile = black
multi_line_output = 3
+21 -6
View File
@@ -5,27 +5,42 @@ extras = {
"mkdocs-include-markdown-plugin==2.8.0", "mkdocs-include-markdown-plugin==2.8.0",
"mkdocs==1.0.4", "mkdocs==1.0.4",
"pymdown-extensions", "pymdown-extensions",
"mkdocs-macros-plugin",
], ],
"test": [ "test": [
"jinja2", "jinja2",
"pytest>=4", "pytest>=6",
"pytest-timeout", "pytest-timeout",
], ],
"dev": [ "bin": [
"click", "click",
"ghapi", "ghapi",
"mypy>=0.800",
"packaging>=20.8",
"pip-tools", "pip-tools",
"pygithub", "pygithub",
"pyyaml", "pyyaml",
"requests", "requests",
"rich>=9.6", "rich>=9.6",
"typing-extensions", "packaging>=21.0",
],
"mypy": [
"mypy>=0.901",
"types-jinja2",
"types-certifi",
"types-toml",
"types-jinja2",
"types-pyyaml",
"types-click",
"types-requests",
"types-toml",
], ],
} }
extras["dev"] = [
*extras["mypy"],
*extras["test"],
*extras["bin"],
]
extras["all"] = sum(extras.values(), []) extras["all"] = sum(extras.values(), [])
extras["dev"] += extras["test"]
setup(extras_require=extras) setup(extras_require=extras)
+11 -2
View File
@@ -1,7 +1,9 @@
from typing import Dict
import pytest import pytest
def pytest_addoption(parser): def pytest_addoption(parser) -> None:
parser.addoption( parser.addoption(
"--run-emulation", action="store_true", default=False, help="run emulation tests" "--run-emulation", action="store_true", default=False, help="run emulation tests"
) )
@@ -11,7 +13,7 @@ def pytest_configure(config):
config.addinivalue_line("markers", "emulation: mark test requiring qemu binfmt_misc to run") config.addinivalue_line("markers", "emulation: mark test requiring qemu binfmt_misc to run")
def pytest_collection_modifyitems(config, items): def pytest_collection_modifyitems(config, items) -> None:
if config.getoption("--run-emulation"): if config.getoption("--run-emulation"):
# --run-emulation given in cli: do not skip emulation tests # --run-emulation given in cli: do not skip emulation tests
return return
@@ -19,3 +21,10 @@ def pytest_collection_modifyitems(config, items):
for item in items: for item in items:
if "emulation" in item.keywords: if "emulation" in item.keywords:
item.add_marker(skip_emulation) item.add_marker(skip_emulation)
@pytest.fixture(
params=[{"CIBW_BUILD_FRONTEND": "pip"}, {"CIBW_BUILD_FRONTEND": "build"}], ids=["pip", "build"]
)
def build_frontend_env(request) -> Dict[str, str]:
return request.param # type: ignore
+2 -2
View File
@@ -18,12 +18,12 @@ basic_project = test_projects.new_c_project(
) )
def test(tmp_path): def test(tmp_path, build_frontend_env):
project_dir = tmp_path / "project" project_dir = tmp_path / "project"
basic_project.generate(project_dir) basic_project.generate(project_dir)
# build the wheels # build the wheels
actual_wheels = utils.cibuildwheel_run(project_dir) actual_wheels = utils.cibuildwheel_run(project_dir, add_env=build_frontend_env)
# check that the expected wheels are produced # check that the expected wheels are produced
expected_wheels = utils.expected_wheels("spam", "0.1.0") expected_wheels = utils.expected_wheels("spam", "0.1.0")
+6 -1
View File
@@ -25,8 +25,13 @@ project_with_before_build_asserts = test_projects.new_c_project(
stored_executable = f.read() stored_executable = f.read()
print('stored_executable', stored_executable) print('stored_executable', stored_executable)
print('sys.executable', sys.executable) print('sys.executable', sys.executable)
# windows/mac are case insensitive # windows/mac are case insensitive
assert os.path.realpath(stored_executable).lower() == os.path.realpath(sys.executable).lower() stored_path = os.path.realpath(stored_executable).lower()
current_path = os.path.realpath(sys.executable).lower()
# TODO: This is not valid in an virtual environment
assert stored_path == current_path, '{0} != {1}'.format(stored_path, current_path)
""" """
) )
) )
+7 -4
View File
@@ -48,7 +48,7 @@ def get_versions_from_constraint_file(constraint_file):
@pytest.mark.parametrize("python_version", ["3.6", "3.8", "3.9"]) @pytest.mark.parametrize("python_version", ["3.6", "3.8", "3.9"])
def test_pinned_versions(tmp_path, python_version): def test_pinned_versions(tmp_path, python_version, build_frontend_env):
if utils.platform == "linux": if utils.platform == "linux":
pytest.skip("linux doesn't pin individual tool versions, it pins manylinux images instead") pytest.skip("linux doesn't pin individual tool versions, it pins manylinux images instead")
@@ -85,6 +85,7 @@ def test_pinned_versions(tmp_path, python_version):
add_env={ add_env={
"CIBW_BUILD": build_pattern, "CIBW_BUILD": build_pattern,
"CIBW_ENVIRONMENT": cibw_environment_option, "CIBW_ENVIRONMENT": cibw_environment_option,
**build_frontend_env,
}, },
) )
@@ -107,7 +108,7 @@ def test_pinned_versions(tmp_path, python_version):
assert set(actual_wheels) == set(expected_wheels) assert set(actual_wheels) == set(expected_wheels)
def test_dependency_constraints_file(tmp_path): def test_dependency_constraints_file(tmp_path, build_frontend_env):
if utils.platform == "linux": if utils.platform == "linux":
pytest.skip("linux doesn't pin individual tool versions, it pins manylinux images instead") pytest.skip("linux doesn't pin individual tool versions, it pins manylinux images instead")
@@ -118,10 +119,10 @@ def test_dependency_constraints_file(tmp_path):
"pip": "20.0.2", "pip": "20.0.2",
"setuptools": "53.0.0", "setuptools": "53.0.0",
"wheel": "0.34.2", "wheel": "0.34.2",
"virtualenv": "20.0.10", "virtualenv": "20.0.35",
} }
constraints_file = tmp_path / "constraints.txt" constraints_file = tmp_path / "constraints file.txt"
constraints_file.write_text( constraints_file.write_text(
textwrap.dedent( textwrap.dedent(
""" """
@@ -129,6 +130,7 @@ def test_dependency_constraints_file(tmp_path):
setuptools=={setuptools} setuptools=={setuptools}
wheel=={wheel} wheel=={wheel}
virtualenv=={virtualenv} virtualenv=={virtualenv}
importlib-metadata<3,>=0.12; python_version < "3.8"
""".format( """.format(
**tool_versions **tool_versions
) )
@@ -149,6 +151,7 @@ def test_dependency_constraints_file(tmp_path):
add_env={ add_env={
"CIBW_ENVIRONMENT": cibw_environment_option, "CIBW_ENVIRONMENT": cibw_environment_option,
"CIBW_DEPENDENCY_VERSIONS": str(constraints_file), "CIBW_DEPENDENCY_VERSIONS": str(constraints_file),
**build_frontend_env,
}, },
) )
+1 -5
View File
@@ -42,13 +42,9 @@ def test(tmp_path):
) )
# also check that we got the right wheels built # also check that we got the right wheels built
# there's no auditwheel 4+ on dockcross image
# remove manylinux1 wheels from the list of actual_wheels
# and restrict expected_wheels to manylinux2010 wheels
actual_wheels = [w for w in actual_wheels if "-manylinux1" not in w]
expected_wheels = [ expected_wheels = [
w w
for w in utils.expected_wheels("spam", "0.1.0", manylinux_versions=["manylinux2010"]) for w in utils.expected_wheels("spam", "0.1.0")
if "-cp36-" in w or "-cp37-" in w or "-cp38-" in w or "-cp39-" in w if "-cp36-" in w or "-cp37-" in w or "-cp38-" in w or "-cp39-" in w
] ]
assert set(actual_wheels) == set(expected_wheels) assert set(actual_wheels) == set(expected_wheels)
+11 -4
View File
@@ -1,4 +1,3 @@
import os
import textwrap import textwrap
from . import test_projects, utils from . import test_projects, utils
@@ -33,13 +32,13 @@ build-backend = "setuptools.build_meta"
""" """
def test_pep518(tmp_path): def test_pep518(tmp_path, build_frontend_env):
project_dir = tmp_path / "project" project_dir = tmp_path / "project"
basic_project.generate(project_dir) basic_project.generate(project_dir)
# build the wheels # build the wheels
actual_wheels = utils.cibuildwheel_run(project_dir) actual_wheels = utils.cibuildwheel_run(project_dir, add_env=build_frontend_env)
# check that the expected wheels are produced # check that the expected wheels are produced
expected_wheels = utils.expected_wheels("spam", "0.1.0") expected_wheels = utils.expected_wheels("spam", "0.1.0")
@@ -50,4 +49,12 @@ def test_pep518(tmp_path):
assert not (project_dir / "42").exists() assert not (project_dir / "42").exists()
assert not (project_dir / "4.1.2").exists() assert not (project_dir / "4.1.2").exists()
assert len(os.listdir(project_dir)) == len(basic_project.files) # pypa/build creates a "build" folder & a "*.egg-info" folder for the wheel being built,
# this should be harmless so remove them
contents = [
item
for item in project_dir.iterdir()
if item.name != "build" and not item.name.endswith(".egg-info")
]
assert len(contents) == len(basic_project.files)
+4 -2
View File
@@ -1,2 +1,4 @@
from .base import TestProject # noqa from .base import TestProject
from .c import new_c_project # noqa from .c import new_c_project
__all__ = ("TestProject", "new_c_project")
+2 -2
View File
@@ -16,7 +16,7 @@ raise Exception('this build will fail')
""" """
def test_failed_project_with_so_files(tmp_path, capfd): def test_failed_project_with_so_files(tmp_path, capfd, build_frontend_env):
if utils.platform != "linux": if utils.platform != "linux":
pytest.skip("this test is only relevant to the linux build") pytest.skip("this test is only relevant to the linux build")
@@ -24,7 +24,7 @@ def test_failed_project_with_so_files(tmp_path, capfd):
so_file_project.generate(project_dir) so_file_project.generate(project_dir)
with pytest.raises(subprocess.CalledProcessError): with pytest.raises(subprocess.CalledProcessError):
utils.cibuildwheel_run(project_dir) utils.cibuildwheel_run(project_dir, add_env=build_frontend_env)
captured = capfd.readouterr() captured = capfd.readouterr()
print("out", captured.out) print("out", captured.out)
+2 -2
View File
@@ -11,7 +11,7 @@ def test_compare_configs():
dict_txt = toml.loads(txt) dict_txt = toml.loads(txt)
new_txt = toml.dumps(dict_txt, encoder=InlineArrayDictEncoder()) new_txt = toml.dumps(dict_txt, encoder=InlineArrayDictEncoder()) # type: ignore
print(new_txt) print(new_txt)
assert new_txt == txt assert new_txt == txt
@@ -35,6 +35,6 @@ python_configurations = [
] ]
""" """
output = toml.dumps(example, encoder=InlineArrayDictEncoder()) output = toml.dumps(example, encoder=InlineArrayDictEncoder()) # type: ignore
print(output) print(output)
assert output == result assert output == result
+1
View File
@@ -63,6 +63,7 @@ def test_container_removed():
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
universal_newlines=True, universal_newlines=True,
).stdout ).stdout
assert container.name is not None
assert container.name in docker_containers_listing assert container.name in docker_containers_listing
old_container_name = container.name old_container_name = container.name
+3 -6
View File
@@ -200,7 +200,7 @@ def test_test_command(
main() main()
assert intercepted_build_args.args[0].test_command == test_command assert intercepted_build_args.args[0].test_command == (test_command or "")
@pytest.mark.parametrize("before_build", [None, "before --build"]) @pytest.mark.parametrize("before_build", [None, "before --build"])
@@ -217,7 +217,7 @@ def test_before_build(
main() main()
assert intercepted_build_args.args[0].before_build == before_build assert intercepted_build_args.args[0].before_build == (before_build or "")
@pytest.mark.parametrize("build_verbosity", [None, 0, 2, -2, 4, -4]) @pytest.mark.parametrize("build_verbosity", [None, 0, 2, -2, 4, -4])
@@ -286,7 +286,4 @@ def test_before_all(before_all, platform_specific, platform, intercepted_build_a
main() main()
if before_all is None: assert intercepted_build_args.args[0].before_all == (before_all or "")
before_all = ""
assert intercepted_build_args.args[0].before_all == before_all
+190
View File
@@ -0,0 +1,190 @@
import pytest
from cibuildwheel.options import ConfigOptionError, ConfigOptions
PYPROJECT_1 = """
[tool.cibuildwheel]
build = "cp39*"
environment = {THING = "OTHER", FOO="BAR"}
test-command = "pyproject"
test-requires = "something"
test-extras = ["one", "two"]
manylinux-x86_64-image = "manylinux1"
[tool.cibuildwheel.macos]
test-requires = "else"
[tool.cibuildwheel.linux]
test-requires = ["other", "many"]
"""
@pytest.fixture(params=["linux", "macos", "windows"])
def platform(request):
return request.param
@pytest.mark.parametrize("fname", ["pyproject.toml", "cibuildwheel.toml"])
def test_simple_settings(tmp_path, platform, fname):
with tmp_path.joinpath(fname).open("w") as f:
f.write(PYPROJECT_1)
options = ConfigOptions(tmp_path, f"{{package}}/{fname}", platform=platform)
assert options("build", env_plat=False, sep=" ") == "cp39*"
assert options("test-command") == "pyproject"
assert options("archs", sep=" ") == "auto"
assert (
options("test-requires", sep=" ")
== {"windows": "something", "macos": "else", "linux": "other many"}[platform]
)
# Also testing options for support for both lists and tables
assert (
options("environment", table={"item": '{k}="{v}"', "sep": " "}) == 'THING="OTHER" FOO="BAR"'
)
assert (
options("environment", sep="x", table={"item": '{k}="{v}"', "sep": " "})
== 'THING="OTHER" FOO="BAR"'
)
assert options("test-extras", sep=",") == "one,two"
assert options("test-extras", sep=",", table={"item": '{k}="{v}"', "sep": " "}) == "one,two"
assert options("manylinux-x86_64-image") == "manylinux1"
assert options("manylinux-i686-image") == "manylinux2010"
with pytest.raises(ConfigOptionError):
options("environment", sep=" ")
with pytest.raises(ConfigOptionError):
options("test-extras", table={"item": '{k}="{v}"', "sep": " "})
def test_envvar_override(tmp_path, platform, monkeypatch):
monkeypatch.setenv("CIBW_BUILD", "cp38*")
monkeypatch.setenv("CIBW_MANYLINUX_X86_64_IMAGE", "manylinux2014")
monkeypatch.setenv("CIBW_TEST_COMMAND", "mytest")
monkeypatch.setenv("CIBW_TEST_REQUIRES", "docs")
monkeypatch.setenv("CIBW_TEST_REQUIRES_LINUX", "scod")
with tmp_path.joinpath("pyproject.toml").open("w") as f:
f.write(PYPROJECT_1)
options = ConfigOptions(tmp_path, platform=platform)
assert options("archs", sep=" ") == "auto"
assert options("build", sep=" ") == "cp38*"
assert options("manylinux-x86_64-image") == "manylinux2014"
assert options("manylinux-i686-image") == "manylinux2010"
assert (
options("test-requires", sep=" ")
== {"windows": "docs", "macos": "docs", "linux": "scod"}[platform]
)
assert options("test-command") == "mytest"
def test_project_global_override_default_platform(tmp_path, platform):
tmp_path.joinpath("pyproject.toml").write_text(
"""
[tool.cibuildwheel]
repair-wheel-command = "repair-project-global"
"""
)
options = ConfigOptions(tmp_path, platform=platform)
assert options("repair-wheel-command") == "repair-project-global"
def test_env_global_override_default_platform(tmp_path, platform, monkeypatch):
monkeypatch.setenv("CIBW_REPAIR_WHEEL_COMMAND", "repair-env-global")
options = ConfigOptions(tmp_path, platform=platform)
assert options("repair-wheel-command") == "repair-env-global"
def test_env_global_override_project_platform(tmp_path, platform, monkeypatch):
monkeypatch.setenv("CIBW_REPAIR_WHEEL_COMMAND", "repair-env-global")
tmp_path.joinpath("pyproject.toml").write_text(
"""
[tool.cibuildwheel.linux]
repair-wheel-command = "repair-project-linux"
[tool.cibuildwheel.windows]
repair-wheel-command = "repair-project-windows"
[tool.cibuildwheel.macos]
repair-wheel-command = "repair-project-macos"
"""
)
options = ConfigOptions(tmp_path, platform=platform)
assert options("repair-wheel-command") == "repair-env-global"
def test_global_platform_order(tmp_path, platform):
tmp_path.joinpath("pyproject.toml").write_text(
"""
[tool.cibuildwheel.linux]
repair-wheel-command = "repair-project-linux"
[tool.cibuildwheel.windows]
repair-wheel-command = "repair-project-windows"
[tool.cibuildwheel.macos]
repair-wheel-command = "repair-project-macos"
[tool.cibuildwheel]
repair-wheel-command = "repair-project-global"
"""
)
options = ConfigOptions(tmp_path, platform=platform)
assert options("repair-wheel-command") == f"repair-project-{platform}"
def test_unexpected_key(tmp_path):
# Note that platform contents are only checked when running
# for that platform.
tmp_path.joinpath("pyproject.toml").write_text(
"""
[tool.cibuildwheel]
repairs-wheel-command = "repair-project-linux"
"""
)
with pytest.raises(ConfigOptionError):
ConfigOptions(tmp_path, platform="linux")
def test_unexpected_table(tmp_path):
tmp_path.joinpath("pyproject.toml").write_text(
"""
[tool.cibuildwheel.linus]
repair-wheel-command = "repair-project-linux"
"""
)
with pytest.raises(ConfigOptionError):
ConfigOptions(tmp_path, platform="linux")
def test_unsupported_join(tmp_path):
tmp_path.joinpath("pyproject.toml").write_text(
"""
[tool.cibuildwheel]
build = ["1", "2"]
"""
)
options = ConfigOptions(tmp_path, platform="linux")
assert "1, 2" == options("build", sep=", ")
with pytest.raises(ConfigOptionError):
options("build")
def test_disallowed_a(tmp_path):
tmp_path.joinpath("pyproject.toml").write_text(
"""
[tool.cibuildwheel.windows]
manylinux-x64_86-image = "manylinux1"
"""
)
disallow = {"windows": {"manylinux-x64_86-image"}}
ConfigOptions(tmp_path, platform="linux", disallow=disallow)
with pytest.raises(ConfigOptionError):
ConfigOptions(tmp_path, platform="windows", disallow=disallow)