Compare commits

...
82 Commits
Author SHA1 Message Date
Joe Rickerby 5ef488ba30 Bump version: v2.8.0 2022-07-05 18:33:12 +01:00
Joe Rickerby e035e3a289 Merge pull request #1152 from mayeut/already-built
fix: error out if multiple wheels with the same name are produced
2022-07-05 16:58:52 +01:00
Joe Rickerby 6fe0354c26 Merge pull request #966 from Erotemic/new_podman_support
Podman support on Linux
2022-07-05 16:57:03 +01:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> 227125cdf8 [pre-commit.ci] pre-commit autoupdate (#1167)
updates:
- [github.com/psf/black: 22.3.0 → 22.6.0](https://github.com/psf/black/compare/22.3.0...22.6.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-07-05 09:13:34 -04:00
dependabot[bot]dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Henry Schreiner
c4f1c31ccc chore(deps): bump actions/setup-python from 3 to 4 (#1134)
* chore(deps): bump actions/setup-python from 3 to 4

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 3 to 4.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Apply suggestions from code review

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2022-07-05 09:13:25 -04:00
Henry Schreiner 5e2d02d809 Merge branch 'main' into new_podman_support 2022-07-03 14:04:06 -04:00
Henry Schreiner 9ed9e6b960 Merge branch 'main' into already-built 2022-07-03 14:02:42 -04:00
Joe Rickerby d02366f547 fix: multiple version tags per release bug in release tooling (#1166) 2022-07-03 14:00:19 -04:00
9a537512c1 feat: add support for py3-none-{platform} wheels (#1151)
* feature: add support for `py3-none-{platform}` wheels

This extends the mechanism introduced in #1091 for `abi3` wheels.
Most of the mentions to `abi3` have been removed and replaced by a more generic `compatible_wheel`.
This allows to build a wheel `foo-0.1-py3-none-win_amd64.whl` only once and still test with every configured python.

* Add integration test for py3-none abi wheels

* Fix expected_wheels for py3-none abi

* Limit test to three pythons and check for certain log messages

* chore: add some comments to explain filter process

Co-authored-by: Joe Rickerby <joerick@mac.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-07-03 14:00:00 -04:00
joncrall a3616700f5 Pass cwd to first two calls 2022-06-29 21:00:15 -04:00
Henry Schreiner 075792473a chore: simpler dependabot (#1165)
* chore: simpler dependabot

Ignores no longer needed after April 2022. Dependabot keeps the same style pinning now.

* Update faq.md
2022-06-29 18:10:35 -04:00
Joe Rickerby c4bb04567b Add docs for CIBW_CONTAINER_ENGINE 2022-06-29 21:06:24 +01:00
Joe Rickerby 7c56b98331 Merge remote-tracking branch 'origin/main' into new_podman_support 2022-06-29 20:20:36 +01:00
Joe Rickerby f69fa19d07 Run podman tests only on linux 2022-06-29 20:18:08 +01:00
Joe Rickerby 0107cc32b3 Merge pull request #1099 from henryiii/henryiii/refactor/namespace
refactor: use dataclasses instead of NamedTuples
2022-06-29 12:03:26 +01:00
Joe Rickerby ac1bce28ad Merge pull request #1162 from pypa/update-dependencies-pr
[Bot] Update dependencies
2022-06-29 11:58:43 +01:00
Joe Rickerby 90552fc2ea Merge pull request #1163 from pypa/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-06-29 11:58:02 +01:00
joncrall f182ed3cfa Fix spelling 2022-06-27 23:40:41 -04:00
pre-commit-ci[bot] 062ab6cb93 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-06-27 20:24:15 +00:00
joncrall 46678e24e3 Inlined podman install 2022-06-27 16:24:00 -04:00
joncrall 12a3fa2d3e Use tomli_w instead of toml 2022-06-27 16:23:02 -04:00
pre-commit-ci[bot] e7de8a4760 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/hadialqattan/pycln: v1.3.3 → v1.3.5](https://github.com/hadialqattan/pycln/compare/v1.3.3...v1.3.5)
2022-06-27 18:35:29 +00:00
Joe Rickerby 22ba00bb46 Fix missing rename 2022-06-27 19:32:35 +01:00
Joe Rickerby b612a6c993 Actually run the podman integration test on podman :) 2022-06-27 19:19:00 +01:00
Joe Rickerby f23d8aaae5 Add an integration test for a podman build 2022-06-27 19:08:46 +01:00
Joe Rickerby e5ef3c1b76 Tweak test config to remove always-skipped test 2022-06-27 18:35:28 +01:00
Joe Rickerby d66c1e92bf Lots more naming changes to reflect that containers are not necessarily 'docker' 2022-06-27 18:30:49 +01:00
Joe Rickerby 1d2e5d5d8f Rename DockerContainer -> OCIContainer, and a few other things
OCIContainer.container_engine -> OCIContainer.engine
OCIContainer.docker_image -> OCIContainer.image

Variables that refer to 'docker_images' have been renamed to
'container_images'
2022-06-27 17:46:22 +01:00
Joe Rickerby 2457006796 Make container-engine a global option, since that's how its being used 2022-06-27 17:32:40 +01:00
Joe Rickerby 3bd759f50c Add some type safety to the container_engine option 2022-06-27 17:26:31 +01:00
Joe Rickerby de3144a947 Remove unused imports 2022-06-27 16:53:08 +01:00
pre-commit-ci[bot] 38faa27943 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-06-27 15:47:31 +00:00
Joe Rickerby 6a371aca73 Refactor the tests to use --run-docker and --run-podman
Simplified test setup using a parameterised fixture. The VFS test
is now just a single test that handles its own clean up.
2022-06-27 16:45:27 +01:00
Joe Rickerby d9b4644286 Don't need shell for this command 2022-06-27 15:23:50 +01:00
Joe Rickerby 8d389467be Switch to the simpler podman cp implementation
The trick is "{src_path}/.".

See https://docs.podman.io/en/latest/markdown/podman-cp.1.html#description
2022-06-27 14:48:33 +01:00
cibuildwheel-bot[bot] 4bc5d90430 Update dependencies 2022-06-27 06:16:07 +00:00
joncrall fc0db95198 more mypy fixes 2022-06-26 17:35:53 -04:00
joncrall a86cabc716 forgot to monkeypatch a test 2022-06-26 17:23:52 -04:00
joncrall 086ead0d6b remove missing imports 2022-06-26 17:22:44 -04:00
joncrall c68223b172 Make mypy happy 2022-06-26 17:21:59 -04:00
pre-commit-ci[bot] 9401c90ddb [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-06-26 21:10:51 +00:00
joncrall 1599383429 Cleanup 2022-06-26 17:10:02 -04:00
joncrall 4a7d89b3c8 Does podman work with the original host args 2022-06-26 16:57:26 -04:00
joncrall 90945a38d2 reworks 2022-06-26 15:53:44 -04:00
mayeut ef18186c45 fix: error out if multiple wheels with the same name are produced
We shouldn't silently overwrite wheels that are produced in the same run that have the same filename, as this implies a misconfiguration.
2022-06-26 11:32:33 +02:00
mayeut 0696c94710 feature: add support for py3-none-{platform} wheels
This extends the mechanism introduced in #1091 for `abi3` wheels.
Most of the mentions to `abi3` have been removed and replaced by a more generic `compatible_wheel`.
This allows to build a wheel `foo-0.1-py3-none-win_amd64.whl` only once and still test with every configured python.
2022-06-26 11:31:59 +02:00
Joe Rickerby 4e7a94ecad Merge pull request #1149 from pypa/pip-option-doc
Document use of pip options through environment variables
2022-06-25 17:57:31 +01:00
Joe Rickerby 7abdc0666d Merge pull request #1156 from pypa/update-dependencies-pr
[Bot] Update dependencies
2022-06-25 17:31:14 +01:00
joncrall 65d70682af have doctest use a pinned docker images 2022-06-23 11:08:09 -04:00
joncrall 9c188d7555 Merge branch 'new_podman_support' of github.com:Erotemic/cibuildwheel into new_podman_support 2022-06-23 11:03:15 -04:00
joncrall 08bf6bfc8b Fix bad fmtstring 2022-06-23 11:03:09 -04:00
pre-commit-ci[bot] 8dd76aaad7 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-06-23 15:01:00 +00:00
joncrall df317a9000 Flattened podman support commits 2022-06-23 11:00:10 -04:00
cibuildwheel-bot[bot] 68aef79a9b Update dependencies 2022-06-20 06:59:44 +00:00
Joe Rickerby c3750edebb Document use of pip options through environment variables 2022-06-19 10:45:07 +01:00
Joe Rickerby 0bf4f7abc3 Merge pull request #1135 from abitrolly/patch-1
Update GitHub Action examples
2022-06-19 09:54:31 +01:00
Anatoli Babenia c4bfbe2ef1 Clarify download action and why name: artifact is required
https://github.com/pypa/cibuildwheel/pull/1135#pullrequestreview-1007698747
2022-06-18 15:46:08 +03:00
Anatoli Babenia 6994d9be4f Document config-file, and add with: into example
https://github.com/pypa/cibuildwheel/blob/main/action.yml
2022-06-18 15:27:16 +03:00
Anatoli Babenia 52945e1668 Update to latest GitHub Action versions
checkout@v2 -> v3
  upload/download-artifact@v2 -> v3
  python-setup@v2 -> v3
  pypa/gh-action-pypi-publish@1.4.2 -> v1.5.0

Python latest is v4, but it breaks working with default Python version
https://github.com/actions/setup-python/issues/421
2022-06-18 15:09:36 +03:00
Joe Rickerby cc56a140d2 Bump version: v2.7.0 2022-06-17 19:33:39 +01:00
Joe Rickerby cdccbd1c46 Merge remote-tracking branch 'origin/main' into henryiii/refactor/namespace 2022-06-17 18:08:17 +01:00
Joe Rickerby 133197e81b Merge pull request #1026 from mayeut/manylinux_2_28
feature: add manylinux_2_28 support
2022-06-17 17:34:00 +01:00
Joe Rickerby 2bc52972e3 Merge pull request #1117 from Darandos/linux-on-windows
Fix Linux builds on Windows
2022-06-17 17:26:13 +01:00
Joe Rickerby c022fa33c0 Merge pull request #1129 from dlech/patch-1
fix overwriting wheel on macos
2022-06-17 16:55:12 +01:00
mayeut 6458604c99 feature: add manylinux_2_28 support 2022-06-16 21:30:29 +02:00
David Lechner 9f4303ba2c use FileNotFoundError instead of OSError 2022-06-16 10:40:48 -05:00
David Lechner e6513a9b28 use Path.unlink() instead of os.unlink() 2022-06-16 10:39:05 -05:00
Joe Rickerby f1c2d6c4f9 Merge pull request #1133 from pypa/update-dependencies-pr
[Bot] Update dependencies
2022-06-16 14:00:46 +01:00
Joe Rickerby cd7ea913e6 Merge pull request #1138 from nitzmahone/prerelease_python_test_fix
ensure tests run on prerelease Pythons
2022-06-15 21:37:31 +01:00
cibuildwheel-bot[bot] de0a9b33e7 Update dependencies 2022-06-15 15:13:22 +00:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> 1d614c2b30 [pre-commit.ci] pre-commit autoupdate (#1136)
updates:
- [github.com/pre-commit/pre-commit-hooks: v4.2.0 → v4.3.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.2.0...v4.3.0)
- [github.com/asottile/pyupgrade: v2.32.1 → v2.34.0](https://github.com/asottile/pyupgrade/compare/v2.32.1...v2.34.0)
- [github.com/pre-commit/mirrors-mypy: v0.960 → v0.961](https://github.com/pre-commit/mirrors-mypy/compare/v0.960...v0.961)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-06-15 11:09:15 -04:00
Joe Rickerby 860b14fd70 Refactor class hierarchy
Removes unnecessary overlap in functionality
2022-06-15 10:12:46 +01:00
Matt Davis 4bffaccc7c ensure tests run on prerelease Pythons 2022-06-13 13:59:07 -07:00
David Lechner 526c5543e5 fix overwriting wheel on macos
When I run on macOS, I get the following error:

```
Traceback (most recent call last):
  File "/Users/david/.local/pipx/.cache/fd54e06d50697e7/bin/cibuildwheel", line 8, in <module>
    sys.exit(main())
  File "/Users/david/.local/pipx/.cache/fd54e06d50697e7/lib/python3.10/site-packages/cibuildwheel/__main__.py", line 128, in main
    build_in_directory(args)
  File "/Users/david/.local/pipx/.cache/fd54e06d50697e7/lib/python3.10/site-packages/cibuildwheel/__main__.py", line 252, in build_in_directory
    cibuildwheel.macos.build(options, tmp_path)
  File "/Users/david/.local/pipx/.cache/fd54e06d50697e7/lib/python3.10/site-packages/cibuildwheel/macos.py", line 538, in build
    shutil.move(str(repaired_wheel), build_options.output_dir)
  File "/opt/homebrew/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 811, in move
    raise Error("Destination path '%s' already exists" % real_dst)
shutil.Error: Destination path '/Users/david/Documents/GitHub/python-mpy-cross/wheelhouse/mpy_cross_v5-1.0.0-py3-none-macosx_11_0_arm64.whl' already exists
```

The comment in the code says that it should overwrite the file, so this removes the file if it exists first before trying to move the file.
2022-06-09 12:21:42 -05:00
Joe Rickerby aa753429b2 Bump version: v2.6.1 2022-06-07 09:14:16 +01:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 45227e53e7 chore(deps): bump pre-commit/action from 2.0.3 to 3.0.0 (#1127)
Bumps [pre-commit/action](https://github.com/pre-commit/action) from 2.0.3 to 3.0.0.
- [Release notes](https://github.com/pre-commit/action/releases)
- [Commits](https://github.com/pre-commit/action/compare/v2.0.3...v3.0.0)

---
updated-dependencies:
- dependency-name: pre-commit/action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-06 18:56:34 +02:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> 0be10361af [pre-commit.ci] pre-commit autoupdate (#1120)
updates:
- [github.com/pre-commit/mirrors-mypy: v0.950 → v0.960](https://github.com/pre-commit/mirrors-mypy/compare/v0.950...v0.960)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-06-06 18:55:06 +02:00
cibuildwheel-bot[bot]andcibuildwheel-bot[bot] <83877280+cibuildwheel-bot[bot]@users.noreply.github.com> a440ab3655 [Bot] Update dependencies (#1119)
Update dependencies

Co-authored-by: cibuildwheel-bot[bot] <83877280+cibuildwheel-bot[bot]@users.noreply.github.com>
2022-06-06 15:53:13 +02:00
Matthieu Darbois c5c1766614 ci: disable travis-ci output timeout (#1123) 2022-06-04 20:03:02 +02:00
Robert Martin 5d439c0f38 Fix a Pylint warning 2022-05-25 18:04:54 -06:00
Robert Martin 9ab89f92c0 Fix Linux builds on Windows 2022-05-24 17:35:46 -06:00
Henry Schreiner 98fedb7e51 refactor: use dataclasses vs. NamedTuples 2022-04-28 11:41:47 -04:00
70 changed files with 1544 additions and 894 deletions
-3
View File
@@ -5,6 +5,3 @@ updates:
directory: "/"
schedule:
interval: "weekly"
ignore:
- dependency-name: "actions/*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]
+21 -5
View File
@@ -20,8 +20,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v2.0.3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/action@v3.0.0
- name: Check manifest
run: pipx run nox -s check_manifest
- name: PyLint checks
@@ -40,11 +42,23 @@ jobs:
timeout-minutes: 180
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4
name: Install Python ${{ matrix.python_version }}
with:
python-version: ${{ matrix.python_version }}
# Install podman on this CI instance for podman tests on linux
# Snippet from: https://github.com/redhat-actions/podman-login/blob/main/.github/workflows/example.yml
- name: Install latest podman
if: runner.os == 'Linux'
run: |
. /etc/os-release
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
curl -sSfL "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add -
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install podman
- name: Install dependencies
run: |
python -m pip install ".[test]"
@@ -68,7 +82,7 @@ jobs:
- name: Test cibuildwheel
run: |
python ./bin/run_tests.py
python ./bin/run_tests.py --run-podman
test-emulated:
name: Test emulated cibuildwheel using qemu
@@ -77,7 +91,9 @@ jobs:
timeout-minutes: 180
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install ".[test]"
+1 -1
View File
@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11-dev"
- uses: excitedleigh/setup-nox@v2.1.0
+6 -5
View File
@@ -1,7 +1,7 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.3.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
@@ -14,7 +14,7 @@ repos:
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v2.32.1
rev: v2.34.0
hooks:
- id: pyupgrade
name: PyUpgrade 3.6+
@@ -27,7 +27,7 @@ repos:
# Autoremoves unused imports
- repo: https://github.com/hadialqattan/pycln
rev: v1.3.3
rev: v1.3.5
hooks:
- id: pycln
args: [--all]
@@ -39,7 +39,7 @@ repos:
- id: isort
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 22.6.0
hooks:
- id: black
@@ -49,7 +49,7 @@ repos:
- id: setup-cfg-fmt
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.950
rev: v0.961
hooks:
- id: mypy
name: mypy 3.6 on cibuildwheel/
@@ -61,6 +61,7 @@ repos:
- pygithub
- rich
- tomli
- tomli_w
- types-certifi
- types-click
- types-dataclasses
+8 -1
View File
@@ -52,4 +52,11 @@ install:
- $PYTHON -m pip install -U pip
- $PYTHON -m pip install -e ".[dev]" pytest-custom-exit-code
script: $PYTHON ./bin/run_tests.py
script: |
# travis_wait disable the output while waiting
# use the same kind of tricks as in multibuild
(while true; do echo "travis_keep_alive"; sleep 300; done) &
SPINNER_PID=$!
disown
$PYTHON ./bin/run_tests.py
kill -9 ${SPINNER_PID}
+33 -41
View File
@@ -83,13 +83,13 @@ jobs:
os: [ubuntu-20.04, windows-2019, macOS-10.15]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
# Used to host cibuildwheel
- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.6.0
run: python -m pip install cibuildwheel==2.8.0
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
@@ -97,7 +97,7 @@ jobs:
# env:
# CIBW_SOME_OPTION: value
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
```
@@ -130,6 +130,7 @@ Options
| | [`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 built wheel |
| | [`CIBW_MANYLINUX_*_IMAGE`<br/>`CIBW_MUSLLINUX_*_IMAGE`](https://cibuildwheel.readthedocs.io/en/stable/options/#linux-image) | Specify alternative manylinux / musllinux Docker images |
| | [`CIBW_CONTAINER_ENGINE`](https://cibuildwheel.readthedocs.io/en/stable/options/#container-engine) | Specify which container engine to use when building Linux wheels |
| | [`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 |
| | [`CIBW_BEFORE_TEST`](https://cibuildwheel.readthedocs.io/en/stable/options/#before-test) | Execute a shell command before testing each wheel |
@@ -152,23 +153,23 @@ Here are some repos that use cibuildwheel.
| Name | CI | OS | Notes |
|-----------------------------------|----|----|:------|
| [scikit-learn][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | The machine learning library. A complex but clean config using many of cibuildwheel's features to build a large project with Cython and C++ extensions. |
| [Tornado][] | ![travisci icon][] | ![apple icon][] ![linux icon][] | Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed. |
| [NumPy][] | ![github icon][] ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | The fundamental package for scientific computing with Python. |
| [Tornado][] | ![travisci icon][] | ![apple icon][] ![linux icon][] | Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed. |
| [pytorch-fairseq][] | ![github icon][] | ![apple icon][] ![linux icon][] | Facebook AI Research Sequence-to-Sequence Toolkit written in Python. |
| [Matplotlib][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | The venerable Matplotlib, a Python library with C++ portions |
| [Kivy][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS |
| [NCNN][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | ncnn is a high-performance neural network inference framework optimized for the mobile platform |
| [Kivy][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS |
| [Prophet][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth. |
| [MyPy][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | The compiled version of MyPy using MyPyC. |
| [pydantic][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Data parsing and validation using Python type hints |
[scikit-learn]: https://github.com/scikit-learn/scikit-learn
[Tornado]: https://github.com/tornadoweb/tornado
[NumPy]: https://github.com/numpy/numpy
[Tornado]: https://github.com/tornadoweb/tornado
[pytorch-fairseq]: https://github.com/pytorch/fairseq
[Matplotlib]: https://github.com/matplotlib/matplotlib
[Kivy]: https://github.com/kivy/kivy
[NCNN]: https://github.com/Tencent/ncnn
[Kivy]: https://github.com/kivy/kivy
[Prophet]: https://github.com/facebook/prophet
[MyPy]: https://github.com/mypyc/mypy_mypyc-wheels
[pydantic]: https://github.com/samuelcolvin/pydantic
@@ -203,6 +204,30 @@ Changelog
<!-- this section was generated by bin/update_readme_changelog.py -- do not edit manually -->
### v2.8.0
_5 July 2022_
- ✨ You can now run cibuildwheel on Podman, as an alternate container engine to Docker, which remains the default. This is useful in environments where a Docker daemon isn't available, for example, it can be run inside a Docker container, or without root access. To use Podman, set the [`CIBW_CONTAINER_ENGINE`](https://cibuildwheel.readthedocs.io/en/stable/options/#container-engine) option. (#966)
- ✨ Adds support for building `py3-none-{platform}` wheels. These wheels contain native extension code, but don't use the Python APIs. Typically, they're bridged to Python using a FFI module like [ctypes](https://docs.python.org/3/library/ctypes.html) or [cffi](https://cffi.readthedocs.io/en/latest/). Because they don't use Python ABI, the wheels are more compatible - they work across many Python versions. Check out this [example ctypes project](https://github.com/joerick/python-ctypes-package-sample) to see an example of how it works. (#1151)
- 🛠 cibuildwheel will now error if multiple builds in a single run produce the same wheel filename, as this indicates a misconfiguration. (#1152)
- 📚 A few docs improvements and updates to keep things up-to-date.
### v2.7.0
_17 June 2022_
- 🌟 Added support for the new `manylinux_2_28` images. These new images are based on AlmaLinux, the community-driven successor to CentOS, unlike manylinux_2_24, which was based on Debian. To build on these images, set your [`CIBW_MANYLINUX_*_IMAGE`](https://cibuildwheel.readthedocs.io/en/stable/options/#linux-image) option to `manylinux_2_28`. (#1026)
- 🐛 Fix a bug where tests were not being run on CPython 3.11 (when CIBW_PRERELEASE_PYTHONS was set) (#1138)
- ✨ You can now build Linux wheels on Windows, as long as you have Docker installed and set to 'Linux containers' (#1117)
- 🐛 Fix a bug on macOS that caused cibuildwheel to crash trying to overwrite a previously-built wheel of the same name. (#1129)
### v2.6.1
_7 June 2022_
- 🛠 Update the prerelease CPython 3.11 to 3.11.0b3
### v2.6.0
_25 May 2022_
@@ -220,39 +245,6 @@ _29 April 2022_
- 🐛 Workaround a permissions issue on Linux relating to newer versions of git and setuptools_scm (#1095)
- 📚 Minor docs improvements
### v2.4.0
_2 April 2022_
- ✨ cibuildwheel now supports running locally on Windows and macOS (as well as Linux). On macOS, you'll have to install the versions of Pythons that you want to use from Python.org, and cibuildwheel will use them. On Windows, cibuildwheel will install it's own versions of Python. Check out [the documentation](https://cibuildwheel.readthedocs.io/en/stable/setup/#local) for instructions. (#974)
- ✨ Added support for building PyPy 3.9 wheels. (#1031)
- ✨ Listing at the end of the build now displays the size of each wheel (#975)
- 🐛 Workaround a connection timeout bug on Travis CI ppc64le runners (#906)
- 🐛 Fix an encoding error when reading setup.py in the wrong encoding (#977)
- 🛠 Setuptools updated to 61.3.0, including experimental support for reading config from pyproject.toml(PEP 621). This could change the behaviour of your build if you have a pyproject.toml with a `[project]` table, because that takes precedence over setup.py and setup.cfg. Check out the [setuptools docs](https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html) and the [project metadata specification](https://packaging.python.org/en/latest/specifications/declaring-project-metadata/) for more info.
- 🛠 Many other dependency updates.
- 📚 Minor docs improvements
### v2.3.1
_14 December 2021_
- 🐛 Setting pip options like `PIP_USE_DEPRECATED` in `CIBW_ENVIRONMENT` no longer adversely affects cibuildwheel's ability to set up a Python environment (#956)
- 📚 Docs fixes and improvements
### v2.3.0
_26 November 2021_
- 📈 cibuildwheel now defaults to manylinux2014 image for linux builds, rather than manylinux2010. If you want to stick with manylinux2010, it's simple to set this using [the image options](https://cibuildwheel.readthedocs.io/en/stable/options/#linux-image). (#926)
- ✨ You can now pass environment variables from the host machine into the Docker container during a Linux build. Check out [the docs for `CIBW_ENVIRONMENT_PASS_LINUX `](https://cibuildwheel.readthedocs.io/en/latest/options/#environment-pass) for the details. (#914)
- ✨ Added support for building PyPy 3.8 wheels. (#881)
- ✨ Added support for building Windows arm64 CPython wheels on a Windows arm64 runner. We can't test this in CI yet, so for now, this is experimental. (#920)
- 📚 Improved the deployment documentation (#911)
- 🛠 Changed the escaping behaviour inside cibuildwheel's option placeholders e.g. `{project}` in `before_build` or `{dest_dir}` in `repair_wheel_command`. This allows bash syntax like `${SOME_VAR}` to passthrough without being interpreted as a placeholder by cibuildwheel. See [this section](https://cibuildwheel.readthedocs.io/en/stable/options/#placeholders) in the docs for more info. (#889)
- 🛠 Pip updated to 21.3, meaning it now defaults to in-tree builds again. If this causes an issue with your project, setting environment variable `PIP_USE_DEPRECATED=out-of-tree-build` is available as a temporary flag to restore the old behaviour. However, be aware that this flag will probably be removed soon. (#881)
- 🐛 You can now access the current Python interpreter using `python3` within a build on Windows (#917)
<!-- END bin/update_readme_changelog.py -->
---
+1 -1
View File
@@ -184,7 +184,7 @@ def bump_version() -> None:
print()
release_url = "https://github.com/pypa/cibuildwheel/releases/new?" + urllib.parse.urlencode(
{"tag": new_version}
{"tag": f"v{new_version}"}
)
print("Then create a release at the URL:")
print(f" {release_url}")
+31 -17
View File
@@ -1,33 +1,47 @@
#!/usr/bin/env python3
import argparse
import os
import subprocess
import sys
from pathlib import Path
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--run-podman", action="store_true", default=False, help="run podman tests (linux only)"
)
args = parser.parse_args()
# move cwd to the project root
os.chdir(Path(__file__).resolve().parents[1])
# run the unit tests
# unit tests
unit_test_args = [sys.executable, "-m", "pytest", "unit_test"]
# run the docker unit tests only on Linux
if sys.platform.startswith("linux"):
# run the docker unit tests only on Linux
unit_test_args += ["--run-docker"]
if args.run_podman:
unit_test_args += ["--run-podman"]
subprocess.run(unit_test_args, check=True)
# run the integration tests
subprocess.run(
[
sys.executable,
"-m",
"pytest",
"--numprocesses=2",
"-x",
"--durations",
"0",
"--timeout=2400",
"test",
],
check=True,
)
# integration tests
integration_test_args = [
sys.executable,
"-m",
"pytest",
"--numprocesses=2",
"-x",
"--durations",
"0",
"--timeout=2400",
"test",
]
if sys.platform.startswith("linux") and args.run_podman:
integration_test_args += ["--run-podman"]
subprocess.run(integration_test_args, check=True)
+9 -2
View File
@@ -2,8 +2,8 @@
from __future__ import annotations
import configparser
from dataclasses import dataclass
from pathlib import Path
from typing import NamedTuple
import requests
@@ -11,7 +11,8 @@ DIR = Path(__file__).parent.resolve()
RESOURCES = DIR.parent / "cibuildwheel/resources"
class Image(NamedTuple):
@dataclass(frozen=True)
class Image:
manylinux_version: str
platform: str
image_name: str
@@ -45,6 +46,12 @@ images = [
Image("manylinux_2_24", "pypy_x86_64", "quay.io/pypa/manylinux_2_24_x86_64", None),
Image("manylinux_2_24", "pypy_i686", "quay.io/pypa/manylinux_2_24_i686", None),
Image("manylinux_2_24", "pypy_aarch64", "quay.io/pypa/manylinux_2_24_aarch64", None),
# manylinux_2_28 images
Image("manylinux_2_28", "x86_64", "quay.io/pypa/manylinux_2_28_x86_64", None),
Image("manylinux_2_28", "aarch64", "quay.io/pypa/manylinux_2_28_aarch64", None),
Image("manylinux_2_28", "ppc64le", "quay.io/pypa/manylinux_2_28_ppc64le", None),
Image("manylinux_2_28", "pypy_x86_64", "quay.io/pypa/manylinux_2_28_x86_64", None),
Image("manylinux_2_28", "pypy_aarch64", "quay.io/pypa/manylinux_2_28_aarch64", None),
# musllinux_1_1 images
Image("musllinux_1_1", "x86_64", "quay.io/pypa/musllinux_1_1_x86_64", None),
Image("musllinux_1_1", "i686", "quay.io/pypa/musllinux_1_1_i686", None),
+3 -2
View File
@@ -6,8 +6,8 @@ import difflib
import logging
import subprocess
import sys
from dataclasses import dataclass
from pathlib import Path
from typing import NamedTuple
import click
import rich
@@ -36,7 +36,8 @@ GET_VIRTUALENV_URL_TEMPLATE: Final[
] = f"{GET_VIRTUALENV_GITHUB}/blob/{{version}}/public/virtualenv.pyz?raw=true"
class VersionTuple(NamedTuple):
@dataclass(frozen=True)
class VersionTuple:
version: Version
version_string: str
+1 -1
View File
@@ -1 +1 @@
__version__ = "2.6.0"
__version__ = "2.8.0"
+3 -4
View File
@@ -46,7 +46,7 @@ def main() -> None:
auto-detected platform or to run cibuildwheel on your development
machine. Specifying "macos" or "windows" only works on that
operating system, but "linux" works on all three, as long as
Docker is installed. Default: auto.
Docker/Podman is installed. Default: auto.
""",
)
@@ -91,7 +91,7 @@ def main() -> None:
Path to the package that you want wheels for. Default: the working
directory. Can be a directory inside the working directory, or an
sdist. When set to a directory, the working directory is still
considered the 'project' and is copied into the Docker container
considered the 'project' and is copied into the build container
on Linux. When set to a tar.gz sdist file, --config-file
and --output-dir are relative to the current directory, and other
paths are relative to the expanded SDist directory.
@@ -116,7 +116,7 @@ def main() -> None:
help="Enable pre-release Python versions if available.",
)
args = parser.parse_args(namespace=CommandLineArguments())
args = CommandLineArguments(**vars(parser.parse_args()))
args.package_dir = args.package_dir.resolve()
@@ -208,7 +208,6 @@ def build_in_directory(args: CommandLineArguments) -> None:
sys.exit(0)
# Add CIBUILDWHEEL environment variable
# This needs to be passed on to the docker container in linux.py
os.environ["CIBUILDWHEEL"] = "1"
# Python is buffering by default when running on the CI platforms, giving problems interleaving subprocess call output with unflushed calls to 'print'
+1 -1
View File
@@ -59,7 +59,7 @@ class Architecture(Enum):
result = {native_architecture}
if platform == "linux" and native_architecture == Architecture.x86_64:
# x86_64 machines can run i686 docker containers
# x86_64 machines can run i686 containers
result.add(Architecture.i686)
if platform == "windows" and native_architecture == Architecture.AMD64:
+4 -2
View File
@@ -1,5 +1,6 @@
import subprocess
from typing import Callable, Dict, List, NamedTuple, Optional, Sequence
from dataclasses import dataclass
from typing import Callable, Dict, List, Optional, Sequence
import bashlex
@@ -13,7 +14,8 @@ def local_environment_executor(command: List[str], env: Dict[str, str]) -> str:
).stdout
class NodeExecutionContext(NamedTuple):
@dataclass(frozen=True)
class NodeExecutionContext:
environment: Dict[str, str]
input: str
executor: EnvironmentExecutor
+94 -72
View File
@@ -1,38 +1,43 @@
import subprocess
import sys
import textwrap
from pathlib import Path, PurePath
from typing import Iterator, List, NamedTuple, Set, Tuple
from dataclasses import dataclass
from pathlib import Path, PurePath, PurePosixPath
from typing import Iterator, List, Set, Tuple
from .architecture import Architecture
from .docker_container import DockerContainer
from .logger import log
from .oci_container import OCIContainer
from .options import Options
from .typing import OrderedDict, PathOrStr, assert_never
from .util import (
AlreadyBuiltWheelError,
BuildSelector,
NonPlatformWheelError,
find_compatible_abi3_wheel,
find_compatible_wheel,
get_build_verbosity_extra_flags,
prepare_command,
read_python_configs,
unwrap,
)
class PythonConfiguration(NamedTuple):
@dataclass(frozen=True)
class PythonConfiguration:
version: str
identifier: str
path_str: str
@property
def path(self) -> PurePath:
return PurePath(self.path_str)
def path(self) -> PurePosixPath:
return PurePosixPath(self.path_str)
class BuildStep(NamedTuple):
@dataclass(frozen=True)
class BuildStep:
platform_configs: List[PythonConfiguration]
platform_tag: str
docker_image: str
container_image: str
def get_python_configurations(
@@ -54,7 +59,7 @@ def get_python_configurations(
]
def docker_image_for_python_configuration(config: PythonConfiguration, options: Options) -> str:
def container_image_for_python_configuration(config: PythonConfiguration, options: Options) -> str:
build_options = options.build_options(config.identifier)
# e.g
# identifier is 'cp310-manylinux_x86_64'
@@ -78,7 +83,7 @@ def get_build_steps(
) -> Iterator[BuildStep]:
"""
Groups PythonConfigurations into BuildSteps. Each BuildStep represents a
separate Docker container.
separate container instance.
"""
steps = OrderedDict[Tuple[str, str, str], BuildStep]()
@@ -86,32 +91,34 @@ def get_build_steps(
_, platform_tag = config.identifier.split("-", 1)
before_all = options.build_options(config.identifier).before_all
docker_image = docker_image_for_python_configuration(config, options)
container_image = container_image_for_python_configuration(config, options)
step_key = (platform_tag, docker_image, before_all)
step_key = (platform_tag, container_image, before_all)
if step_key in steps:
steps[step_key].platform_configs.append(config)
else:
steps[step_key] = BuildStep(
platform_configs=[config], platform_tag=platform_tag, docker_image=docker_image
platform_configs=[config],
platform_tag=platform_tag,
container_image=container_image,
)
yield from steps.values()
def build_on_docker(
def build_in_container(
*,
options: Options,
platform_configs: List[PythonConfiguration],
docker: DockerContainer,
container: OCIContainer,
container_project_path: PurePath,
container_package_dir: PurePath,
) -> None:
container_output_dir = PurePath("/output")
container_output_dir = PurePosixPath("/output")
log.step("Copying project into Docker...")
docker.copy_into(Path.cwd(), container_project_path)
log.step("Copying project into container...")
container.copy_into(Path.cwd(), container_project_path)
before_all_options_identifier = platform_configs[0].identifier
before_all_options = options.build_options(before_all_options_identifier)
@@ -119,11 +126,11 @@ def build_on_docker(
if before_all_options.before_all:
log.step("Running before_all...")
env = docker.get_environment()
env = container.get_environment()
env["PATH"] = f'/opt/python/cp38-cp38/bin:{env["PATH"]}'
env["PIP_DISABLE_PIP_VERSION_CHECK"] = "1"
env = before_all_options.environment.as_dictionary(
env, executor=docker.environment_executor
env, executor=container.environment_executor
)
before_all_prepared = prepare_command(
@@ -131,9 +138,9 @@ def build_on_docker(
project=container_project_path,
package=container_package_dir,
)
docker.call(["sh", "-c", before_all_prepared], env=env)
container.call(["sh", "-c", before_all_prepared], env=env)
built_wheels: List[PurePath] = []
built_wheels: List[PurePosixPath] = []
for config in platform_configs:
log.build_start(config.identifier)
@@ -147,43 +154,43 @@ def build_on_docker(
)
container_constraints_file = PurePath("/constraints.txt")
docker.copy_into(constraints_file, container_constraints_file)
container.copy_into(constraints_file, container_constraints_file)
dependency_constraint_flags = ["-c", container_constraints_file]
log.step("Setting up build environment...")
env = docker.get_environment()
env = container.get_environment()
# put this config's python top of the list
python_bin = config.path / "bin"
env["PATH"] = f'{python_bin}:{env["PATH"]}'
env = build_options.environment.as_dictionary(env, executor=docker.environment_executor)
env = build_options.environment.as_dictionary(env, executor=container.environment_executor)
# check config python is still on PATH
which_python = docker.call(["which", "python"], env=env, capture_output=True).strip()
if PurePath(which_python) != python_bin / "python":
which_python = container.call(["which", "python"], env=env, capture_output=True).strip()
if PurePosixPath(which_python) != python_bin / "python":
print(
"cibuildwheel: python available on PATH doesn't match our installed instance. If you have modified PATH, ensure that you don't overwrite cibuildwheel's entry or insert python above it.",
file=sys.stderr,
)
sys.exit(1)
which_pip = docker.call(["which", "pip"], env=env, capture_output=True).strip()
if PurePath(which_pip) != python_bin / "pip":
which_pip = container.call(["which", "pip"], env=env, capture_output=True).strip()
if PurePosixPath(which_pip) != python_bin / "pip":
print(
"cibuildwheel: pip available on PATH doesn't match our installed instance. If you have modified PATH, ensure that you don't overwrite cibuildwheel's entry or insert pip above it.",
file=sys.stderr,
)
sys.exit(1)
abi3_wheel = find_compatible_abi3_wheel(built_wheels, config.identifier)
if abi3_wheel:
compatible_wheel = find_compatible_wheel(built_wheels, config.identifier)
if compatible_wheel:
log.step_end()
print(
f"\nFound previously built wheel {abi3_wheel.name}, that's compatible with {config.identifier}. Skipping build step..."
f"\nFound previously built wheel {compatible_wheel.name}, that's compatible with {config.identifier}. Skipping build step..."
)
repaired_wheels = [abi3_wheel]
repaired_wheels = [compatible_wheel]
else:
if build_options.before_build:
@@ -193,19 +200,19 @@ def build_on_docker(
project=container_project_path,
package=container_package_dir,
)
docker.call(["sh", "-c", before_build_prepared], env=env)
container.call(["sh", "-c", before_build_prepared], env=env)
log.step("Building wheel...")
temp_dir = PurePath("/tmp/cibuildwheel")
temp_dir = PurePosixPath("/tmp/cibuildwheel")
built_wheel_dir = temp_dir / "built_wheel"
docker.call(["rm", "-rf", built_wheel_dir])
docker.call(["mkdir", "-p", built_wheel_dir])
container.call(["rm", "-rf", built_wheel_dir])
container.call(["mkdir", "-p", built_wheel_dir])
verbosity_flags = get_build_verbosity_extra_flags(build_options.build_verbosity)
if build_options.build_frontend == "pip":
docker.call(
container.call(
[
"python",
"-m",
@@ -220,7 +227,7 @@ def build_on_docker(
)
elif build_options.build_frontend == "build":
config_setting = " ".join(verbosity_flags)
docker.call(
container.call(
[
"python",
"-m",
@@ -235,11 +242,11 @@ def build_on_docker(
else:
assert_never(build_options.build_frontend)
built_wheel = docker.glob(built_wheel_dir, "*.whl")[0]
built_wheel = container.glob(built_wheel_dir, "*.whl")[0]
repaired_wheel_dir = temp_dir / "repaired_wheel"
docker.call(["rm", "-rf", repaired_wheel_dir])
docker.call(["mkdir", "-p", repaired_wheel_dir])
container.call(["rm", "-rf", repaired_wheel_dir])
container.call(["mkdir", "-p", repaired_wheel_dir])
if built_wheel.name.endswith("none-any.whl"):
raise NonPlatformWheelError()
@@ -249,21 +256,27 @@ def build_on_docker(
repair_command_prepared = prepare_command(
build_options.repair_command, wheel=built_wheel, dest_dir=repaired_wheel_dir
)
docker.call(["sh", "-c", repair_command_prepared], env=env)
container.call(["sh", "-c", repair_command_prepared], env=env)
else:
docker.call(["mv", built_wheel, repaired_wheel_dir])
container.call(["mv", built_wheel, repaired_wheel_dir])
repaired_wheels = docker.glob(repaired_wheel_dir, "*.whl")
repaired_wheels = container.glob(repaired_wheel_dir, "*.whl")
for repaired_wheel in repaired_wheels:
if repaired_wheel.name in {wheel.name for wheel in built_wheels}:
raise AlreadyBuiltWheelError(repaired_wheel.name)
if build_options.test_command and build_options.test_selector(config.identifier):
log.step("Testing wheel...")
# set up a virtual environment to install and test from, to make sure
# there are no dependencies that were pulled in at build time.
docker.call(["pip", "install", "virtualenv", *dependency_constraint_flags], env=env)
venv_dir = PurePath(docker.call(["mktemp", "-d"], capture_output=True).strip()) / "venv"
container.call(["pip", "install", "virtualenv", *dependency_constraint_flags], env=env)
venv_dir = (
PurePath(container.call(["mktemp", "-d"], capture_output=True).strip()) / "venv"
)
docker.call(["python", "-m", "virtualenv", "--no-download", venv_dir], env=env)
container.call(["python", "-m", "virtualenv", "--no-download", venv_dir], env=env)
virtualenv_env = env.copy()
virtualenv_env["PATH"] = f"{venv_dir / 'bin'}:{virtualenv_env['PATH']}"
@@ -274,7 +287,7 @@ def build_on_docker(
project=container_project_path,
package=container_package_dir,
)
docker.call(["sh", "-c", before_test_prepared], env=virtualenv_env)
container.call(["sh", "-c", before_test_prepared], env=virtualenv_env)
# Install the wheel we just built
# Note: If auditwheel produced two wheels, it's because the earlier produced wheel
@@ -283,14 +296,14 @@ def build_on_docker(
# different external shared libraries. so it doesn't matter which one we run the tests on.
# Let's just pick the first one.
wheel_to_test = repaired_wheels[0]
docker.call(
container.call(
["pip", "install", str(wheel_to_test) + build_options.test_extras],
env=virtualenv_env,
)
# Install any requirements to run the tests
if build_options.test_requires:
docker.call(["pip", "install", *build_options.test_requires], env=virtualenv_env)
container.call(["pip", "install", *build_options.test_requires], env=virtualenv_env)
# Run the tests from a different directory
test_command_prepared = prepare_command(
@@ -298,15 +311,15 @@ def build_on_docker(
project=container_project_path,
package=container_package_dir,
)
docker.call(["sh", "-c", test_command_prepared], cwd="/root", env=virtualenv_env)
container.call(["sh", "-c", test_command_prepared], cwd="/root", env=virtualenv_env)
# clean up test environment
docker.call(["rm", "-rf", venv_dir])
container.call(["rm", "-rf", venv_dir])
# move repaired wheels to output
if abi3_wheel is None:
docker.call(["mkdir", "-p", container_output_dir])
docker.call(["mv", *repaired_wheels, container_output_dir])
if compatible_wheel is None:
container.call(["mkdir", "-p", container_output_dir])
container.call(["mv", *repaired_wheels, container_output_dir])
built_wheels.extend(
container_output_dir / repaired_wheel.name for repaired_wheel in repaired_wheels
)
@@ -315,19 +328,27 @@ def build_on_docker(
log.step("Copying wheels back to host...")
# copy the output back into the host
docker.copy_out(container_output_dir, options.globals.output_dir)
container.copy_out(container_output_dir, options.globals.output_dir)
log.step_end()
def build(options: Options, tmp_path: Path) -> None: # pylint: disable=unused-argument
try:
# check docker is installed
subprocess.run(["docker", "--version"], check=True, stdout=subprocess.DEVNULL)
# check the container engine is installed
subprocess.run(
[options.globals.container_engine, "--version"], check=True, stdout=subprocess.DEVNULL
)
except subprocess.CalledProcessError:
print(
"cibuildwheel: Docker not found. Docker is required to run Linux builds. "
"If you're building on Travis CI, add `services: [docker]` to your .travis.yml."
"If you're building on Circle CI in Linux, add a `setup_remote_docker` step to your .circleci/config.yml",
unwrap(
f"""
cibuildwheel: {options.globals.container_engine} not found. An
OCI exe like Docker or Podman is required to run Linux builds.
If you're building on Travis CI, add `services: [docker]` to
your .travis.yml. If you're building on Circle CI in Linux,
add a `setup_remote_docker` step to your .circleci/config.yml.
"""
),
file=sys.stderr,
)
sys.exit(2)
@@ -341,26 +362,27 @@ def build(options: Options, tmp_path: Path) -> None: # pylint: disable=unused-a
if cwd != abs_package_dir and cwd not in abs_package_dir.parents:
raise Exception("package_dir must be inside the working directory")
container_project_path = PurePath("/project")
container_project_path = PurePosixPath("/project")
container_package_dir = container_project_path / abs_package_dir.relative_to(cwd)
for build_step in get_build_steps(options, python_configurations):
try:
ids_to_build = [x.identifier for x in build_step.platform_configs]
log.step(
f"Starting Docker image {build_step.docker_image} for {', '.join(ids_to_build)}..."
)
log.step(f"Starting container image {build_step.container_image}...")
with DockerContainer(
docker_image=build_step.docker_image,
print(f"info: This container will host the build for {', '.join(ids_to_build)}...")
with OCIContainer(
image=build_step.container_image,
simulate_32_bit=build_step.platform_tag.endswith("i686"),
cwd=container_project_path,
) as docker:
engine=options.globals.container_engine,
) as container:
build_on_docker(
build_in_container(
options=options,
platform_configs=build_step.platform_configs,
docker=docker,
container=container,
container_project_path=container_project_path,
container_package_dir=container_package_dir,
)
+19 -8
View File
@@ -5,8 +5,9 @@ import re
import shutil
import subprocess
import sys
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, List, NamedTuple, Sequence, Set, Tuple, cast
from typing import Dict, List, Sequence, Set, Tuple, cast
from filelock import FileLock
@@ -17,13 +18,14 @@ from .options import Options
from .typing import Literal, PathOrStr, assert_never
from .util import (
CIBW_CACHE_PATH,
AlreadyBuiltWheelError,
BuildFrontend,
BuildSelector,
NonPlatformWheelError,
call,
detect_ci_provider,
download,
find_compatible_abi3_wheel,
find_compatible_wheel,
get_build_verbosity_extra_flags,
get_pip_version,
install_certifi_script,
@@ -54,7 +56,8 @@ def get_macos_sdks() -> List[str]:
return [m.group(1) for m in re.finditer(r"-sdk (macosx\S+)", output)]
class PythonConfiguration(NamedTuple):
@dataclass(frozen=True)
class PythonConfiguration:
version: str
identifier: str
url: str
@@ -321,13 +324,13 @@ def build(options: Options, tmp_path: Path) -> None:
build_options.build_frontend,
)
abi3_wheel = find_compatible_abi3_wheel(built_wheels, config.identifier)
if abi3_wheel:
compatible_wheel = find_compatible_wheel(built_wheels, config.identifier)
if compatible_wheel:
log.step_end()
print(
f"\nFound previously built wheel {abi3_wheel.name}, that's compatible with {config.identifier}. Skipping build step..."
f"\nFound previously built wheel {compatible_wheel.name}, that's compatible with {config.identifier}. Skipping build step..."
)
repaired_wheel = abi3_wheel
repaired_wheel = compatible_wheel
else:
if build_options.before_build:
log.step("Running before_build...")
@@ -408,6 +411,9 @@ def build(options: Options, tmp_path: Path) -> None:
repaired_wheel = next(repaired_wheel_dir.glob("*.whl"))
if repaired_wheel.name in {wheel.name for wheel in built_wheels}:
raise AlreadyBuiltWheelError(repaired_wheel.name)
log.step_end()
if build_options.test_command and build_options.test_selector(config.identifier):
@@ -534,7 +540,12 @@ def build(options: Options, tmp_path: Path) -> None:
)
# we're all done here; move it to output (overwrite existing)
if abi3_wheel is None:
if compatible_wheel is None:
try:
(build_options.output_dir / repaired_wheel.name).unlink()
except FileNotFoundError:
pass
shutil.move(str(repaired_wheel), build_options.output_dir)
built_wheels.append(build_options.output_dir / repaired_wheel.name)
@@ -3,28 +3,42 @@ import json
import os
import platform
import shlex
import shutil
import subprocess
import sys
import uuid
from pathlib import Path, PurePath
from pathlib import Path, PurePath, PurePosixPath
from types import TracebackType
from typing import IO, Dict, List, Optional, Sequence, Type, cast
from cibuildwheel.util import CIProvider, detect_ci_provider
from .typing import PathOrStr, PopenBytes
from .typing import Literal, PathOrStr, PopenBytes
ContainerEngine = Literal["docker", "podman"]
class DockerContainer:
class OCIContainer:
"""
An object that represents a running Docker container.
An object that represents a running OCI (e.g. Docker) container.
Intended for use as a context manager e.g.
`with DockerContainer(docker_image = 'ubuntu') as docker:`
`with OCIContainer(image = 'ubuntu') as docker:`
A bash shell is running in the remote container. When `call()` is invoked,
the command is relayed to the remote shell, and the results are streamed
back to cibuildwheel.
Example:
>>> from cibuildwheel.oci_container import * # NOQA
>>> from cibuildwheel.options import _get_pinned_container_images
>>> image = _get_pinned_container_images()['x86_64']['manylinux2014']
>>> # Test the default container
>>> with OCIContainer(image=image) as self:
... self.call(["echo", "hello world"])
... self.call(["cat", "/proc/1/cgroup"])
... print(self.get_environment())
... print(self.debug_info())
"""
UTILITY_PYTHON = "/opt/python/cp38-cp38/bin/python"
@@ -34,19 +48,25 @@ class DockerContainer:
bash_stdout: IO[bytes]
def __init__(
self, *, docker_image: str, simulate_32_bit: bool = False, cwd: Optional[PathOrStr] = None
self,
*,
image: str,
simulate_32_bit: bool = False,
cwd: Optional[PathOrStr] = None,
engine: ContainerEngine = "docker",
):
if not docker_image:
raise ValueError("Must have a non-empty docker image to run.")
if not image:
raise ValueError("Must have a non-empty image to run.")
self.docker_image = docker_image
self.image = image
self.simulate_32_bit = simulate_32_bit
self.cwd = cwd
self.name: Optional[str] = None
self.engine = engine
def __enter__(self) -> "OCIContainer":
def __enter__(self) -> "DockerContainer":
self.name = f"cibuildwheel-{uuid.uuid4()}"
cwd_args = ["-w", str(self.cwd)] if self.cwd else []
# work-around for Travis-CI PPC64le Docker runs since 2021:
# this avoids network splits
@@ -57,24 +77,25 @@ class DockerContainer:
network_args = ["--network=host"]
shell_args = ["linux32", "/bin/bash"] if self.simulate_32_bit else ["/bin/bash"]
subprocess.run(
[
"docker",
self.engine,
"create",
"--env=CIBUILDWHEEL",
f"--name={self.name}",
"--interactive",
"--volume=/:/host", # ignored on CircleCI
*network_args,
*cwd_args,
self.docker_image,
self.image,
*shell_args,
],
check=True,
)
self.process = subprocess.Popen(
[
"docker",
self.engine,
"start",
"--attach",
"--interactive",
@@ -89,7 +110,13 @@ class DockerContainer:
self.bash_stdout = self.process.stdout
# run a noop command to block until the container is responding
self.call(["/bin/true"])
self.call(["/bin/true"], cwd="/")
if self.cwd:
# Although `docker create -w` does create the working dir if it
# does not exist, podman does not. There does not seem to be a way
# to setup a workdir for a container running in podman.
self.call(["mkdir", "-p", os.fspath(self.cwd)], cwd="/")
return self
@@ -106,10 +133,19 @@ class DockerContainer:
self.bash_stdin.close()
self.bash_stdout.close()
if self.engine == "podman":
# This works around what seems to be a race condition in the podman
# backend. The full reason is not understood. See PR #966 for a
# discussion on possible causes and attempts to remove this line.
# For now, this seems to work "well enough".
self.process.wait()
assert isinstance(self.name, str)
subprocess.run(
["docker", "rm", "--force", "-v", self.name], stdout=subprocess.DEVNULL, check=False
[self.engine, "rm", "--force", "-v", self.name],
stdout=subprocess.DEVNULL,
check=False,
)
self.name = None
@@ -122,44 +158,80 @@ class DockerContainer:
if from_path.is_dir():
self.call(["mkdir", "-p", to_path])
subprocess.run(
f"tar cf - . | docker exec -i {self.name} tar --no-same-owner -xC {shell_quote(to_path)} -f -",
f"tar cf - . | {self.engine} exec -i {self.name} tar --no-same-owner -xC {shell_quote(to_path)} -f -",
shell=True,
check=True,
cwd=from_path,
)
else:
subprocess.run(
f'cat {shell_quote(from_path)} | docker exec -i {self.name} sh -c "cat > {shell_quote(to_path)}"',
shell=True,
check=True,
)
with subprocess.Popen(
[
self.engine,
"exec",
"-i",
str(self.name),
"sh",
"-c",
f"cat > {shell_quote(to_path)}",
],
stdin=subprocess.PIPE,
) as exec_process:
exec_process.stdin = cast(IO[bytes], exec_process.stdin)
with open(from_path, "rb") as from_file:
shutil.copyfileobj(from_file, exec_process.stdin)
exec_process.stdin.close()
exec_process.wait()
if exec_process.returncode:
raise subprocess.CalledProcessError(
exec_process.returncode, exec_process.args, None, None
)
def copy_out(self, from_path: PurePath, to_path: Path) -> None:
# note: we assume from_path is a dir
to_path.mkdir(parents=True, exist_ok=True)
subprocess.run(
f"docker exec -i {self.name} tar -cC {shell_quote(from_path)} -f - . | tar -xf -",
shell=True,
check=True,
cwd=to_path,
)
if self.engine == "podman":
subprocess.run(
[
self.engine,
"cp",
f"{self.name}:{from_path}/.",
str(to_path),
],
check=True,
cwd=to_path,
)
elif self.engine == "docker":
# There is a bug in docker that prevents a simple 'cp' invocation
# from working https://github.com/moby/moby/issues/38995
command = f"{self.engine} exec -i {self.name} tar -cC {shell_quote(from_path)} -f - . | tar -xf -"
subprocess.run(
command,
shell=True,
check=True,
cwd=to_path,
)
else:
raise KeyError(self.engine)
def glob(self, path: PurePath, pattern: str) -> List[PurePath]:
glob_pattern = os.path.join(str(path), pattern)
def glob(self, path: PurePosixPath, pattern: str) -> List[PurePosixPath]:
glob_pattern = path.joinpath(pattern)
path_strings = json.loads(
self.call(
[
self.UTILITY_PYTHON,
"-c",
f"import sys, json, glob; json.dump(glob.glob({glob_pattern!r}), sys.stdout)",
f"import sys, json, glob; json.dump(glob.glob({str(glob_pattern)!r}), sys.stdout)",
],
capture_output=True,
)
)
return [PurePath(p) for p in path_strings]
return [PurePosixPath(p) for p in path_strings]
def call(
self,
@@ -169,6 +241,11 @@ class DockerContainer:
cwd: Optional[PathOrStr] = None,
) -> str:
if cwd is None:
# Podman does not start the a container in a specific working dir
# so we always need to specify it when making calls.
cwd = self.cwd
chdir = f"cd {cwd}" if cwd else ""
env_assignments = (
" ".join(f"{shlex.quote(k)}={shlex.quote(v)}" for k, v in env.items())
@@ -254,6 +331,22 @@ class DockerContainer:
# used as an EnvironmentExecutor to evaluate commands and capture output
return self.call(command, env=environment, capture_output=True)
def debug_info(self) -> str:
if self.engine == "podman":
command = f"{self.engine} info --debug"
else:
command = f"{self.engine} info"
completed = subprocess.run(
command,
shell=True,
check=True,
cwd=self.cwd,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
)
output = str(completed.stdout, encoding="utf8", errors="surrogateescape")
return output
def shell_quote(path: PurePath) -> str:
return shlex.quote(str(path))
return shlex.quote(os.fspath(path))
+32 -15
View File
@@ -4,6 +4,7 @@ import sys
import traceback
from configparser import ConfigParser
from contextlib import contextmanager
from dataclasses import asdict, dataclass
from pathlib import Path
from typing import (
Any,
@@ -11,11 +12,11 @@ from typing import (
Generator,
List,
Mapping,
NamedTuple,
Optional,
Set,
Tuple,
Union,
cast,
)
if sys.version_info >= (3, 11):
@@ -27,6 +28,7 @@ from packaging.specifiers import SpecifierSet
from .architecture import Architecture
from .environment import EnvironmentParseError, ParsedEnvironment, parse_environment
from .oci_container import ContainerEngine
from .projectfiles import get_requires_python_str
from .typing import PLATFORMS, Literal, PlatformName, TypedDict
from .util import (
@@ -45,6 +47,7 @@ from .util import (
)
@dataclass
class CommandLineArguments:
platform: Literal["auto", "linux", "macos", "windows"]
archs: Optional[str]
@@ -56,15 +59,18 @@ class CommandLineArguments:
prerelease_pythons: bool
class GlobalOptions(NamedTuple):
@dataclass(frozen=True)
class GlobalOptions:
package_dir: Path
output_dir: Path
build_selector: BuildSelector
test_selector: TestSelector
architectures: Set[Architecture]
container_engine: ContainerEngine
class BuildOptions(NamedTuple):
@dataclass(frozen=True)
class BuildOptions:
globals: GlobalOptions
environment: ParsedEnvironment
before_all: str
@@ -104,7 +110,8 @@ class BuildOptions(NamedTuple):
Setting = Union[Dict[str, str], List[str], str, int]
class Override(NamedTuple):
@dataclass(frozen=True)
class Override:
select_pattern: str
options: Dict[str, Setting]
@@ -392,12 +399,22 @@ class Options:
archs_config_str = args.archs or self.reader.get("archs", sep=" ")
architectures = Architecture.parse_config(archs_config_str, platform=self.platform)
container_engine_str = self.reader.get("container-engine")
if container_engine_str not in ["docker", "podman"]:
msg = f"cibuildwheel: Unrecognised container_engine '{container_engine_str}', only 'docker' and 'podman' are supported"
print(msg, file=sys.stderr)
sys.exit(2)
container_engine = cast(ContainerEngine, container_engine_str)
return GlobalOptions(
package_dir=package_dir,
output_dir=output_dir,
build_selector=build_selector,
test_selector=test_selector,
architectures=architectures,
container_engine=container_engine,
)
def build_options(self, identifier: Optional[str]) -> BuildOptions:
@@ -472,10 +489,10 @@ class Options:
manylinux_images: Dict[str, str] = {}
musllinux_images: Dict[str, str] = {}
if self.platform == "linux":
all_pinned_docker_images = _get_pinned_docker_images()
all_pinned_container_images = _get_pinned_container_images()
for build_platform in MANYLINUX_ARCHS:
pinned_images = all_pinned_docker_images[build_platform]
pinned_images = all_pinned_container_images[build_platform]
config_value = self.reader.get(
f"manylinux-{build_platform}-image", ignore_empty=True
@@ -492,7 +509,7 @@ class Options:
manylinux_images[build_platform] = image
for build_platform in MUSLLINUX_ARCHS:
pinned_images = all_pinned_docker_images[build_platform]
pinned_images = all_pinned_container_images[build_platform]
config_value = self.reader.get(f"musllinux-{build_platform}-image")
@@ -548,12 +565,12 @@ class Options:
def summary(self, identifiers: List[str]) -> str:
lines = [
f"{option_name}: {option_value!r}"
for option_name, option_value in sorted(self.globals._asdict().items())
for option_name, option_value in sorted(asdict(self.globals).items())
]
build_option_defaults = self.build_options(identifier=None)
for option_name, default_value in sorted(build_option_defaults._asdict().items()):
for option_name, default_value in sorted(asdict(build_option_defaults).items()):
if option_name == "globals":
continue
@@ -561,7 +578,7 @@ class Options:
# if any identifiers have an overridden value, print that too
for identifier in identifiers:
option_value = self.build_options(identifier=identifier)._asdict()[option_name]
option_value = getattr(self.build_options(identifier=identifier), option_name)
if option_value != default_value:
lines.append(f" {identifier}: {option_value!r}")
@@ -578,7 +595,7 @@ def compute_options(
@functools.lru_cache(maxsize=None)
def _get_pinned_docker_images() -> Mapping[str, Mapping[str, str]]:
def _get_pinned_container_images() -> Mapping[str, Mapping[str, str]]:
"""
This looks like a dict of dicts, e.g.
{ 'x86_64': {'manylinux1': '...', 'manylinux2010': '...', 'manylinux2014': '...'},
@@ -587,10 +604,10 @@ def _get_pinned_docker_images() -> Mapping[str, Mapping[str, str]]:
... }
"""
pinned_docker_images_file = resources_dir / "pinned_docker_images.cfg"
all_pinned_docker_images = ConfigParser()
all_pinned_docker_images.read(pinned_docker_images_file)
return all_pinned_docker_images
pinned_images_file = resources_dir / "pinned_docker_images.cfg"
all_pinned_images = ConfigParser()
all_pinned_images.read(pinned_images_file)
return all_pinned_images
def deprecated_selectors(name: str, selector: str, *, error: bool = False) -> None:
+12 -12
View File
@@ -81,12 +81,12 @@ python_configurations = [
{ identifier = "cp39-macosx_x86_64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.13/python-3.9.13-macos11.pkg" },
{ identifier = "cp39-macosx_arm64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.13/python-3.9.13-macos11.pkg" },
{ identifier = "cp39-macosx_universal2", version = "3.9", url = "https://www.python.org/ftp/python/3.9.13/python-3.9.13-macos11.pkg" },
{ identifier = "cp310-macosx_x86_64", version = "3.10", url = "https://www.python.org/ftp/python/3.10.4/python-3.10.4-macos11.pkg" },
{ identifier = "cp310-macosx_arm64", version = "3.10", url = "https://www.python.org/ftp/python/3.10.4/python-3.10.4-macos11.pkg" },
{ identifier = "cp310-macosx_universal2", version = "3.10", url = "https://www.python.org/ftp/python/3.10.4/python-3.10.4-macos11.pkg" },
{ identifier = "cp311-macosx_x86_64", version = "3.11", url = "https://www.python.org/ftp/python/3.11.0/python-3.11.0b1-macos11.pkg" },
{ identifier = "cp311-macosx_arm64", version = "3.11", url = "https://www.python.org/ftp/python/3.11.0/python-3.11.0b1-macos11.pkg" },
{ identifier = "cp311-macosx_universal2", version = "3.11", url = "https://www.python.org/ftp/python/3.11.0/python-3.11.0b1-macos11.pkg" },
{ identifier = "cp310-macosx_x86_64", version = "3.10", url = "https://www.python.org/ftp/python/3.10.5/python-3.10.5-macos11.pkg" },
{ identifier = "cp310-macosx_arm64", version = "3.10", url = "https://www.python.org/ftp/python/3.10.5/python-3.10.5-macos11.pkg" },
{ identifier = "cp310-macosx_universal2", version = "3.10", url = "https://www.python.org/ftp/python/3.10.5/python-3.10.5-macos11.pkg" },
{ identifier = "cp311-macosx_x86_64", version = "3.11", url = "https://www.python.org/ftp/python/3.11.0/python-3.11.0b3-macos11.pkg" },
{ identifier = "cp311-macosx_arm64", version = "3.11", url = "https://www.python.org/ftp/python/3.11.0/python-3.11.0b3-macos11.pkg" },
{ identifier = "cp311-macosx_universal2", version = "3.11", url = "https://www.python.org/ftp/python/3.11.0/python-3.11.0b3-macos11.pkg" },
{ identifier = "pp37-macosx_x86_64", version = "3.7", url = "https://downloads.python.org/pypy/pypy3.7-v7.3.9-osx64.tar.bz2" },
{ identifier = "pp38-macosx_x86_64", version = "3.8", url = "https://downloads.python.org/pypy/pypy3.8-v7.3.9-osx64.tar.bz2" },
{ identifier = "pp39-macosx_x86_64", version = "3.9", url = "https://downloads.python.org/pypy/pypy3.9-v7.3.9-osx64.tar.bz2" },
@@ -102,13 +102,13 @@ python_configurations = [
{ identifier = "cp38-win_amd64", version = "3.8.10", arch = "64" },
{ identifier = "cp39-win32", version = "3.9.13", arch = "32" },
{ identifier = "cp39-win_amd64", version = "3.9.13", arch = "64" },
{ identifier = "cp310-win32", version = "3.10.4", arch = "32" },
{ identifier = "cp310-win_amd64", version = "3.10.4", arch = "64" },
{ identifier = "cp311-win32", version = "3.11.0-b1", arch = "32" },
{ identifier = "cp311-win_amd64", version = "3.11.0-b1", arch = "64" },
{ identifier = "cp310-win32", version = "3.10.5", arch = "32" },
{ identifier = "cp310-win_amd64", version = "3.10.5", arch = "64" },
{ identifier = "cp311-win32", version = "3.11.0-b3", arch = "32" },
{ identifier = "cp311-win_amd64", version = "3.11.0-b3", arch = "64" },
{ identifier = "cp39-win_arm64", version = "3.9.10", arch = "ARM64" },
{ identifier = "cp310-win_arm64", version = "3.10.4", arch = "ARM64" },
{ identifier = "cp311-win_arm64", version = "3.11.0-b1", arch = "ARM64" },
{ identifier = "cp310-win_arm64", version = "3.10.5", arch = "ARM64" },
{ identifier = "cp311-win_arm64", version = "3.11.0-b3", arch = "ARM64" },
{ identifier = "pp37-win_amd64", version = "3.7", arch = "64", url = "https://downloads.python.org/pypy/pypy3.7-v7.3.9-win64.zip" },
{ identifier = "pp38-win_amd64", version = "3.8", arch = "64", url = "https://downloads.python.org/pypy/pypy3.8-v7.3.9-win64.zip" },
{ identifier = "pp39-win_amd64", version = "3.9", arch = "64", url = "https://downloads.python.org/pypy/pypy3.9-v7.3.9-win64.zip" },
@@ -8,7 +8,7 @@ delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.4
# via virtualenv
filelock==3.7.0
filelock==3.7.1
# via virtualenv
platformdirs==2.5.2
# via virtualenv
@@ -16,7 +16,7 @@ six==1.16.0
# via virtualenv
typing-extensions==4.2.0
# via delocate
virtualenv==20.14.1
virtualenv==20.15.0
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.1
# via
@@ -24,7 +24,7 @@ wheel==0.37.1
# delocate
# The following packages are considered to be unsafe in a requirements file:
pip==22.1.1
pip==22.1.2
# via -r cibuildwheel/resources/constraints.in
setuptools==62.3.2
setuptools==62.6.0
# via -r cibuildwheel/resources/constraints.in
@@ -8,7 +8,7 @@ delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.4
# via virtualenv
filelock==3.7.0
filelock==3.7.1
# via virtualenv
platformdirs==2.5.2
# via virtualenv
@@ -16,7 +16,7 @@ six==1.16.0
# via virtualenv
typing-extensions==4.2.0
# via delocate
virtualenv==20.14.1
virtualenv==20.15.0
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.1
# via
@@ -24,7 +24,7 @@ wheel==0.37.1
# delocate
# The following packages are considered to be unsafe in a requirements file:
pip==22.1.1
pip==22.1.2
# via -r cibuildwheel/resources/constraints.in
setuptools==62.3.2
setuptools==62.6.0
# via -r cibuildwheel/resources/constraints.in
@@ -22,7 +22,7 @@ typing-extensions==4.1.1
# via
# delocate
# importlib-metadata
virtualenv==20.14.1
virtualenv==20.15.0
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.1
# via
@@ -8,9 +8,9 @@ delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.4
# via virtualenv
filelock==3.7.0
filelock==3.7.1
# via virtualenv
importlib-metadata==4.11.4
importlib-metadata==4.12.0
# via virtualenv
platformdirs==2.5.2
# via virtualenv
@@ -20,7 +20,7 @@ typing-extensions==4.2.0
# via
# delocate
# importlib-metadata
virtualenv==20.14.1
virtualenv==20.15.0
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.1
# via
@@ -30,7 +30,7 @@ zipp==3.8.0
# via importlib-metadata
# The following packages are considered to be unsafe in a requirements file:
pip==22.1.1
pip==22.1.2
# via -r cibuildwheel/resources/constraints.in
setuptools==62.3.2
setuptools==62.6.0
# via -r cibuildwheel/resources/constraints.in
@@ -8,7 +8,7 @@ delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.4
# via virtualenv
filelock==3.7.0
filelock==3.7.1
# via virtualenv
platformdirs==2.5.2
# via virtualenv
@@ -16,7 +16,7 @@ six==1.16.0
# via virtualenv
typing-extensions==4.2.0
# via delocate
virtualenv==20.14.1
virtualenv==20.15.0
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.1
# via
@@ -24,7 +24,7 @@ wheel==0.37.1
# delocate
# The following packages are considered to be unsafe in a requirements file:
pip==22.1.1
pip==22.1.2
# via -r cibuildwheel/resources/constraints.in
setuptools==62.3.2
setuptools==62.6.0
# via -r cibuildwheel/resources/constraints.in
@@ -8,7 +8,7 @@ delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.4
# via virtualenv
filelock==3.7.0
filelock==3.7.1
# via virtualenv
platformdirs==2.5.2
# via virtualenv
@@ -16,7 +16,7 @@ six==1.16.0
# via virtualenv
typing-extensions==4.2.0
# via delocate
virtualenv==20.14.1
virtualenv==20.15.0
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.1
# via
@@ -24,7 +24,7 @@ wheel==0.37.1
# delocate
# The following packages are considered to be unsafe in a requirements file:
pip==22.1.1
pip==22.1.2
# via -r cibuildwheel/resources/constraints.in
setuptools==62.3.2
setuptools==62.6.0
# via -r cibuildwheel/resources/constraints.in
+4 -4
View File
@@ -8,7 +8,7 @@ delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.4
# via virtualenv
filelock==3.7.0
filelock==3.7.1
# via virtualenv
platformdirs==2.5.2
# via virtualenv
@@ -16,7 +16,7 @@ six==1.16.0
# via virtualenv
typing-extensions==4.2.0
# via delocate
virtualenv==20.14.1
virtualenv==20.15.0
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.1
# via
@@ -24,7 +24,7 @@ wheel==0.37.1
# delocate
# The following packages are considered to be unsafe in a requirements file:
pip==22.1.1
pip==22.1.2
# via -r cibuildwheel/resources/constraints.in
setuptools==62.3.2
setuptools==62.6.0
# via -r cibuildwheel/resources/constraints.in
+2
View File
@@ -19,6 +19,8 @@ before-test = ""
test-requires = []
test-extras = []
container-engine = "docker"
manylinux-x86_64-image = "manylinux2014"
manylinux-i686-image = "manylinux2014"
manylinux-aarch64-image = "manylinux2014"
+32 -27
View File
@@ -1,43 +1,48 @@
[x86_64]
manylinux1 = quay.io/pypa/manylinux1_x86_64:2022-05-22-74adb27
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2022-05-22-fbe07ea
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2022-05-22-fbe07ea
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2022-05-22-fbe07ea
musllinux_1_1 = quay.io/pypa/musllinux_1_1_x86_64:2022-05-22-fbe07ea
manylinux1 = quay.io/pypa/manylinux1_x86_64:2022-06-26-ddecca8
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2022-06-26-9a2ca4b
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2022-06-26-9a2ca4b
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2022-06-26-9a2ca4b
manylinux_2_28 = quay.io/pypa/manylinux_2_28_x86_64:2022-06-26-9a2ca4b
musllinux_1_1 = quay.io/pypa/musllinux_1_1_x86_64:2022-06-26-9a2ca4b
[i686]
manylinux1 = quay.io/pypa/manylinux1_i686:2022-05-22-74adb27
manylinux2010 = quay.io/pypa/manylinux2010_i686:2022-05-22-fbe07ea
manylinux2014 = quay.io/pypa/manylinux2014_i686:2022-05-22-fbe07ea
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2022-05-22-fbe07ea
musllinux_1_1 = quay.io/pypa/musllinux_1_1_i686:2022-05-22-fbe07ea
manylinux1 = quay.io/pypa/manylinux1_i686:2022-06-26-ddecca8
manylinux2010 = quay.io/pypa/manylinux2010_i686:2022-06-26-9a2ca4b
manylinux2014 = quay.io/pypa/manylinux2014_i686:2022-06-26-9a2ca4b
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2022-06-26-9a2ca4b
musllinux_1_1 = quay.io/pypa/musllinux_1_1_i686:2022-06-26-9a2ca4b
[pypy_x86_64]
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2022-05-22-fbe07ea
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2022-05-22-fbe07ea
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2022-05-22-fbe07ea
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2022-06-26-9a2ca4b
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2022-06-26-9a2ca4b
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2022-06-26-9a2ca4b
manylinux_2_28 = quay.io/pypa/manylinux_2_28_x86_64:2022-06-26-9a2ca4b
[pypy_i686]
manylinux2010 = quay.io/pypa/manylinux2010_i686:2022-05-22-fbe07ea
manylinux2014 = quay.io/pypa/manylinux2014_i686:2022-05-22-fbe07ea
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2022-05-22-fbe07ea
manylinux2010 = quay.io/pypa/manylinux2010_i686:2022-06-26-9a2ca4b
manylinux2014 = quay.io/pypa/manylinux2014_i686:2022-06-26-9a2ca4b
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2022-06-26-9a2ca4b
[aarch64]
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2022-05-22-fbe07ea
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2022-05-22-fbe07ea
musllinux_1_1 = quay.io/pypa/musllinux_1_1_aarch64:2022-05-22-fbe07ea
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2022-06-26-9a2ca4b
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2022-06-26-9a2ca4b
manylinux_2_28 = quay.io/pypa/manylinux_2_28_aarch64:2022-06-26-9a2ca4b
musllinux_1_1 = quay.io/pypa/musllinux_1_1_aarch64:2022-06-26-9a2ca4b
[ppc64le]
manylinux2014 = quay.io/pypa/manylinux2014_ppc64le:2022-05-22-fbe07ea
manylinux_2_24 = quay.io/pypa/manylinux_2_24_ppc64le:2022-05-22-fbe07ea
musllinux_1_1 = quay.io/pypa/musllinux_1_1_ppc64le:2022-05-22-fbe07ea
manylinux2014 = quay.io/pypa/manylinux2014_ppc64le:2022-06-26-9a2ca4b
manylinux_2_24 = quay.io/pypa/manylinux_2_24_ppc64le:2022-06-26-9a2ca4b
manylinux_2_28 = quay.io/pypa/manylinux_2_28_ppc64le:2022-06-26-9a2ca4b
musllinux_1_1 = quay.io/pypa/musllinux_1_1_ppc64le:2022-06-26-9a2ca4b
[s390x]
manylinux2014 = quay.io/pypa/manylinux2014_s390x:2022-05-22-fbe07ea
manylinux_2_24 = quay.io/pypa/manylinux_2_24_s390x:2022-05-22-fbe07ea
musllinux_1_1 = quay.io/pypa/musllinux_1_1_s390x:2022-05-22-fbe07ea
manylinux2014 = quay.io/pypa/manylinux2014_s390x:2022-06-26-9a2ca4b
manylinux_2_24 = quay.io/pypa/manylinux_2_24_s390x:2022-06-26-9a2ca4b
musllinux_1_1 = quay.io/pypa/musllinux_1_1_s390x:2022-06-26-9a2ca4b
[pypy_aarch64]
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2022-05-22-fbe07ea
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2022-05-22-fbe07ea
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2022-06-26-9a2ca4b
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2022-06-26-9a2ca4b
manylinux_2_28 = quay.io/pypa/manylinux_2_28_aarch64:2022-06-26-9a2ca4b
+2 -2
View File
@@ -1,2 +1,2 @@
version = "20.14.1"
url = "https://github.com/pypa/get-virtualenv/blob/20.14.1/public/virtualenv.pyz?raw=true"
version = "20.15.0"
url = "https://github.com/pypa/get-virtualenv/blob/20.15.0/public/virtualenv.pyz?raw=true"
+61 -35
View File
@@ -1,5 +1,4 @@
import contextlib
import dataclasses
import fnmatch
import itertools
import os
@@ -11,6 +10,7 @@ import sys
import textwrap
import time
import urllib.request
from dataclasses import dataclass
from enum import Enum
from functools import lru_cache
from pathlib import Path, PurePath
@@ -22,7 +22,6 @@ from typing import (
Generator,
Iterable,
List,
NamedTuple,
Optional,
Sequence,
TextIO,
@@ -54,7 +53,7 @@ __all__ = [
"MANYLINUX_ARCHS",
"call",
"shell",
"find_compatible_abi3_wheel",
"find_compatible_wheel",
"format_safe",
"prepare_command",
"get_build_verbosity_extra_flags",
@@ -233,22 +232,21 @@ def selector_matches(patterns: str, string: str) -> bool:
# Once we require Python 3.10+, we can add kw_only=True
@dataclasses.dataclass
class IdentifierSelector:
@dataclass(frozen=True)
class BuildSelector:
"""
This class holds a set of build/skip patterns. You call an instance with a
build identifier, and it returns True if that identifier should be
included. Only call this on valid identifiers, ones that have at least 2
numeric digits before the first dash. If a pre-release version X.Y is present,
you can filter it with prerelease="XY".
numeric digits before the first dash.
"""
build_config: str
skip_config: str
requires_python: Optional[SpecifierSet] = None
# a pattern that skips prerelease versions, when include_prereleases is False.
PRERELEASE_SKIP: ClassVar[str] = "cp311-*"
skip_config: str
build_config: str
requires_python: Optional[SpecifierSet] = None
prerelease_pythons: bool = False
def __call__(self, build_id: str) -> bool:
@@ -271,16 +269,17 @@ class IdentifierSelector:
return should_build and not should_skip
@dataclasses.dataclass
class BuildSelector(IdentifierSelector):
pass
@dataclass(frozen=True)
class TestSelector:
"""
A build selector that can only skip tests according to a skip pattern.
"""
skip_config: str
# Note that requires-python is not needed for TestSelector, as you can't test
# what you can't build.
@dataclasses.dataclass
class TestSelector(IdentifierSelector):
build_config: str = "*"
def __call__(self, build_id: str) -> bool:
should_skip = selector_matches(self.skip_config, build_id)
return not should_skip
# Taken from https://stackoverflow.com/a/107717
@@ -373,6 +372,20 @@ class NonPlatformWheelError(Exception):
super().__init__(message)
class AlreadyBuiltWheelError(Exception):
def __init__(self, wheel_name: str) -> None:
message = textwrap.dedent(
f"""
cibuildwheel: Build failed because a wheel named {wheel_name} was already generated in the current run.
If you expected another wheel to be generated, check your project configuration, or run
cibuildwheel with CIBW_BUILD_VERBOSITY=1 to view build logs.
"""
)
super().__init__(message)
def strtobool(val: str) -> bool:
return val.lower() in {"y", "yes", "t", "true", "on", "1"}
@@ -418,6 +431,12 @@ def unwrap(text: str) -> str:
return re.sub(r"\s+", " ", text)
@dataclass(frozen=True)
class FileReport:
name: str
size: str
@contextlib.contextmanager
def print_new_wheels(msg: str, output_dir: Path) -> Generator[None, None, None]:
"""
@@ -432,10 +451,6 @@ def print_new_wheels(msg: str, output_dir: Path) -> Generator[None, None, None]:
yield
final_contents = set(output_dir.iterdir())
class FileReport(NamedTuple):
name: str
size: str
new_contents = [
FileReport(wheel.name, f"{(wheel.stat().st_size + 1023) // 1024:,d}")
for wheel in final_contents - existing_contents
@@ -574,36 +589,47 @@ def virtualenv(
T = TypeVar("T", bound=PurePath)
def find_compatible_abi3_wheel(wheels: Sequence[T], identifier: str) -> Optional[T]:
def find_compatible_wheel(wheels: Sequence[T], identifier: str) -> Optional[T]:
"""
Finds an ABI3 wheel in `wheels` compatible with the Python interpreter
specified by `identifier`.
Finds a wheel with an abi3 or a none ABI tag in `wheels` compatible with the Python interpreter
specified by `identifier` that is previously built.
"""
interpreter, platform = identifier.split("-")
if not interpreter.startswith("cp3"):
return None
for wheel in wheels:
_, _, _, tags = parse_wheel_filename(wheel.name)
for tag in tags:
if tag.abi != "abi3":
if tag.abi == "abi3":
# ABI3 wheels must start with cp3 for impl and tag
if not (interpreter.startswith("cp3") and tag.interpreter.startswith("cp3")):
continue
elif tag.abi == "none":
# CPythonless wheels must include py3 tag
if tag.interpreter[:3] != "py3":
continue
else:
# Other types of wheels are not detected, this is looking for previously built wheels.
continue
if not tag.interpreter.startswith("cp3"):
continue
if int(tag.interpreter[3:]) > int(interpreter[3:]):
if tag.interpreter != "py3" and int(tag.interpreter[3:]) > int(interpreter[3:]):
# If a minor version number is given, it has to be lower than the current one.
continue
if platform.startswith(("manylinux", "musllinux", "macosx")):
# Linux, macOS
# Linux, macOS require the beginning and ending match (macos/manylinux version doesn't need to)
os_, arch = platform.split("_", 1)
if not tag.platform.startswith(os_):
continue
if not tag.platform.endswith("_" + arch):
if not tag.platform.endswith(f"_{arch}"):
continue
else:
# Windows
# Windows should exactly match
if not tag.platform == platform:
continue
# If all the filters above pass, then the wheel is a previously built compatible wheel.
return wheel
return None
+14 -8
View File
@@ -2,9 +2,10 @@ import os
import shutil
import subprocess
import sys
from dataclasses import dataclass
from functools import lru_cache
from pathlib import Path
from typing import Dict, List, NamedTuple, Optional, Sequence, Set
from typing import Dict, List, Optional, Sequence, Set
from zipfile import ZipFile
from filelock import FileLock
@@ -17,12 +18,13 @@ from .options import Options
from .typing import PathOrStr, assert_never
from .util import (
CIBW_CACHE_PATH,
AlreadyBuiltWheelError,
BuildFrontend,
BuildSelector,
NonPlatformWheelError,
call,
download,
find_compatible_abi3_wheel,
find_compatible_wheel,
get_build_verbosity_extra_flags,
get_pip_version,
prepare_command,
@@ -46,7 +48,8 @@ def get_nuget_args(version: str, arch: str, output_directory: Path) -> List[str]
]
class PythonConfiguration(NamedTuple):
@dataclass(frozen=True)
class PythonConfiguration:
version: str
arch: str
identifier: str
@@ -277,13 +280,13 @@ def build(options: Options, tmp_path: Path) -> None:
build_options.build_frontend,
)
abi3_wheel = find_compatible_abi3_wheel(built_wheels, config.identifier)
if abi3_wheel:
compatible_wheel = find_compatible_wheel(built_wheels, config.identifier)
if compatible_wheel:
log.step_end()
print(
f"\nFound previously built wheel {abi3_wheel.name}, that's compatible with {config.identifier}. Skipping build step..."
f"\nFound previously built wheel {compatible_wheel.name}, that's compatible with {config.identifier}. Skipping build step..."
)
repaired_wheel = abi3_wheel
repaired_wheel = compatible_wheel
else:
# run the before_build command
if build_options.before_build:
@@ -365,6 +368,9 @@ def build(options: Options, tmp_path: Path) -> None:
repaired_wheel = next(repaired_wheel_dir.glob("*.whl"))
if repaired_wheel.name in {wheel.name for wheel in built_wheels}:
raise AlreadyBuiltWheelError(repaired_wheel.name)
if build_options.test_command and options.globals.test_selector(config.identifier):
log.step("Testing wheel...")
# set up a virtual environment to install and test from, to make sure
@@ -418,7 +424,7 @@ def build(options: Options, tmp_path: Path) -> None:
shell(test_command_prepared, cwd="c:\\", env=virtualenv_env)
# we're all done here; move it to output (remove if already exists)
if abi3_wheel is None:
if compatible_wheel is None:
shutil.move(str(repaired_wheel), build_options.output_dir)
built_wheels.append(build_options.output_dir / repaired_wheel.name)
+24
View File
@@ -2,6 +2,30 @@
title: Changelog
---
### v2.8.0
_5 July 2022_
- ✨ You can now run cibuildwheel on Podman, as an alternate container engine to Docker, which remains the default. This is useful in environments where a Docker daemon isn't available, for example, it can be run inside a Docker container, or without root access. To use Podman, set the [`CIBW_CONTAINER_ENGINE`](https://cibuildwheel.readthedocs.io/en/stable/options/#container-engine) option. (#966)
- ✨ Adds support for building `py3-none-{platform}` wheels. These wheels contain native extension code, but don't use the Python APIs. Typically, they're bridged to Python using a FFI module like [ctypes](https://docs.python.org/3/library/ctypes.html) or [cffi](https://cffi.readthedocs.io/en/latest/). Because they don't use Python ABI, the wheels are more compatible - they work across many Python versions. Check out this [example ctypes project](https://github.com/joerick/python-ctypes-package-sample) to see an example of how it works. (#1151)
- 🛠 cibuildwheel will now error if multiple builds in a single run produce the same wheel filename, as this indicates a misconfiguration. (#1152)
- 📚 A few docs improvements and updates to keep things up-to-date.
### v2.7.0
_17 June 2022_
- 🌟 Added support for the new `manylinux_2_28` images. These new images are based on AlmaLinux, the community-driven successor to CentOS, unlike manylinux_2_24, which was based on Debian. To build on these images, set your [`CIBW_MANYLINUX_*_IMAGE`](https://cibuildwheel.readthedocs.io/en/stable/options/#linux-image) option to `manylinux_2_28`. (#1026)
- 🐛 Fix a bug where tests were not being run on CPython 3.11 (when CIBW_PRERELEASE_PYTHONS was set) (#1138)
- ✨ You can now build Linux wheels on Windows, as long as you have Docker installed and set to 'Linux containers' (#1117)
- 🐛 Fix a bug on macOS that caused cibuildwheel to crash trying to overwrite a previously-built wheel of the same name. (#1129)
### v2.6.1
_7 June 2022_
- 🛠 Update the prerelease CPython 3.11 to 3.11.0b3
### v2.6.0
_25 May 2022_
+4 -4
View File
@@ -46,7 +46,7 @@ well as several useful actions. Alongside your existing job(s) that runs cibuild
name: Make SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Optional, use if you use setuptools_scm
submodules: true # Optional, use if you have submodules
@@ -54,7 +54,7 @@ well as several useful actions. Alongside your existing job(s) that runs cibuild
- name: Build SDist
run: pipx run build --sdist
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
```
@@ -69,12 +69,12 @@ This requires a [PyPI upload token](https://pypi.org/manage/account/token/), sto
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@v1.4.2
- uses: pypa/gh-action-pypi-publish@v1.5.0
with:
user: __token__
password: ${{ secrets.pypi_password }}
+3 -3
View File
@@ -8,7 +8,7 @@
<!-- the docker container outline -->
<div class="grid-outline docker">
<div class="outline">
Manylinux Docker container
Manylinux container
</div>
</div>
<!-- the venv outlines -->
@@ -76,7 +76,7 @@
steps: [
[
{
label: 'copy project into docker',
label: 'copy project into container',
platforms: ['linux'],
style: 'block',
width: 2,
@@ -204,7 +204,7 @@
],
[
{
label: 'Copy wheels out of Docker',
label: 'Copy wheels out of container',
platforms: ['linux'],
style: 'block',
width: 2,
+7 -11
View File
@@ -4,15 +4,15 @@ title: Tips and tricks
## Tips
### Linux builds on Docker
### Linux builds in containers
Linux wheels are built in the [`manylinux`/`musllinux` docker images](https://github.com/pypa/manylinux) to provide binary compatible wheels on Linux, according to [PEP 600](https://www.python.org/dev/peps/pep-0600/) / [PEP 656](https://www.python.org/dev/peps/pep-0656/). Because of this, when building with `cibuildwheel` on Linux, a few things should be taken into account:
Linux wheels are built in [`manylinux`/`musllinux` containers](https://github.com/pypa/manylinux) to provide binary compatible wheels on Linux, according to [PEP 600](https://www.python.org/dev/peps/pep-0600/) / [PEP 656](https://www.python.org/dev/peps/pep-0656/). Because of this, when building with `cibuildwheel` on Linux, a few things should be taken into account:
- Programs and libraries are not installed on the CI runner host, but rather should be installed inside of the Docker image - using `yum` for `manylinux2010` or `manylinux2014`, `apt-get` for `manylinux_2_24` and `apk` for `musllinux_1_1`, or manually. The same goes for environment variables that are potentially needed to customize the wheel building.
- Programs and libraries are not installed on the CI runner host, but rather should be installed inside the container - using `yum` for `manylinux2010` or `manylinux2014`, `apt-get` for `manylinux_2_24` and `apk` for `musllinux_1_1`, or manually. The same goes for environment variables that are potentially needed to customize the wheel building.
`cibuildwheel` supports this by providing the [`CIBW_ENVIRONMENT`](options.md#environment) and [`CIBW_BEFORE_ALL`](options.md#before-all) options to setup the build environment inside the running Docker image.
`cibuildwheel` supports this by providing the [`CIBW_ENVIRONMENT`](options.md#environment) and [`CIBW_BEFORE_ALL`](options.md#before-all) options to setup the build environment inside the running container.
- The project directory is mounted in the running Docker instance as `/project`, the output directory for the wheels as `/output`. In general, this is handled transparently by `cibuildwheel`. For a more finegrained level of control however, the root of the host file system is mounted as `/host`, allowing for example to access shared files, caches, etc. on the host file system. Note that `/host` is not available on CircleCI due to their Docker policies.
- The project directory is mounted inside the container as `/project`, the output directory for the wheels as `/output`. In general, this is handled transparently by `cibuildwheel`. For a more finegrained level of control however, the root of the host file system is mounted as `/host`, allowing for example to access shared files, caches, etc. on the host file system. Note that `/host` is not available on CircleCI due to their Docker policies.
- Alternative Docker images can be specified with the `CIBW_MANYLINUX_*_IMAGE`/`CIBW_MUSLLINUX_*_IMAGE` options to allow for a custom, preconfigured build environment for the Linux builds. See [options](options.md#linux-image) for more details.
@@ -133,7 +133,7 @@ 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:
```yaml
uses: pypa/cibuildwheel@v2.6.0
uses: pypa/cibuildwheel@v2.8.0
```
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.
@@ -147,10 +147,6 @@ updates:
directory: "/"
schedule:
interval: "weekly"
ignore:
# Optional: Official actions have moving tags like v1;
# if you use those, you don't need updates.
- dependency-name: "actions/*"
```
#### Option 2: Requirement files
@@ -159,7 +155,7 @@ The second option, and the only one that supports other CI systems, is using a `
```bash
# requirements-cibw.txt
cibuildwheel==2.6.0
cibuildwheel==2.8.0
```
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:
+58 -11
View File
@@ -117,9 +117,9 @@ matches overriding earlier ones if multiple selectors match. Environment
variables always override static configuration.
A few of the options below have special handling in overrides. A different
`before-all` will trigger a new docker launch on Linux, and cannot be
`before-all` will trigger a new container to launch on Linux, and cannot be
overridden on macOS or Windows. Overriding the image on linux will also
generate new docker launches, one per image. Some commands are not supported;
trigger new containers, one per image. Some commands are not supported;
`output-dir`, build/skip/test_skip selectors, and architectures cannot be
overridden.
@@ -174,7 +174,7 @@ Default: `auto`
`auto` will auto-detect platform using environment variables, such as `TRAVIS_OS_NAME`/`APPVEYOR`/`CIRCLECI`.
- For `linux`, you need Docker running, on Linux, macOS, or Windows.
- For `linux`, you need [Docker or Podman](#container-engine) running, on Linux, macOS, or Windows.
- For `macos` and `windows`, you need to be running on the respective system, with a working compiler toolchain installed - Xcode Command Line tools for macOS, and MSVC for Windows.
This option can also be set using the [command-line option](#command-line) `--platform`. This option is not available in the `pyproject.toml` config.
@@ -523,7 +523,7 @@ Choose which build backend to use. Can either be "pip", which will run
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 container). It also works for the other platforms.
You can use `$PATH` syntax to insert other variables, or the `$(pwd)` syntax to insert the output of other shell commands.
@@ -553,6 +553,10 @@ Platform-specific environment variables are also available:<br/>
# Supply options to `pip` to affect how it downloads dependencies
CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.myorg.com/simple
# Any pip command-line options can be set using the PIP_ prefix
# https://pip.pypa.io/en/stable/topics/configuration/#environment-variables
CIBW_ENVIRONMENT: PIP_GLOBAL_OPTION="build_ext -j4"
# Set two flags on linux only
CIBW_ENVIRONMENT_LINUX: BUILD_TIME="$(date)" SAMPLE_TEXT="sample text"
```
@@ -582,6 +586,10 @@ Platform-specific environment variables are also available:<br/>
# Supply options to `pip` to affect how it downloads dependencies
environment = { PIP_EXTRA_INDEX_URL="https://pypi.myorg.com/simple" }
# Any pip command-line option can be set using the PIP_ prefix
# https://pip.pypa.io/en/stable/topics/configuration/#environment-variables
environment = { PIP_GLOBAL_OPTION="build_ext -j4" }
# Set two flags on linux only
[tool.cibuildwheel.linux]
environment = { BUILD_TIME="$(date)", SAMPLE_TEXT="sample text" }
@@ -637,14 +645,14 @@ To specify more than one environment variable, separate the variable names by sp
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 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 container 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.
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.
This option has special behavior in the overrides section in `pyproject.toml`.
On linux, overriding it triggers a new docker launch. It cannot be overridden
On linux, overriding it triggers a new container launch. It cannot be overridden
on macOS and Windows.
Platform-specific environment variables also available:<br/>
@@ -866,7 +874,7 @@ Platform-specific environment variables are also available:<br/>
<div class="link-target" id="manylinux-image"></div>
### `CIBW_MANYLINUX_*_IMAGE`, `CIBW_MUSLLINUX_*_IMAGE` {: #linux-image}
> Specify alternative manylinux / musllinux Docker images
> Specify alternative manylinux / musllinux container images
The available options are (default value):
@@ -886,16 +894,16 @@ The available options are (default value):
Set an alternative Docker image to be used for building [manylinux / musllinux](https://github.com/pypa/manylinux) wheels.
For `CIBW_MANYLINUX_*_IMAGE`, the value of this option can either be set to `manylinux1`, `manylinux2010`, `manylinux2014` or `manylinux_2_24` to use a pinned version of the [official manylinux images](https://github.com/pypa/manylinux). Alternatively, set these options to any other valid Docker image name. For PyPy, the `manylinux1` image is not available. For architectures other
than x86 (x86\_64 and i686) `manylinux2014` or `manylinux_2_24` must be used, because the first version of the manylinux specification that supports additional architectures is `manylinux2014`.
For `CIBW_MANYLINUX_*_IMAGE`, the value of this option can either be set to `manylinux1`, `manylinux2010`, `manylinux2014`, `manylinux_2_24` or `manylinux_2_28` to use a pinned version of the [official manylinux images](https://github.com/pypa/manylinux). Alternatively, set these options to any other valid Docker image name. For PyPy, the `manylinux1` image is not available. For architectures other
than x86 (x86\_64 and i686) `manylinux2014`, `manylinux_2_24` or `manylinux_2_28` must be used, because the first version of the manylinux specification that supports additional architectures is `manylinux2014`. `manylinux_2_28` is not supported for `i686` & `s390x` architectures.
For `CIBW_MUSLLINUX_*_IMAGE`, the value of this option can either be set to `musllinux_1_1` to use a pinned version of the [official musllinux images](https://github.com/pypa/musllinux). Alternatively, set these options to any other valid Docker image name.
If this option is blank, it will fall though to the next available definition (environment variable -> pyproject.toml -> default).
If setting a custom Docker image, you'll need to make sure it can be used in the same way as the official, default Docker images: all necessary Python and pip versions need to be present in `/opt/python/`, and the auditwheel tool needs to be present for cibuildwheel to work. Apart from that, the architecture and relevant shared system libraries need to be compatible to the relevant standard to produce valid manylinux1/manylinux2010/manylinux2014/manylinux_2_24/musllinux_1_1 wheels (see [pypa/manylinux on GitHub](https://github.com/pypa/manylinux), [PEP 513](https://www.python.org/dev/peps/pep-0513/), [PEP 571](https://www.python.org/dev/peps/pep-0571/), [PEP 599](https://www.python.org/dev/peps/pep-0599/), [PEP 600](https://www.python.org/dev/peps/pep-0600/) and [PEP 656](https://www.python.org/dev/peps/pep-0656/) for more details).
If setting a custom image, you'll need to make sure it can be used in the same way as the default images: all necessary Python and pip versions need to be present in `/opt/python/`, and the auditwheel tool needs to be present for cibuildwheel to work. Apart from that, the architecture and relevant shared system libraries need to be compatible to the relevant standard to produce valid manylinux1/manylinux2010/manylinux2014/manylinux_2_24/manylinux_2_28/musllinux_1_1 wheels (see [pypa/manylinux on GitHub](https://github.com/pypa/manylinux), [PEP 513](https://www.python.org/dev/peps/pep-0513/), [PEP 571](https://www.python.org/dev/peps/pep-0571/), [PEP 599](https://www.python.org/dev/peps/pep-0599/), [PEP 600](https://www.python.org/dev/peps/pep-0600/) and [PEP 656](https://www.python.org/dev/peps/pep-0656/) for more details).
Auditwheel detects the version of the manylinux / musllinux standard in the Docker image through the `AUDITWHEEL_PLAT` environment variable, as cibuildwheel has no way of detecting the correct `--plat` command line argument to pass to auditwheel for a custom image. If a Docker image does not correctly set this `AUDITWHEEL_PLAT` environment variable, the `CIBW_ENVIRONMENT` option can be used to do so (e.g., `CIBW_ENVIRONMENT='AUDITWHEEL_PLAT="manylinux2010_$(uname -m)"'`).
Auditwheel detects the version of the manylinux / musllinux standard in the image through the `AUDITWHEEL_PLAT` environment variable, as cibuildwheel has no way of detecting the correct `--plat` command line argument to pass to auditwheel for a custom image. If a custom image does not correctly set this `AUDITWHEEL_PLAT` environment variable, the `CIBW_ENVIRONMENT` option can be used to do so (e.g., `CIBW_ENVIRONMENT='AUDITWHEEL_PLAT="manylinux2010_$(uname -m)"'`).
#### Examples
@@ -956,6 +964,44 @@ Auditwheel detects the version of the manylinux / musllinux standard in the Dock
Like any other option, these can be placed in `[tool.cibuildwheel.linux]`
if you prefer; they have no effect on `macos` and `windows`.
### `CIBW_CONTAINER_ENGINE` {: #container-engine}
> Specify which container engine to use when building Linux wheels
Options: `docker` `podman`
Default: `docker`
Set the container engine to use. Docker is the default, or you can switch to
[Podman](https://podman.io/). To use Docker, you need to have a Docker daemon
running and `docker` available on PATH. To use Podman, it needs to be
installed and `podman` available on PATH.
!!! tip
While most users will stick with Docker, Podman is available in different
contexts - for example, it can be run inside a Docker container, or without
root access. Thanks to the [OCI], images are compatible between engines, so
you can still use the regular manylinux/musllinux containers.
[OCI]: https://opencontainers.org/
#### Examples
!!! tab examples "Environment variables"
```yaml
CIBW_CONTAINER_ENGINE: podman
```
!!! tab examples "pyproject.toml"
```toml
[tool.cibuildwheel]
container-engine = "podman"
```
### `CIBW_DEPENDENCY_VERSIONS` {: #dependency-versions}
> Specify how cibuildwheel controls the versions of the tools it uses
@@ -1021,6 +1067,7 @@ Platform-specific environment variables are also available:<br/>
dependency-versions = "./constraints.txt"
```
## Testing
### `CIBW_TEST_COMMAND` {: #test-command}
+10 -11
View File
@@ -154,10 +154,9 @@ To build Linux, Mac, and Windows wheels using GitHub Actions, create a `.github/
{% include "../examples/github-minimal.yml" %}
```
You can use `env:` with the action just like you would with `run:`; you can
also use `with:` to set the command line options: `package-dir: .` and
`output-dir: wheelhouse` (those values are the defaults).
Use `env:` to pass [build options](options.md) and `with:` to set
`package-dir: .`, `output-dir: wheelhouse` and `config-file: ''`
locations (those values are the defaults).
!!! tab "pipx"
The GitHub Actions runners have pipx installed, so you can easily build in
@@ -180,12 +179,12 @@ To build Linux, Mac, and Windows wheels using GitHub Actions, create a `.github/
os: [ubuntu-20.04, windows-2019, macos-10.15]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build wheels
run: pipx run cibuildwheel==2.6.0
run: pipx run cibuildwheel==2.8.0
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
```
@@ -212,18 +211,18 @@ To build Linux, Mac, and Windows wheels using GitHub Actions, create a `.github/
os: [ubuntu-20.04, windows-2019, macos-10.15]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
# Used to host cibuildwheel
- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.6.0
run: python -m pip install cibuildwheel==2.8.0
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
```
+117 -117
View File
@@ -9,18 +9,18 @@ title: Working examples
| Name | CI | OS | Notes |
|-----------------------------------|----|----|:------|
| [scikit-learn][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | The machine learning library. A complex but clean config using many of cibuildwheel's features to build a large project with Cython and C++ extensions. |
| [Tornado][] | ![travisci icon][] | ![apple icon][] ![linux icon][] | Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed. |
| [NumPy][] | ![github icon][] ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | The fundamental package for scientific computing with Python. |
| [Tornado][] | ![travisci icon][] | ![apple icon][] ![linux icon][] | Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed. |
| [pytorch-fairseq][] | ![github icon][] | ![apple icon][] ![linux icon][] | Facebook AI Research Sequence-to-Sequence Toolkit written in Python. |
| [Matplotlib][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | The venerable Matplotlib, a Python library with C++ portions |
| [Kivy][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS |
| [NCNN][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | ncnn is a high-performance neural network inference framework optimized for the mobile platform |
| [Kivy][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS |
| [Prophet][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth. |
| [MyPy][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | The compiled version of MyPy using MyPyC. |
| [pydantic][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Data parsing and validation using Python type hints |
| [MemRay][] | ![github icon][] | ![linux icon][] | Memray is a memory profiler for Python |
| [uvloop][] | ![github icon][] | ![apple icon][] ![linux icon][] | Ultra fast asyncio event loop. |
| [psutil][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Cross-platform lib for process and system monitoring in Python |
| [MemRay][] | ![github icon][] | ![linux icon][] | Memray is a memory profiler for Python |
| [vaex][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Out-of-Core hybrid Apache Arrow/NumPy DataFrame for Python, ML, visualization and exploration of big tabular data at a billion rows per second 🚀 |
| [Google Benchmark][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | A microbenchmark support library |
| [Apache Beam][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Apache Beam is a unified programming model for Batch and Streaming data processing. |
@@ -52,8 +52,8 @@ title: Working examples
| [Wrapt][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A Python module for decorators, wrappers and monkey patching. |
| [PyAV][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Pythonic bindings for FFmpeg's libraries. |
| [SimpleJSON][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | simplejson is a simple, fast, extensible JSON encoder/decoder for Python |
| [OpenColorIO][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | A color management framework for visual effects and animation. |
| [pikepdf][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A Python library for reading and writing PDF, powered by qpdf |
| [OpenColorIO][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | A color management framework for visual effects and animation. |
| [Line Profiler][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Line-by-line profiling for Python |
| [PyTables][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A Python package to manage extremely large amounts of data |
| [OpenTimelineIO][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Open Source API and interchange format for editorial timeline information. |
@@ -75,17 +75,17 @@ title: Working examples
| [pybind11 python_example][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Example pybind11 module built with a Python-based build system |
| [dd-trace-py][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Uses custom alternate arch emulation on GitHub |
| [sourmash][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Quickly search, compare, and analyze genomic and metagenomic data sets. |
| [CTranslate2][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Includes libraries from the [Intel oneAPI toolkit](https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit.html) and CUDA kernels compiled for multiple GPU architectures. |
| [time-machine][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Time mocking library using only the CPython C API. |
| [cyvcf2][] | ![github icon][] | ![apple icon][] ![linux icon][] | cython + htslib == fast VCF and BCF processing |
| [CTranslate2][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Includes libraries from the [Intel oneAPI toolkit](https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit.html) and CUDA kernels compiled for multiple GPU architectures. |
| [abess][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A fast best-subset selection library. It uses cibuildwheel to build a large project with C++ extensions. |
| [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. |
| [abess][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A fast best-subset selection library. It uses cibuildwheel to build a large project with C++ extensions. |
| [jq.py][] | ![travisci icon][] | ![apple icon][] ![linux icon][] | Python bindings for jq |
| [iminuit][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Jupyter-friendly Python interface for C++ MINUIT2 |
| [Tokenizer][] | ![github icon][] | ![windows 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 |
| [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. |
| [bx-python][] | ![travisci icon][] | ![apple icon][] ![linux icon][] | A library that includes Cython extensions. |
| [iDynTree][] | ![github icon][] | ![linux icon][] | Uses manylinux_2_24 |
| [TgCrypto][] | ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Includes a Windows Travis build. |
| [Python-WebRTC][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | a Python extension that provides bindings to WebRTC M92 |
@@ -96,12 +96,12 @@ title: Working examples
| [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. |
| [polaroid][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Full range of wheels for setuptools rust, with auto release and PyPI deploy. |
| [clang-format][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Scikit-build wrapper around LLVM's CMake, all platforms, generic wheels. |
| [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 |
| [power-grid-model][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Python/C++ library for distribution power system analysis |
| [pyjet][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | The interface between FastJet and NumPy |
| [pillow-heif][] | ![github icon][] | ![apple icon][] ![linux icon][] | Python CFFI binding to libheif library with third party dependencies like `libde265`, `x265`, `libaom` with test & publishing on PyPi. |
| [pybind11 scikit_build_example][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | An example combining scikit-build and pybind11 |
| [ninja][] | ![github icon][] ![travisci icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Multitagged binary builds for all supported platforms, using cibw 2 config configuration. |
| [pillow-heif][] | ![github icon][] | ![apple icon][] ![linux icon][] | Python CFFI binding to libheif library with third party dependencies like `libde265`, `x265`, `libaom` with test & publishing on PyPi. |
| [GSD][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Cython and NumPy project with 64-bit wheels. |
| [pyinstrument_cext][] | ![travisci icon][] ![appveyor icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A simple C extension, without external dependencies |
| [xmlstarlet][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Python 3.6+ CFFI bindings with true MSVC build. |
@@ -109,18 +109,18 @@ title: Working examples
| [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
[Tornado]: https://github.com/tornadoweb/tornado
[NumPy]: https://github.com/numpy/numpy
[Tornado]: https://github.com/tornadoweb/tornado
[pytorch-fairseq]: https://github.com/pytorch/fairseq
[Matplotlib]: https://github.com/matplotlib/matplotlib
[Kivy]: https://github.com/kivy/kivy
[NCNN]: https://github.com/Tencent/ncnn
[Kivy]: https://github.com/kivy/kivy
[Prophet]: https://github.com/facebook/prophet
[MyPy]: https://github.com/mypyc/mypy_mypyc-wheels
[pydantic]: https://github.com/samuelcolvin/pydantic
[MemRay]: https://github.com/bloomberg/memray
[uvloop]: https://github.com/MagicStack/uvloop
[psutil]: https://github.com/giampaolo/psutil
[MemRay]: https://github.com/bloomberg/memray
[vaex]: https://github.com/vaexio/vaex
[Google Benchmark]: https://github.com/google/benchmark
[Apache Beam]: https://github.com/apache/beam
@@ -152,8 +152,8 @@ title: Working examples
[Wrapt]: https://github.com/GrahamDumpleton/wrapt
[PyAV]: https://github.com/PyAV-Org/PyAV
[SimpleJSON]: https://github.com/simplejson/simplejson
[OpenColorIO]: https://github.com/AcademySoftwareFoundation/OpenColorIO
[pikepdf]: https://github.com/pikepdf/pikepdf
[OpenColorIO]: https://github.com/AcademySoftwareFoundation/OpenColorIO
[Line Profiler]: https://github.com/pyutils/line_profiler
[PyTables]: https://github.com/PyTables/PyTables
[OpenTimelineIO]: https://github.com/PixarAnimationStudios/OpenTimelineIO
@@ -175,17 +175,17 @@ title: Working examples
[pybind11 python_example]: https://github.com/pybind/python_example
[dd-trace-py]: https://github.com/DataDog/dd-trace-py
[sourmash]: https://github.com/dib-lab/sourmash
[CTranslate2]: https://github.com/OpenNMT/CTranslate2
[time-machine]: https://github.com/adamchainz/time-machine
[cyvcf2]: https://github.com/brentp/cyvcf2
[CTranslate2]: https://github.com/OpenNMT/CTranslate2
[abess]: https://github.com/abess-team/abess
[matrixprofile]: https://github.com/matrix-profile-foundation/matrixprofile
[abess]: https://github.com/abess-team/abess
[jq.py]: https://github.com/mwilliamson/jq.py
[iminuit]: https://github.com/scikit-hep/iminuit
[Tokenizer]: https://github.com/OpenNMT/Tokenizer
[PyGLM]: https://github.com/Zuzu-Typ/PyGLM
[bx-python]: https://github.com/bxlab/bx-python
[boost-histogram]: https://github.com/scikit-hep/boost-histogram
[bx-python]: https://github.com/bxlab/bx-python
[iDynTree]: https://github.com/robotology/idyntree
[TgCrypto]: https://github.com/pyrogram/tgcrypto
[Python-WebRTC]: https://github.com/MarshalX/python-webrtc
@@ -196,12 +196,12 @@ title: Working examples
[Imagecodecs (fork)]: https://github.com/czaki/imagecodecs_build
[polaroid]: https://github.com/daggy1234/polaroid
[clang-format]: https://github.com/ssciwr/clang-format-wheel
[pyjet]: https://github.com/scikit-hep/pyjet
[numpythia]: https://github.com/scikit-hep/numpythia
[power-grid-model]: https://github.com/alliander-opensource/power-grid-model
[pyjet]: https://github.com/scikit-hep/pyjet
[pillow-heif]: https://github.com/bigcat88/pillow_heif
[pybind11 scikit_build_example]: https://github.com/pybind/scikit_build_example
[ninja]: https://github.com/scikit-build/ninja-python-distributions
[pillow-heif]: https://github.com/bigcat88/pillow_heif
[GSD]: https://github.com/glotzerlab/gsd
[pyinstrument_cext]: https://github.com/joerick/pyinstrument_cext
[xmlstarlet]: https://github.com/dimitern/xmlstarlet
@@ -218,105 +218,105 @@ title: Working examples
[apple icon]: data/readme_icons/apple.svg
[linux icon]: data/readme_icons/linux.svg
<!-- scikit-learn: 50139, last pushed 0 days ago -->
<!-- Tornado: 20546, last pushed 18 days ago -->
<!-- NumPy: 20488, last pushed 0 days ago -->
<!-- pytorch-fairseq: 17023, last pushed 1 days ago -->
<!-- Matplotlib: 15520, last pushed 0 days ago -->
<!-- Kivy: 14633, last pushed 5 days ago -->
<!-- NCNN: 14617, last pushed 0 days ago -->
<!-- Prophet: 14454, last pushed 0 days ago -->
<!-- MyPy: 13130, last pushed 0 days ago -->
<!-- pydantic: 9970, last pushed 1 days ago -->
<!-- uvloop: 8623, last pushed 7 days ago -->
<!-- psutil: 8395, last pushed 1 days ago -->
<!-- MemRay: 8343, last pushed 2 days ago -->
<!-- vaex: 7075, last pushed 2 days ago -->
<!-- Google Benchmark: 6476, last pushed 0 days ago -->
<!-- Apache Beam: 5517, last pushed 0 days ago -->
<!-- asyncpg: 5481, last pushed 11 days ago -->
<!-- duckdb: 5058, last pushed 0 days ago -->
<!-- scikit-image: 4909, last pushed 2 days ago -->
<!-- PyGame: 4829, last pushed 0 days ago -->
<!-- cmake: 4767, last pushed 0 days ago -->
<!-- twisted-iocpsupport: 4602, last pushed 0 days ago -->
<!-- websockets: 3939, last pushed 7 days ago -->
<!-- cvxpy: 3925, last pushed 0 days ago -->
<!-- PyOxidizer: 3749, last pushed 7 days ago -->
<!-- UltraJSON: 3688, last pushed 4 days ago -->
<!-- Triton: 3635, last pushed 0 days ago -->
<!-- River: 3372, last pushed 0 days ago -->
<!-- OpenSpiel: 3185, last pushed 1 days ago -->
<!-- pyzmq: 3084, last pushed 0 days ago -->
<!-- aiortc: 2917, last pushed 12 days ago -->
<!-- vispy: 2872, last pushed 5 days ago -->
<!-- Implicit: 2787, last pushed 5 days ago -->
<!-- Confluent client for Kafka: 2780, last pushed 2 days ago -->
<!-- tinyobjloader: 2530, last pushed 146 days ago -->
<!-- Dependency Injector: 2119, last pushed 35 days ago -->
<!-- coverage.py: 2045, last pushed 0 days ago -->
<!-- PyCryptodome: 2004, last pushed 3 days ago -->
<!-- PyYAML: 1839, last pushed 11 days ago -->
<!-- numexpr: 1754, last pushed 32 days ago -->
<!-- h5py: 1735, last pushed 0 days ago -->
<!-- Wrapt: 1678, last pushed 21 days ago -->
<!-- PyAV: 1563, last pushed 3 days ago -->
<!-- SimpleJSON: 1487, last pushed 30 days ago -->
<!-- OpenColorIO: 1311, last pushed 1 days ago -->
<!-- pikepdf: 1221, last pushed 0 days ago -->
<!-- Line Profiler: 1214, last pushed 17 days ago -->
<!-- PyTables: 1125, last pushed 33 days ago -->
<!-- OpenTimelineIO: 1055, last pushed 0 days ago -->
<!-- ruptures: 962, last pushed 5 days ago -->
<!-- aioquic: 926, last pushed 13 days ago -->
<!-- DeepForest: 758, last pushed 8 days ago -->
<!-- google neuroglancer: 734, last pushed 2 days ago -->
<!-- Psycopg 3: 676, last pushed 0 days ago -->
<!-- Parselmouth: 658, last pushed 48 days ago -->
<!-- AutoPy: 643, last pushed 148 days ago -->
<!-- H3-py: 523, last pushed 1 days ago -->
<!-- Rtree: 480, last pushed 33 days ago -->
<!-- markupsafe: 471, last pushed 21 days ago -->
<!-- python-rapidjson: 452, last pushed 75 days ago -->
<!-- python-snappy: 435, last pushed 67 days ago -->
<!-- pybind11 cmake_example: 402, last pushed 3 days ago -->
<!-- KDEpy: 373, last pushed 101 days ago -->
<!-- tgcalls: 356, last pushed 15 days ago -->
<!-- pybind11 python_example: 324, last pushed 10 days ago -->
<!-- dd-trace-py: 322, last pushed 2 days ago -->
<!-- sourmash: 305, last pushed 2 days ago -->
<!-- time-machine: 300, last pushed 1 days ago -->
<!-- cyvcf2: 297, last pushed 2 days ago -->
<!-- CTranslate2: 271, last pushed 2 days ago -->
<!-- abess: 263, last pushed 0 days ago -->
<!-- matrixprofile: 259, last pushed 331 days ago -->
<!-- jq.py: 215, last pushed 105 days ago -->
<!-- iminuit: 205, last pushed 6 days ago -->
<!-- Tokenizer: 179, last pushed 76 days ago -->
<!-- PyGLM: 139, last pushed 55 days ago -->
<!-- bx-python: 113, last pushed 137 days ago -->
<!-- boost-histogram: 113, last pushed 4 days ago -->
<!-- iDynTree: 105, last pushed 3 days ago -->
<!-- TgCrypto: 104, last pushed 79 days ago -->
<!-- Python-WebRTC: 89, last pushed 73 days ago -->
<!-- pybase64: 83, last pushed 3 days ago -->
<!-- Arbor: 72, last pushed 2 days ago -->
<!-- fathon: 59, last pushed 186 days ago -->
<!-- etebase-py: 57, last pushed 146 days ago -->
<!-- Imagecodecs (fork): 43, last pushed 5 days ago -->
<!-- polaroid: 38, last pushed 11 days ago -->
<!-- clang-format: 37, last pushed 17 days ago -->
<!-- pyjet: 33, last pushed 19 days ago -->
<!-- numpythia: 33, last pushed 20 days ago -->
<!-- power-grid-model: 32, last pushed 0 days ago -->
<!-- pybind11 scikit_build_example: 25, last pushed 2 days ago -->
<!-- ninja: 24, last pushed 13 days ago -->
<!-- pillow-heif: 21, last pushed 4 days ago -->
<!-- GSD: 19, last pushed 20 days ago -->
<!-- pyinstrument_cext: 10, last pushed 226 days ago -->
<!-- xmlstarlet: 9, last pushed 6 days ago -->
<!-- CorrectionLib: 9, last pushed 23 days ago -->
<!-- SiPM: 6, last pushed 2 days ago -->
<!-- scikit-learn: 50552, last pushed 0 days ago -->
<!-- NumPy: 20789, last pushed 0 days ago -->
<!-- Tornado: 20596, last pushed 4 days ago -->
<!-- pytorch-fairseq: 17326, last pushed 2 days ago -->
<!-- Matplotlib: 15701, last pushed 0 days ago -->
<!-- NCNN: 14830, last pushed 0 days ago -->
<!-- Kivy: 14729, last pushed 4 days ago -->
<!-- Prophet: 14599, last pushed 1 days ago -->
<!-- MyPy: 13302, last pushed 0 days ago -->
<!-- pydantic: 10245, last pushed 4 days ago -->
<!-- MemRay: 8722, last pushed 4 days ago -->
<!-- uvloop: 8690, last pushed 5 days ago -->
<!-- psutil: 8491, last pushed 1 days ago -->
<!-- vaex: 7130, last pushed 0 days ago -->
<!-- Google Benchmark: 6593, last pushed 5 days ago -->
<!-- Apache Beam: 5624, last pushed 0 days ago -->
<!-- asyncpg: 5532, last pushed 10 days ago -->
<!-- duckdb: 5387, last pushed 0 days ago -->
<!-- scikit-image: 4952, last pushed 3 days ago -->
<!-- PyGame: 4921, last pushed 0 days ago -->
<!-- cmake: 4852, last pushed 0 days ago -->
<!-- twisted-iocpsupport: 4636, last pushed 1 days ago -->
<!-- websockets: 3990, last pushed 0 days ago -->
<!-- cvxpy: 3977, last pushed 0 days ago -->
<!-- PyOxidizer: 3892, last pushed 9 days ago -->
<!-- UltraJSON: 3735, last pushed 6 days ago -->
<!-- Triton: 3683, last pushed 0 days ago -->
<!-- River: 3458, last pushed 4 days ago -->
<!-- OpenSpiel: 3226, last pushed 0 days ago -->
<!-- pyzmq: 3111, last pushed 1 days ago -->
<!-- aiortc: 2963, last pushed 1 days ago -->
<!-- vispy: 2892, last pushed 1 days ago -->
<!-- Implicit: 2821, last pushed 2 days ago -->
<!-- Confluent client for Kafka: 2817, last pushed 2 days ago -->
<!-- tinyobjloader: 2570, last pushed 7 days ago -->
<!-- Dependency Injector: 2193, last pushed 70 days ago -->
<!-- coverage.py: 2081, last pushed 6 days ago -->
<!-- PyCryptodome: 2025, last pushed 1 days ago -->
<!-- PyYAML: 1868, last pushed 17 days ago -->
<!-- numexpr: 1765, last pushed 1 days ago -->
<!-- h5py: 1747, last pushed 0 days ago -->
<!-- Wrapt: 1689, last pushed 56 days ago -->
<!-- PyAV: 1591, last pushed 1 days ago -->
<!-- SimpleJSON: 1495, last pushed 65 days ago -->
<!-- pikepdf: 1356, last pushed 2 days ago -->
<!-- OpenColorIO: 1327, last pushed 5 days ago -->
<!-- Line Profiler: 1262, last pushed 3 days ago -->
<!-- PyTables: 1133, last pushed 68 days ago -->
<!-- OpenTimelineIO: 1067, last pushed 0 days ago -->
<!-- ruptures: 979, last pushed 40 days ago -->
<!-- aioquic: 966, last pushed 1 days ago -->
<!-- DeepForest: 763, last pushed 43 days ago -->
<!-- google neuroglancer: 739, last pushed 3 days ago -->
<!-- Psycopg 3: 704, last pushed 2 days ago -->
<!-- Parselmouth: 668, last pushed 3 days ago -->
<!-- AutoPy: 658, last pushed 183 days ago -->
<!-- H3-py: 539, last pushed 18 days ago -->
<!-- Rtree: 483, last pushed 68 days ago -->
<!-- markupsafe: 474, last pushed 13 days ago -->
<!-- python-rapidjson: 454, last pushed 32 days ago -->
<!-- python-snappy: 438, last pushed 102 days ago -->
<!-- pybind11 cmake_example: 415, last pushed 9 days ago -->
<!-- KDEpy: 379, last pushed 136 days ago -->
<!-- tgcalls: 369, last pushed 22 days ago -->
<!-- pybind11 python_example: 333, last pushed 6 days ago -->
<!-- dd-trace-py: 331, last pushed 0 days ago -->
<!-- sourmash: 310, last pushed 1 days ago -->
<!-- CTranslate2: 306, last pushed 3 days ago -->
<!-- time-machine: 306, last pushed 2 days ago -->
<!-- cyvcf2: 300, last pushed 37 days ago -->
<!-- matrixprofile: 268, last pushed 12 days ago -->
<!-- abess: 266, last pushed 1 days ago -->
<!-- jq.py: 219, last pushed 140 days ago -->
<!-- iminuit: 206, last pushed 4 days ago -->
<!-- Tokenizer: 187, last pushed 111 days ago -->
<!-- PyGLM: 144, last pushed 90 days ago -->
<!-- boost-histogram: 115, last pushed 3 days ago -->
<!-- bx-python: 113, last pushed 172 days ago -->
<!-- iDynTree: 106, last pushed 3 days ago -->
<!-- TgCrypto: 105, last pushed 114 days ago -->
<!-- Python-WebRTC: 91, last pushed 108 days ago -->
<!-- pybase64: 84, last pushed 3 days ago -->
<!-- Arbor: 76, last pushed 2 days ago -->
<!-- fathon: 63, last pushed 24 days ago -->
<!-- etebase-py: 58, last pushed 10 days ago -->
<!-- Imagecodecs (fork): 46, last pushed 11 days ago -->
<!-- polaroid: 41, last pushed 46 days ago -->
<!-- clang-format: 40, last pushed 13 days ago -->
<!-- numpythia: 34, last pushed 6 days ago -->
<!-- power-grid-model: 34, last pushed 1 days ago -->
<!-- pyjet: 33, last pushed 5 days ago -->
<!-- pillow-heif: 30, last pushed 0 days ago -->
<!-- pybind11 scikit_build_example: 27, last pushed 6 days ago -->
<!-- ninja: 24, last pushed 6 days ago -->
<!-- GSD: 19, last pushed 3 days ago -->
<!-- pyinstrument_cext: 10, last pushed 261 days ago -->
<!-- xmlstarlet: 9, last pushed 13 days ago -->
<!-- CorrectionLib: 9, last pushed 6 days ago -->
<!-- SiPM: 6, last pushed 25 days ago -->
<!-- END bin/projects.py -->
+1 -1
View File
@@ -12,7 +12,7 @@ stack: python 3.7
init:
- cmd: set PATH=C:\Python37;C:\Python37\Scripts;%PATH%
install: python -m pip install cibuildwheel==2.6.0
install: python -m pip install cibuildwheel==2.8.0
build_script: python -m cibuildwheel --output-dir wheelhouse
+3 -3
View File
@@ -6,7 +6,7 @@ jobs:
- bash: |
set -o errexit
python3 -m pip install --upgrade pip
pip3 install cibuildwheel==2.6.0
pip3 install cibuildwheel==2.8.0
displayName: Install dependencies
- bash: cibuildwheel --output-dir wheelhouse .
displayName: Build wheels
@@ -20,7 +20,7 @@ jobs:
- bash: |
set -o errexit
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel==2.6.0
python3 -m pip install cibuildwheel==2.8.0
displayName: Install dependencies
- bash: cibuildwheel --output-dir wheelhouse .
displayName: Build wheels
@@ -34,7 +34,7 @@ jobs:
- bash: |
set -o errexit
python -m pip install --upgrade pip
pip install cibuildwheel==2.6.0
pip install cibuildwheel==2.8.0
displayName: Install dependencies
- bash: cibuildwheel --output-dir wheelhouse .
displayName: Build wheels
+2 -2
View File
@@ -11,7 +11,7 @@ jobs:
- run:
name: Build the Linux wheels.
command: |
pip3 install --user cibuildwheel==2.6.0
pip3 install --user cibuildwheel==2.8.0
cibuildwheel --output-dir wheelhouse
- store_artifacts:
path: wheelhouse/
@@ -25,7 +25,7 @@ jobs:
- run:
name: Build the OS X wheels.
command: |
pip3 install cibuildwheel==2.6.0
pip3 install cibuildwheel==2.8.0
cibuildwheel --output-dir wheelhouse
- store_artifacts:
path: wheelhouse/
+3 -3
View File
@@ -7,13 +7,13 @@ jobs:
name: Build wheels on macos-10.15
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/cibuildwheel@v2.6.0
uses: pypa/cibuildwheel@v2.8.0
env:
CIBW_ARCHS_MACOS: x86_64 universal2
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
+9 -7
View File
@@ -19,12 +19,12 @@ jobs:
os: [ubuntu-20.04, windows-2019, macos-10.15]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/cibuildwheel@v2.6.0
uses: pypa/cibuildwheel@v2.8.0
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
@@ -32,12 +32,12 @@ jobs:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
@@ -49,12 +49,14 @@ jobs:
# alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@v1.4.2
- uses: pypa/gh-action-pypi-publish@v1.5.0
with:
user: __token__
password: ${{ secrets.pypi_password }}
+8 -4
View File
@@ -11,14 +11,18 @@ jobs:
os: [ubuntu-20.04, windows-2019, macos-10.15]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/cibuildwheel@v2.6.0
# to supply options, put them in 'env', like:
uses: pypa/cibuildwheel@v2.8.0
# env:
# CIBW_SOME_OPTION: value
# ...
# with:
# package-dir: .
# output-dir: wheelhouse
# config-file: {package}/pyproject.toml
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
+4 -4
View File
@@ -11,9 +11,9 @@ jobs:
os: [ubuntu-20.04, windows-2019, macos-10.15]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
name: Install Python
with:
python-version: '3.7'
@@ -25,12 +25,12 @@ jobs:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v2.6.0
uses: pypa/cibuildwheel@v2.8.0
env:
# configure cibuildwheel to build native archs ('auto'), and some
# emulated ones
CIBW_ARCHS_LINUX: auto aarch64 ppc64le s390x
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
+1 -1
View File
@@ -12,7 +12,7 @@ linux:
DOCKER_TLS_CERTDIR: ""
script:
- curl -sSL https://get.docker.com/ | sh
- python -m pip install cibuildwheel==2.6.0
- python -m pip install cibuildwheel==2.8.0
- cibuildwheel --output-dir wheelhouse
artifacts:
paths:
+1 -1
View File
@@ -19,7 +19,7 @@ jobs:
- ln -s /c/Python38/python.exe /c/Python38/python3.exe
install:
- python3 -m pip install cibuildwheel==2.6.0
- python3 -m pip install cibuildwheel==2.8.0
script:
# build the wheels, put them into './dist'
+1 -1
View File
@@ -25,7 +25,7 @@ jobs:
- ln -s /c/Python38/python.exe /c/Python38/python3.exe
install:
- python3 -m pip install cibuildwheel==2.6.0
- python3 -m pip install cibuildwheel==2.8.0
script:
# build the wheels, put them into './wheelhouse'
+2 -2
View File
@@ -55,7 +55,7 @@ jobs:
- stage: deploy
name: Build and deploy Linux wheels
services: docker
install: python3 -m pip install cibuildwheel==2.6.0 twine
install: python3 -m pip install cibuildwheel==2.8.0 twine
script: python3 -m cibuildwheel --output-dir wheelhouse
after_success: python3 -m twine upload --skip-existing wheelhouse/*.whl
# Deploy on windows
@@ -63,7 +63,7 @@ jobs:
name: Build and deploy Windows wheels
os: windows
language: shell
install: python3 -m pip install cibuildwheel==2.6.0 twine
install: python3 -m pip install cibuildwheel==2.8.0 twine
script: python3 -m cibuildwheel --output-dir wheelhouse
after_success: python3 -m twine upload --skip-existing wheelhouse/*.whl
+3 -3
View File
@@ -1,6 +1,6 @@
[metadata]
name = cibuildwheel
version = 2.6.0
version = 2.8.0
description = Build Python wheels on CI with minimal configuration.
long_description = file: README.md
long_description_content_type = text/markdown
@@ -56,8 +56,8 @@ console_scripts =
cibuildwheel = resources/*
[flake8]
extend-ignore = E203,E501,B950
extend-select = B,B9
extend-ignore = E203,E501,B950,B023
extend-select = B9
application-import-names = cibuildwheel
exclude =
cibuildwheel/resources/,
+1
View File
@@ -14,6 +14,7 @@ extras = {
"pytest-timeout",
"pytest-xdist",
"build",
"tomli_w",
],
"bin": [
"click",
+1 -14
View File
@@ -7,20 +7,7 @@ def pytest_addoption(parser) -> None:
parser.addoption(
"--run-emulation", action="store_true", default=False, help="run emulation tests"
)
def pytest_configure(config):
config.addinivalue_line("markers", "emulation: mark test requiring qemu binfmt_misc to run")
def pytest_collection_modifyitems(config, items) -> None:
if config.getoption("--run-emulation"):
# --run-emulation given in cli: do not skip emulation tests
return
skip_emulation = pytest.mark.skip(reason="need --run-emulation option to run")
for item in items:
if "emulation" in item.keywords:
item.add_marker(skip_emulation)
parser.addoption("--run-podman", action="store_true", default=False, help="run podman tests")
@pytest.fixture(
+179
View File
@@ -0,0 +1,179 @@
import textwrap
from . import test_projects, utils
limited_api_project = test_projects.new_c_project(
setup_py_add=textwrap.dedent(
r"""
cmdclass = {}
extension_kwargs = {}
if sys.version_info[:2] >= (3, 8):
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
class bdist_wheel_abi3(_bdist_wheel):
def finalize_options(self):
_bdist_wheel.finalize_options(self)
self.root_is_pure = False
def get_tag(self):
python, abi, plat = _bdist_wheel.get_tag(self)
return python, "abi3", plat
cmdclass["bdist_wheel"] = bdist_wheel_abi3
extension_kwargs["define_macros"] = [("Py_LIMITED_API", "0x03080000")]
extension_kwargs["py_limited_api"] = True
"""
),
setup_py_extension_args_add="**extension_kwargs",
setup_py_setup_args_add="cmdclass=cmdclass",
)
def test_abi3(tmp_path):
project_dir = tmp_path / "project"
limited_api_project.generate(project_dir)
# build the wheels
actual_wheels = utils.cibuildwheel_run(
project_dir,
add_env={
"CIBW_SKIP": "pp* ", # PyPy does not have a Py_LIMITED_API equivalent
},
)
# check that the expected wheels are produced
expected_wheels = [
w.replace("cp38-cp38", "cp38-abi3")
for w in utils.expected_wheels("spam", "0.1.0")
if "-pp" not in w and "-cp39" not in w and "-cp310" not in w and "-cp311" not in w
]
assert set(actual_wheels) == set(expected_wheels)
ctypes_project = test_projects.TestProject()
ctypes_project.files["setup.py"] = textwrap.dedent(
"""
from setuptools import setup, Extension
from distutils.command.build_ext import build_ext as _build_ext
class CTypesExtension(Extension): pass
class build_ext(_build_ext):
def build_extension(self, ext):
self._ctypes = isinstance(ext, CTypesExtension)
return super().build_extension(ext)
def get_export_symbols(self, ext):
if self._ctypes:
return ext.export_symbols
return super().get_export_symbols(ext)
def get_ext_filename(self, ext_name):
if self._ctypes:
return ext_name + '.so'
return super().get_ext_filename(ext_name)
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
class bdist_wheel_abi_none(_bdist_wheel):
def finalize_options(self):
_bdist_wheel.finalize_options(self)
self.root_is_pure = False
def get_tag(self):
python, abi, plat = _bdist_wheel.get_tag(self)
return "py3", "none", plat
setup(
name="ctypesexample",
version="1.0.0",
py_modules = ["ctypesexample.summing"],
ext_modules=[
CTypesExtension(
"ctypesexample.csumlib",
["ctypesexample/csumlib.c"],
),
],
cmdclass={'build_ext': build_ext, 'bdist_wheel': bdist_wheel_abi_none},
)
"""
)
ctypes_project.files["ctypesexample/csumlib.c"] = textwrap.dedent(
"""
#ifdef _WIN32
#define LIBRARY_API __declspec(dllexport)
#else
#define LIBRARY_API
#endif
#include <stdlib.h>
LIBRARY_API double *add_vec3(double *a, double *b)
{
double *res = malloc(sizeof(double) * 3);
for (int i = 0; i < 3; ++i)
{
res[i] = a[i] + b[i];
}
return res;
}
"""
)
ctypes_project.files["ctypesexample/summing.py"] = textwrap.dedent(
"""
import ctypes
import pathlib
# path of the shared library
libfile = pathlib.Path(__file__).parent / "csumlib.so"
csumlib = ctypes.CDLL(str(libfile))
type_vec3 = ctypes.POINTER(ctypes.c_double * 3)
csumlib.add_vec3.restype = type_vec3
csumlib.add_vec3.argtypes = [type_vec3, type_vec3]
def add(a: list, b: list) -> list:
a_p = (ctypes.c_double * 3)(*a)
b_p = (ctypes.c_double * 3)(*b)
r_p = csumlib.add_vec3(a_p,b_p)
return [l for l in r_p.contents]
"""
)
ctypes_project.files["test/add_test.py"] = textwrap.dedent(
"""
import ctypesexample.summing
def test():
a = [1, 2, 3]
b = [4, 5, 6]
assert ctypesexample.summing.add(a, b) == [5, 7, 9]
"""
)
def test_abi_none(tmp_path, capfd):
project_dir = tmp_path / "project"
ctypes_project.generate(project_dir)
# build the wheels
actual_wheels = utils.cibuildwheel_run(
project_dir,
add_env={
"CIBW_TEST_REQUIRES": "pytest",
"CIBW_TEST_COMMAND": "pytest {project}/test",
# limit the number of builds for test performance reasons
"CIBW_BUILD": "cp38-* cp310-* pp39-*",
},
)
# check that the expected wheels are produced
expected_wheels = utils.expected_wheels("ctypesexample", "1.0.0", python_abi_tags=["py3-none"])
assert set(actual_wheels) == set(expected_wheels)
# check that each wheel was built once, and reused
captured = capfd.readouterr()
assert "Building wheel..." in captured.out
assert "Found previously built wheel" in captured.out
+4 -2
View File
@@ -17,8 +17,10 @@ def test_spam():
"""
@pytest.mark.emulation
def test(tmp_path):
def test(tmp_path, request):
if not request.config.getoption("--run-emulation"):
pytest.skip("needs --run-emulation option to run")
project_dir = tmp_path / "project"
project_with_a_test.generate(project_dir)
-50
View File
@@ -1,50 +0,0 @@
import textwrap
from . import test_projects, utils
limited_api_project = test_projects.new_c_project(
setup_py_add=textwrap.dedent(
r"""
cmdclass = {}
extension_kwargs = {}
if sys.version_info[:2] >= (3, 8):
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
class bdist_wheel_abi3(_bdist_wheel):
def finalize_options(self):
_bdist_wheel.finalize_options(self)
self.root_is_pure = False
def get_tag(self):
python, abi, plat = _bdist_wheel.get_tag(self)
return python, "abi3", plat
cmdclass["bdist_wheel"] = bdist_wheel_abi3
extension_kwargs["define_macros"] = [("Py_LIMITED_API", "0x03080000")]
extension_kwargs["py_limited_api"] = True
"""
),
setup_py_extension_args_add="**extension_kwargs",
setup_py_setup_args_add="cmdclass=cmdclass",
)
def test(tmp_path):
project_dir = tmp_path / "project"
limited_api_project.generate(project_dir)
# build the wheels
actual_wheels = utils.cibuildwheel_run(
project_dir,
add_env={
"CIBW_SKIP": "pp* ", # PyPy does not have a Py_LIMITED_API equivalent
},
)
# check that the expected wheels are produced
expected_wheels = [
w.replace("cp38-cp38", "cp38-abi3")
for w in utils.expected_wheels("spam", "0.1.0")
if "-pp" not in w and "-cp39" not in w and "-cp310" not in w and "-cp311" not in w
]
assert set(actual_wheels) == set(expected_wheels)
+26 -5
View File
@@ -21,17 +21,24 @@ project_with_manylinux_symbols = test_projects.new_c_project(
#if !__GLIBC_PREREQ(2, 5) /* manylinux1 is glibc 2.5 */
#error "Must run on a glibc >= 2.5 linux environment"
#endif
#if __GLIBC_PREREQ(2, 28)
#include <threads.h>
#endif
"""
),
spam_c_function_add=textwrap.dedent(
r"""
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 24)
#if __GLIBC_PREREQ(2, 28)
// thrd_equal & thrd_current are only available in manylinux_2_28+
sts = thrd_equal(thrd_current(), thrd_current()) ? 0 : 1;;
#elif __GLIBC_PREREQ(2, 24)
// nextupf is only available in manylinux_2_24+
sts = (int)nextupf(0.0F);
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 17) /* manylinux2014 is glibc 2.17 */
#elif __GLIBC_PREREQ(2, 17) /* manylinux2014 is glibc 2.17 */
// secure_getenv is only available in manylinux2014+
sts = (int)(intptr_t)secure_getenv("NON_EXISTING_ENV_VARIABLE");
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10) /* manylinux2010 is glibc 2.12 */
#elif __GLIBC_PREREQ(2, 10) /* manylinux2010 is glibc 2.12 */
// malloc_info is only available on manylinux2010+
sts = malloc_info(0, stdout);
#endif
@@ -41,14 +48,19 @@ project_with_manylinux_symbols = test_projects.new_c_project(
@pytest.mark.parametrize(
"manylinux_image", ["manylinux1", "manylinux2010", "manylinux2014", "manylinux_2_24"]
"manylinux_image",
["manylinux1", "manylinux2010", "manylinux2014", "manylinux_2_24", "manylinux_2_28"],
)
def test(manylinux_image, tmp_path):
if utils.platform != "linux":
pytest.skip("the docker test is only relevant to the linux build")
pytest.skip("the container image test is only relevant to the linux build")
elif platform.machine() not in ["x86_64", "i686"]:
if manylinux_image in ["manylinux1", "manylinux2010"]:
pytest.skip("manylinux1 and 2010 doesn't exist for non-x86 architectures")
elif manylinux_image == "manylinux_2_28" and platform.machine() == "s390x":
pytest.skip("manylinux_2_28 doesn't exist for s390x architecture")
elif manylinux_image == "manylinux_2_28" and platform.machine() == "i686":
pytest.skip("manylinux_2_28 doesn't exist for i686 architecture")
project_dir = tmp_path / "project"
project_with_manylinux_symbols.generate(project_dir)
@@ -74,6 +86,9 @@ def test(manylinux_image, tmp_path):
if manylinux_image in {"manylinux2010"}:
# We don't have a manylinux2010 image for PyPy 3.9, CPython 3.11
add_env["CIBW_SKIP"] = "pp39* cp311*"
if manylinux_image == "manylinux_2_28" and platform.machine() == "x86_64":
# We don't have a manylinux_2_28 image for i686
add_env["CIBW_ARCHS"] = "x86_64"
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env)
@@ -91,7 +106,13 @@ def test(manylinux_image, tmp_path):
if manylinux_image in {"manylinux1"}:
# remove PyPy & CPython 3.10 and above
expected_wheels = [w for w in expected_wheels if "-pp" not in w and "-cp31" not in w]
if manylinux_image in {"manylinux2010"}:
# remove PyPy 3.9 & CPython 3.11
expected_wheels = [w for w in expected_wheels if "-pp39" not in w and "-cp311" not in w]
if manylinux_image == "manylinux_2_28" and platform.machine() == "x86_64":
# We don't have a manylinux_2_28 image for i686
expected_wheels = [w for w in expected_wheels if "i686" not in w]
assert set(actual_wheels) == set(expected_wheels)
+38
View File
@@ -0,0 +1,38 @@
import pytest
from . import test_projects, utils
basic_project = test_projects.new_c_project()
def test(tmp_path, capfd, request):
if utils.platform != "linux":
pytest.skip("the test is only relevant to the linux build")
if not request.config.getoption("--run-podman"):
pytest.skip("needs --run-podman option to run")
project_dir = tmp_path / "project"
basic_project.generate(project_dir)
# build some musllinux and manylinux wheels (ensuring that we use two containers)
actual_wheels = utils.cibuildwheel_run(
project_dir,
add_env={
"CIBW_BUILD": "cp310-*{manylinux,musllinux}_x86_64",
"CIBW_BEFORE_ALL": "echo 'test log statement from before-all'",
"CIBW_CONTAINER_ENGINE": "podman",
},
)
# check that the expected wheels are produced
expected_wheels = [
w
for w in utils.expected_wheels("spam", "0.1.0")
if ("-cp310-" in w) and ("x86_64" in w) and ("manylinux" in w or "musllinux" in w)
]
assert set(actual_wheels) == set(expected_wheels)
# check that stdout is bring passed-though from container correctly
captured = capfd.readouterr()
assert "test log statement from before-all" in captured.out
+42
View File
@@ -0,0 +1,42 @@
import subprocess
from test import test_projects
import pytest
from . import utils
basic_project = test_projects.new_c_project()
basic_project.files[
"repair.py"
] = """
import shutil
import sys
from pathlib import Path
wheel = Path(sys.argv[1])
dest_dir = Path(sys.argv[2])
platform = wheel.stem.split("-")[-1]
name = f"spam-0.1.0-py2-none-{platform}.whl"
dest = dest_dir / name
dest_dir.mkdir(parents=True, exist_ok=True)
if dest.exists():
dest.unlink()
shutil.copy(wheel, dest)
"""
def test(tmp_path, capfd):
# this test checks that a generated wheel name shall be unique in a given cibuildwheel run
project_dir = tmp_path / "project"
basic_project.generate(project_dir)
with pytest.raises(subprocess.CalledProcessError):
utils.cibuildwheel_run(
project_dir,
add_env={
"CIBW_REPAIR_WHEEL_COMMAND": "python repair.py {wheel} {dest_dir}",
},
)
captured = capfd.readouterr()
assert "Build failed because a wheel named" in captured.err
+18 -16
View File
@@ -113,6 +113,7 @@ def expected_wheels(
musllinux_versions=None,
macosx_deployment_target="10.9",
machine_arch=None,
python_abi_tags=None,
):
"""
Returns a list of expected wheels from a run of cibuildwheel.
@@ -139,21 +140,22 @@ def expected_wheels(
if musllinux_versions is None:
musllinux_versions = ["musllinux_1_1"]
python_abi_tags = [
"cp36-cp36m",
"cp37-cp37m",
"cp38-cp38",
"cp39-cp39",
"cp310-cp310",
"cp311-cp311",
]
if python_abi_tags is None:
python_abi_tags = [
"cp36-cp36m",
"cp37-cp37m",
"cp38-cp38",
"cp39-cp39",
"cp310-cp310",
"cp311-cp311",
]
if machine_arch in ["x86_64", "AMD64", "x86", "aarch64"]:
python_abi_tags += ["pp37-pypy37_pp73", "pp38-pypy38_pp73", "pp39-pypy39_pp73"]
if machine_arch in ["x86_64", "AMD64", "x86", "aarch64"]:
python_abi_tags += ["pp37-pypy37_pp73", "pp38-pypy38_pp73", "pp39-pypy39_pp73"]
if platform == "macos" and machine_arch == "arm64":
# currently, arm64 macs are only supported by cp39, cp310 & cp311
python_abi_tags = ["cp39-cp39", "cp310-cp310", "cp311-cp311"]
if platform == "macos" and machine_arch == "arm64":
# currently, arm64 macs are only supported by cp39, cp310 & cp311
python_abi_tags = ["cp39-cp39", "cp310-cp310", "cp311-cp311"]
wheels = []
@@ -185,10 +187,10 @@ def expected_wheels(
)
elif platform == "windows":
if python_abi_tag.startswith("cp"):
platform_tags = ["win32", "win_amd64"]
else:
if python_abi_tag.startswith("pp"):
platform_tags = ["win_amd64"]
else:
platform_tags = ["win32", "win_amd64"]
elif platform == "macos":
if python_abi_tag == "cp39-cp39" and machine_arch == "arm64":
+11
View File
@@ -136,3 +136,14 @@ def test_build_limited_python_patch():
assert build_selector("cp36-manylinux_x86_64")
assert build_selector("cp37-manylinux_x86_64")
def test_testing_selector():
# local import to avoid pytest trying to collect this as a test class!
from cibuildwheel.util import TestSelector
test_selector = TestSelector(skip_config="cp36-*")
assert not test_selector("cp36-win_amd64")
assert test_selector("cp37-manylinux_x86_64")
assert test_selector("cp311-manylinux_x86_64")
+1 -14
View File
@@ -8,20 +8,7 @@ MOCK_PACKAGE_DIR = Path("some_package_dir")
def pytest_addoption(parser):
parser.addoption("--run-docker", action="store_true", default=False, help="run docker tests")
def pytest_configure(config):
config.addinivalue_line("markers", "docker: mark test requiring docker to run")
def pytest_collection_modifyitems(config, items):
if config.getoption("--run-docker"):
# --run-docker given in cli: do not skip docker tests
return
skip_docker = pytest.mark.skip(reason="need --run-docker option to run")
for item in items:
if "docker" in item.keywords:
item.add_marker(skip_docker)
parser.addoption("--run-podman", action="store_true", default=False, help="run podman tests")
@pytest.fixture
-202
View File
@@ -1,202 +0,0 @@
import platform
import random
import shutil
import subprocess
import textwrap
from pathlib import Path, PurePath
import pytest
from cibuildwheel.docker_container import DockerContainer
from cibuildwheel.environment import EnvironmentAssignmentBash
# for these tests we use manylinux2014 images, because they're available on
# multi architectures and include python3.8
pm = platform.machine()
if pm == "x86_64":
DEFAULT_IMAGE = "quay.io/pypa/manylinux2014_x86_64:2020-05-17-2f8ac3b"
elif pm == "aarch64":
DEFAULT_IMAGE = "quay.io/pypa/manylinux2014_aarch64:2020-05-17-2f8ac3b"
elif pm == "ppc64le":
DEFAULT_IMAGE = "quay.io/pypa/manylinux2014_ppc64le:2020-05-17-2f8ac3b"
elif pm == "s390x":
DEFAULT_IMAGE = "quay.io/pypa/manylinux2014_s390x:2020-05-17-2f8ac3b"
@pytest.mark.docker
def test_simple():
with DockerContainer(docker_image=DEFAULT_IMAGE) as container:
assert container.call(["echo", "hello"], capture_output=True) == "hello\n"
@pytest.mark.docker
def test_no_lf():
with DockerContainer(docker_image=DEFAULT_IMAGE) as container:
assert container.call(["printf", "hello"], capture_output=True) == "hello"
@pytest.mark.docker
def test_environment():
with DockerContainer(docker_image=DEFAULT_IMAGE) as container:
assert (
container.call(
["sh", "-c", "echo $TEST_VAR"], env={"TEST_VAR": "1"}, capture_output=True
)
== "1\n"
)
@pytest.mark.docker
def test_cwd():
with DockerContainer(
docker_image=DEFAULT_IMAGE, cwd="/cibuildwheel/working_directory"
) as container:
assert container.call(["pwd"], capture_output=True) == "/cibuildwheel/working_directory\n"
assert container.call(["pwd"], capture_output=True, cwd="/opt") == "/opt\n"
@pytest.mark.docker
def test_container_removed():
with DockerContainer(docker_image=DEFAULT_IMAGE) as container:
docker_containers_listing = subprocess.run(
"docker container ls",
shell=True,
check=True,
stdout=subprocess.PIPE,
universal_newlines=True,
).stdout
assert container.name is not None
assert container.name in docker_containers_listing
old_container_name = container.name
docker_containers_listing = subprocess.run(
"docker container ls",
shell=True,
check=True,
stdout=subprocess.PIPE,
universal_newlines=True,
).stdout
assert old_container_name not in docker_containers_listing
@pytest.mark.docker
def test_large_environment():
# max environment variable size is 128kB
long_env_var_length = 127 * 1024
large_environment = {
"a": "0" * long_env_var_length,
"b": "0" * long_env_var_length,
"c": "0" * long_env_var_length,
"d": "0" * long_env_var_length,
}
with DockerContainer(docker_image=DEFAULT_IMAGE) as container:
# check the length of d
assert (
container.call(["sh", "-c", "echo ${#d}"], env=large_environment, capture_output=True)
== f"{long_env_var_length}\n"
)
@pytest.mark.docker
def test_binary_output():
with DockerContainer(docker_image=DEFAULT_IMAGE) as container:
# note: the below embedded snippets are in python2
# check that we can pass though arbitrary binary data without erroring
container.call(
[
"/usr/bin/python2",
"-c",
textwrap.dedent(
"""
import sys
sys.stdout.write(''.join(chr(n) for n in range(0, 256)))
"""
),
]
)
# check that we can capture arbitrary binary data
output = container.call(
[
"/usr/bin/python2",
"-c",
textwrap.dedent(
"""
import sys
sys.stdout.write(''.join(chr(n % 256) for n in range(0, 512)))
"""
),
],
capture_output=True,
)
data = bytes(output, encoding="utf8", errors="surrogateescape")
for i in range(512):
assert data[i] == i % 256
# check that environment variables can carry binary data, except null characters
# (https://www.gnu.org/software/libc/manual/html_node/Environment-Variables.html)
binary_data = bytes(n for n in range(1, 256))
binary_data_string = str(binary_data, encoding="utf8", errors="surrogateescape")
output = container.call(
["python2", "-c", 'import os, sys; sys.stdout.write(os.environ["TEST_VAR"])'],
env={"TEST_VAR": binary_data_string},
capture_output=True,
)
assert output == binary_data_string
@pytest.mark.docker
def test_file_operations(tmp_path: Path):
with DockerContainer(docker_image=DEFAULT_IMAGE) as container:
# test copying a file in
test_binary_data = bytes(random.randrange(256) for _ in range(1000))
original_test_file = tmp_path / "test.dat"
original_test_file.write_bytes(test_binary_data)
dst_file = PurePath("/tmp/test.dat")
container.copy_into(original_test_file, dst_file)
output = container.call(["cat", dst_file], capture_output=True)
assert test_binary_data == bytes(output, encoding="utf8", errors="surrogateescape")
@pytest.mark.docker
def test_dir_operations(tmp_path: Path):
with DockerContainer(docker_image=DEFAULT_IMAGE) as container:
test_binary_data = bytes(random.randrange(256) for _ in range(1000))
original_test_file = tmp_path / "test.dat"
original_test_file.write_bytes(test_binary_data)
# test copying a dir in
test_dir = tmp_path / "test_dir"
test_dir.mkdir()
test_file = test_dir / "test.dat"
shutil.copyfile(original_test_file, test_file)
dst_dir = PurePath("/tmp/test_dir")
dst_file = dst_dir / "test.dat"
container.copy_into(test_dir, dst_dir)
output = container.call(["cat", dst_file], capture_output=True)
assert test_binary_data == bytes(output, encoding="utf8", errors="surrogateescape")
# test glob
assert container.glob(dst_dir, "*.dat") == [dst_file]
# test copy dir out
new_test_dir = tmp_path / "test_dir_new"
container.copy_out(dst_dir, new_test_dir)
assert test_binary_data == (new_test_dir / "test.dat").read_bytes()
@pytest.mark.docker
def test_environment_executor():
with DockerContainer(docker_image=DEFAULT_IMAGE) as container:
assignment = EnvironmentAssignmentBash("TEST=$(echo 42)")
assert assignment.evaluated_value({}, container.environment_executor) == "42"
+9 -9
View File
@@ -2,8 +2,8 @@ import textwrap
from pathlib import Path
from pprint import pprint
import cibuildwheel.docker_container
import cibuildwheel.linux
import cibuildwheel.oci_container
from cibuildwheel.options import Options
from .utils import get_default_command_line_arguments
@@ -11,7 +11,7 @@ from .utils import get_default_command_line_arguments
def test_linux_container_split(tmp_path: Path, monkeypatch):
"""
Tests splitting linux builds by docker image and before_all
Tests splitting linux builds by container image and before_all
"""
args = get_default_command_line_arguments()
@@ -21,16 +21,16 @@ def test_linux_container_split(tmp_path: Path, monkeypatch):
textwrap.dedent(
"""
[tool.cibuildwheel]
manylinux-x86_64-image = "normal_docker_image"
manylinux-i686-image = "normal_docker_image"
manylinux-x86_64-image = "normal_container_image"
manylinux-i686-image = "normal_container_image"
build = "*-manylinux_x86_64"
skip = "pp*"
archs = "x86_64 i686"
[[tool.cibuildwheel.overrides]]
select = "cp{38,39,310}-*"
manylinux-x86_64-image = "other_docker_image"
manylinux-i686-image = "other_docker_image"
manylinux-x86_64-image = "other_container_image"
manylinux-i686-image = "other_container_image"
[[tool.cibuildwheel.overrides]]
select = "cp39-*"
@@ -57,14 +57,14 @@ def test_linux_container_split(tmp_path: Path, monkeypatch):
pprint(build_steps)
assert build_steps[0].docker_image == "normal_docker_image"
assert build_steps[0].container_image == "normal_container_image"
assert identifiers(build_steps[0]) == ["cp36-manylinux_x86_64", "cp37-manylinux_x86_64"]
assert before_alls(build_steps[0]) == ["", ""]
assert build_steps[1].docker_image == "other_docker_image"
assert build_steps[1].container_image == "other_container_image"
assert identifiers(build_steps[1]) == ["cp38-manylinux_x86_64", "cp310-manylinux_x86_64"]
assert before_alls(build_steps[1]) == ["", ""]
assert build_steps[2].docker_image == "other_docker_image"
assert build_steps[2].container_image == "other_container_image"
assert identifiers(build_steps[2]) == ["cp39-manylinux_x86_64"]
assert before_alls(build_steps[2]) == ["echo 'a cp39-only command'"]
+4 -2
View File
@@ -11,7 +11,7 @@ else:
from cibuildwheel.__main__ import main
from cibuildwheel.environment import ParsedEnvironment
from cibuildwheel.options import BuildOptions, _get_pinned_docker_images
from cibuildwheel.options import BuildOptions, _get_pinned_container_images
from cibuildwheel.util import BuildSelector, resources_dir
# CIBW_PLATFORM is tested in main_platform_test.py
@@ -80,6 +80,7 @@ def test_empty_selector(platform, intercepted_build_args, monkeypatch):
("x86_64", "manylinux2010", "quay.io/pypa/manylinux2010_x86_64:*"),
("x86_64", "manylinux2014", "quay.io/pypa/manylinux2014_x86_64:*"),
("x86_64", "manylinux_2_24", "quay.io/pypa/manylinux_2_24_x86_64:*"),
("x86_64", "manylinux_2_28", "quay.io/pypa/manylinux_2_28_x86_64:*"),
("x86_64", "custom_image", "custom_image"),
("i686", None, "quay.io/pypa/manylinux2014_i686:*"),
("i686", "manylinux1", "quay.io/pypa/manylinux1_i686:*"),
@@ -92,6 +93,7 @@ def test_empty_selector(platform, intercepted_build_args, monkeypatch):
("pypy_x86_64", "manylinux2010", "quay.io/pypa/manylinux2010_x86_64:*"),
("pypy_x86_64", "manylinux2014", "quay.io/pypa/manylinux2014_x86_64:*"),
("pypy_x86_64", "manylinux_2_24", "quay.io/pypa/manylinux_2_24_x86_64:*"),
("pypy_x86_64", "manylinux_2_28", "quay.io/pypa/manylinux_2_28_x86_64:*"),
("pypy_x86_64", "custom_image", "custom_image"),
],
)
@@ -337,6 +339,6 @@ def test_defaults(platform, intercepted_build_args):
if platform == "linux":
assert build_options.manylinux_images
pinned_images = _get_pinned_docker_images()
pinned_images = _get_pinned_container_images()
default_x86_64_image = pinned_images["x86_64"][defaults["manylinux-x86_64-image"]]
assert build_options.manylinux_images["x86_64"] == default_x86_64_image
+296
View File
@@ -0,0 +1,296 @@
import os
import platform
import random
import shutil
import subprocess
import textwrap
from pathlib import Path, PurePath, PurePosixPath
import pytest
import tomli_w
from cibuildwheel.environment import EnvironmentAssignmentBash
from cibuildwheel.oci_container import OCIContainer
# Test utilities
# for these tests we use manylinux2014 images, because they're available on
# multi architectures and include python3.8
pm = platform.machine()
if pm == "x86_64":
DEFAULT_IMAGE = "quay.io/pypa/manylinux2014_x86_64:2020-05-17-2f8ac3b"
elif pm == "aarch64":
DEFAULT_IMAGE = "quay.io/pypa/manylinux2014_aarch64:2020-05-17-2f8ac3b"
elif pm == "ppc64le":
DEFAULT_IMAGE = "quay.io/pypa/manylinux2014_ppc64le:2020-05-17-2f8ac3b"
elif pm == "s390x":
DEFAULT_IMAGE = "quay.io/pypa/manylinux2014_s390x:2020-05-17-2f8ac3b"
else:
DEFAULT_IMAGE = ""
@pytest.fixture(params=["docker", "podman"])
def container_engine(request):
if request.param == "docker" and not request.config.getoption("--run-docker"):
pytest.skip("need --run-docker option to run")
if request.param == "podman" and not request.config.getoption("--run-podman"):
pytest.skip("need --run-podman option to run")
return request.param
# Tests
def test_simple(container_engine):
with OCIContainer(engine=container_engine, image=DEFAULT_IMAGE) as container:
assert container.call(["echo", "hello"], capture_output=True) == "hello\n"
def test_no_lf(container_engine):
with OCIContainer(engine=container_engine, image=DEFAULT_IMAGE) as container:
assert container.call(["printf", "hello"], capture_output=True) == "hello"
def test_debug_info(container_engine):
container = OCIContainer(engine=container_engine, image=DEFAULT_IMAGE)
print(container.debug_info())
with container:
pass
def test_environment(container_engine):
with OCIContainer(engine=container_engine, image=DEFAULT_IMAGE) as container:
assert (
container.call(
["sh", "-c", "echo $TEST_VAR"], env={"TEST_VAR": "1"}, capture_output=True
)
== "1\n"
)
def test_cwd(container_engine):
with OCIContainer(
engine=container_engine, image=DEFAULT_IMAGE, cwd="/cibuildwheel/working_directory"
) as container:
assert container.call(["pwd"], capture_output=True) == "/cibuildwheel/working_directory\n"
assert container.call(["pwd"], capture_output=True, cwd="/opt") == "/opt\n"
def test_container_removed(container_engine):
with OCIContainer(engine=container_engine, image=DEFAULT_IMAGE) as container:
docker_containers_listing = subprocess.run(
f"{container.engine} container ls",
shell=True,
check=True,
stdout=subprocess.PIPE,
universal_newlines=True,
).stdout
assert container.name is not None
assert container.name in docker_containers_listing
old_container_name = container.name
docker_containers_listing = subprocess.run(
f"{container.engine} container ls",
shell=True,
check=True,
stdout=subprocess.PIPE,
universal_newlines=True,
).stdout
assert old_container_name not in docker_containers_listing
def test_large_environment(container_engine):
# max environment variable size is 128kB
long_env_var_length = 127 * 1024
large_environment = {
"a": "0" * long_env_var_length,
"b": "0" * long_env_var_length,
"c": "0" * long_env_var_length,
"d": "0" * long_env_var_length,
}
with OCIContainer(engine=container_engine, image=DEFAULT_IMAGE) as container:
# check the length of d
assert (
container.call(["sh", "-c", "echo ${#d}"], env=large_environment, capture_output=True)
== f"{long_env_var_length}\n"
)
def test_binary_output(container_engine):
with OCIContainer(engine=container_engine, image=DEFAULT_IMAGE) as container:
# note: the below embedded snippets are in python2
# check that we can pass though arbitrary binary data without erroring
container.call(
[
"/usr/bin/python2",
"-c",
textwrap.dedent(
"""
import sys
sys.stdout.write(''.join(chr(n) for n in range(0, 256)))
"""
),
]
)
# check that we can capture arbitrary binary data
output = container.call(
[
"/usr/bin/python2",
"-c",
textwrap.dedent(
"""
import sys
sys.stdout.write(''.join(chr(n % 256) for n in range(0, 512)))
"""
),
],
capture_output=True,
)
data = bytes(output, encoding="utf8", errors="surrogateescape")
for i in range(512):
assert data[i] == i % 256
# check that environment variables can carry binary data, except null characters
# (https://www.gnu.org/software/libc/manual/html_node/Environment-Variables.html)
binary_data = bytes(n for n in range(1, 256))
binary_data_string = str(binary_data, encoding="utf8", errors="surrogateescape")
output = container.call(
["python2", "-c", 'import os, sys; sys.stdout.write(os.environ["TEST_VAR"])'],
env={"TEST_VAR": binary_data_string},
capture_output=True,
)
assert output == binary_data_string
def test_file_operation(tmp_path: Path, container_engine):
with OCIContainer(engine=container_engine, image=DEFAULT_IMAGE) as container:
# test copying a file in
test_binary_data = bytes(random.randrange(256) for _ in range(1000))
original_test_file = tmp_path / "test.dat"
original_test_file.write_bytes(test_binary_data)
dst_file = PurePath("/tmp/test.dat")
container.copy_into(original_test_file, dst_file)
output = container.call(["cat", dst_file], capture_output=True)
assert test_binary_data == bytes(output, encoding="utf8", errors="surrogateescape")
def test_dir_operations(tmp_path: Path, container_engine):
with OCIContainer(engine=container_engine, image=DEFAULT_IMAGE) as container:
test_binary_data = bytes(random.randrange(256) for _ in range(1000))
original_test_file = tmp_path / "test.dat"
original_test_file.write_bytes(test_binary_data)
# test copying a dir in
test_dir = tmp_path / "test_dir"
test_dir.mkdir()
test_file = test_dir / "test.dat"
shutil.copyfile(original_test_file, test_file)
dst_dir = PurePosixPath("/tmp/test_dir")
dst_file = dst_dir / "test.dat"
container.copy_into(test_dir, dst_dir)
output = container.call(["cat", dst_file], capture_output=True)
assert test_binary_data == bytes(output, encoding="utf8", errors="surrogateescape")
# test glob
assert container.glob(dst_dir, "*.dat") == [dst_file]
# test copy dir out
new_test_dir = tmp_path / "test_dir_new"
container.copy_out(dst_dir, new_test_dir)
assert test_binary_data == (new_test_dir / "test.dat").read_bytes()
def test_environment_executor(container_engine):
with OCIContainer(engine=container_engine, image=DEFAULT_IMAGE) as container:
assignment = EnvironmentAssignmentBash("TEST=$(echo 42)")
assert assignment.evaluated_value({}, container.environment_executor) == "42"
def test_podman_vfs(tmp_path: Path, monkeypatch, request):
# Tests podman VFS, for the podman in docker use-case
if not request.config.getoption("--run-podman"):
pytest.skip("need --run-podman option to run")
# create the VFS configuration
vfs_path = tmp_path / "podman_vfs"
vfs_path.mkdir()
# This requires that we write configuration files and point to them
# with environment variables before we run podman
# https://github.com/containers/common/blob/main/docs/containers.conf.5.md
vfs_containers_conf_data = {
"containers": {
"default_capabilities": [
"CHOWN",
"DAC_OVERRIDE",
"FOWNER",
"FSETID",
"KILL",
"NET_BIND_SERVICE",
"SETFCAP",
"SETGID",
"SETPCAP",
"SETUID",
"SYS_CHROOT",
]
},
"engine": {"cgroup_manager": "cgroupfs", "events_logger": "file"},
}
# https://github.com/containers/storage/blob/main/docs/containers-storage.conf.5.md
storage_root = vfs_path / ".local/share/containers/vfs-storage"
run_root = vfs_path / ".local/share/containers/vfs-runroot"
storage_root.mkdir(parents=True, exist_ok=True)
run_root.mkdir(parents=True, exist_ok=True)
vfs_containers_storage_conf_data = {
"storage": {
"driver": "vfs",
"graphroot": os.fspath(storage_root),
"runroot": os.fspath(run_root),
"rootless_storage_path": os.fspath(storage_root),
"options": {
# "remap-user": "containers",
"aufs": {"mountopt": "rw"},
"overlay": {"mountopt": "rw", "force_mask": "shared"},
# "vfs": {"ignore_chown_errors": "true"},
},
}
}
vfs_containers_conf_fpath = vfs_path / "temp_vfs_containers.conf"
vfs_containers_storage_conf_fpath = vfs_path / "temp_vfs_containers_storage.conf"
with open(vfs_containers_conf_fpath, "wb") as file:
tomli_w.dump(vfs_containers_conf_data, file)
with open(vfs_containers_storage_conf_fpath, "wb") as file:
tomli_w.dump(vfs_containers_storage_conf_data, file)
monkeypatch.setenv("CONTAINERS_CONF", str(vfs_containers_conf_fpath))
monkeypatch.setenv("CONTAINERS_STORAGE_CONF", str(vfs_containers_storage_conf_fpath))
with OCIContainer(engine="podman", image=DEFAULT_IMAGE) as container:
# test running a command
assert container.call(["echo", "hello"], capture_output=True) == "hello\n"
# test copying a file into the container
(tmp_path / "some_file.txt").write_text("1234")
container.copy_into(tmp_path / "some_file.txt", PurePosixPath("some_file.txt"))
assert container.call(["cat", "some_file.txt"], capture_output=True) == "1234"
# Clean up
# When using the VFS, user is not given write permissions by default in
# new directories. As a workaround we use 'podman unshare' to delete them
# as UID 0. The reason why permission errors occur on podman is documented
# in https://podman.io/blogs/2018/10/03/podman-remove-content-homedir.html
subprocess.run(["podman", "unshare", "rm", "-rf", vfs_path], check=True)
+52 -50
View File
@@ -2,7 +2,7 @@ import platform as platform_module
import subprocess
import sys
from contextlib import contextmanager
from pathlib import Path
from pathlib import PurePosixPath
from typing import cast
from unittest import mock
@@ -15,7 +15,7 @@ ALL_IDS = {"cp36", "cp37", "cp38", "cp39", "cp310", "pp37", "pp38", "pp39"}
@pytest.fixture
def mock_build_docker(monkeypatch):
def mock_build_container(monkeypatch):
def fail_on_call(*args, **kwargs):
raise RuntimeError("This should never be called")
@@ -35,58 +35,60 @@ def mock_build_docker(monkeypatch):
monkeypatch.setattr(subprocess, "Popen", fail_on_call)
monkeypatch.setattr(subprocess, "run", ignore_call)
monkeypatch.setattr(util, "download", fail_on_call)
monkeypatch.setattr("cibuildwheel.linux.DockerContainer", ignore_context_call)
monkeypatch.setattr("cibuildwheel.linux.OCIContainer", ignore_context_call)
monkeypatch.setattr("cibuildwheel.linux.build_on_docker", mock.Mock(spec=linux.build_on_docker))
monkeypatch.setattr(
"cibuildwheel.linux.build_in_container", mock.Mock(spec=linux.build_in_container)
)
monkeypatch.setattr("cibuildwheel.util.print_new_wheels", ignore_context_call)
def test_build_default_launches(mock_build_docker, fake_package_dir, monkeypatch):
def test_build_default_launches(mock_build_container, fake_package_dir, monkeypatch):
monkeypatch.setattr(sys, "argv", ["cibuildwheel", "--platform=linux"])
main()
build_on_docker = cast(mock.Mock, linux.build_on_docker)
build_in_container = cast(mock.Mock, linux.build_in_container)
assert build_on_docker.call_count == 4
assert build_in_container.call_count == 4
# In Python 3.8+, this can be simplified to [0].kwargs
kwargs = build_on_docker.call_args_list[0][1]
assert "quay.io/pypa/manylinux2014_x86_64" in kwargs["docker"]["docker_image"]
assert kwargs["docker"]["cwd"] == Path("/project")
assert not kwargs["docker"]["simulate_32_bit"]
kwargs = build_in_container.call_args_list[0][1]
assert "quay.io/pypa/manylinux2014_x86_64" in kwargs["container"]["image"]
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
assert not kwargs["container"]["simulate_32_bit"]
identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {f"{x}-manylinux_x86_64" for x in ALL_IDS}
kwargs = build_on_docker.call_args_list[1][1]
assert "quay.io/pypa/manylinux2014_i686" in kwargs["docker"]["docker_image"]
assert kwargs["docker"]["cwd"] == Path("/project")
assert kwargs["docker"]["simulate_32_bit"]
kwargs = build_in_container.call_args_list[1][1]
assert "quay.io/pypa/manylinux2014_i686" in kwargs["container"]["image"]
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
assert kwargs["container"]["simulate_32_bit"]
identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {f"{x}-manylinux_i686" for x in ALL_IDS}
kwargs = build_on_docker.call_args_list[2][1]
assert "quay.io/pypa/musllinux_1_1_x86_64" in kwargs["docker"]["docker_image"]
assert kwargs["docker"]["cwd"] == Path("/project")
assert not kwargs["docker"]["simulate_32_bit"]
kwargs = build_in_container.call_args_list[2][1]
assert "quay.io/pypa/musllinux_1_1_x86_64" in kwargs["container"]["image"]
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
assert not kwargs["container"]["simulate_32_bit"]
identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {
f"{x}-musllinux_x86_64" for x in ALL_IDS for x in ALL_IDS if "pp" not in x
}
kwargs = build_on_docker.call_args_list[3][1]
assert "quay.io/pypa/musllinux_1_1_i686" in kwargs["docker"]["docker_image"]
assert kwargs["docker"]["cwd"] == Path("/project")
assert kwargs["docker"]["simulate_32_bit"]
kwargs = build_in_container.call_args_list[3][1]
assert "quay.io/pypa/musllinux_1_1_i686" in kwargs["container"]["image"]
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
assert kwargs["container"]["simulate_32_bit"]
identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {f"{x}-musllinux_i686" for x in ALL_IDS if "pp" not in x}
def test_build_with_override_launches(mock_build_docker, monkeypatch, tmp_path):
def test_build_with_override_launches(mock_build_container, monkeypatch, tmp_path):
pkg_dir = tmp_path / "cibw_package"
pkg_dir.mkdir()
@@ -113,23 +115,23 @@ before-all = "true"
main()
build_on_docker = cast(mock.Mock, linux.build_on_docker)
build_in_container = cast(mock.Mock, linux.build_in_container)
assert build_on_docker.call_count == 6
assert build_in_container.call_count == 6
kwargs = build_on_docker.call_args_list[0][1]
assert "quay.io/pypa/manylinux2014_x86_64" in kwargs["docker"]["docker_image"]
assert kwargs["docker"]["cwd"] == Path("/project")
assert not kwargs["docker"]["simulate_32_bit"]
kwargs = build_in_container.call_args_list[0][1]
assert "quay.io/pypa/manylinux2014_x86_64" in kwargs["container"]["image"]
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
assert not kwargs["container"]["simulate_32_bit"]
identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {"cp36-manylinux_x86_64"}
assert kwargs["options"].build_options("cp36-manylinux_x86_64").before_all == "true"
kwargs = build_on_docker.call_args_list[1][1]
assert "quay.io/pypa/manylinux2014_x86_64" in kwargs["docker"]["docker_image"]
assert kwargs["docker"]["cwd"] == Path("/project")
assert not kwargs["docker"]["simulate_32_bit"]
kwargs = build_in_container.call_args_list[1][1]
assert "quay.io/pypa/manylinux2014_x86_64" in kwargs["container"]["image"]
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
assert not kwargs["container"]["simulate_32_bit"]
identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {
@@ -137,10 +139,10 @@ before-all = "true"
}
assert kwargs["options"].build_options("cp37-manylinux_x86_64").before_all == ""
kwargs = build_on_docker.call_args_list[2][1]
assert "quay.io/pypa/manylinux_2_24_x86_64" in kwargs["docker"]["docker_image"]
assert kwargs["docker"]["cwd"] == Path("/project")
assert not kwargs["docker"]["simulate_32_bit"]
kwargs = build_in_container.call_args_list[2][1]
assert "quay.io/pypa/manylinux_2_24_x86_64" in kwargs["container"]["image"]
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
assert not kwargs["container"]["simulate_32_bit"]
identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {
"cp310-manylinux_x86_64",
@@ -149,28 +151,28 @@ before-all = "true"
"pp39-manylinux_x86_64",
}
kwargs = build_on_docker.call_args_list[3][1]
assert "quay.io/pypa/manylinux2014_i686" in kwargs["docker"]["docker_image"]
assert kwargs["docker"]["cwd"] == Path("/project")
assert kwargs["docker"]["simulate_32_bit"]
kwargs = build_in_container.call_args_list[3][1]
assert "quay.io/pypa/manylinux2014_i686" in kwargs["container"]["image"]
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
assert kwargs["container"]["simulate_32_bit"]
identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {f"{x}-manylinux_i686" for x in ALL_IDS}
kwargs = build_on_docker.call_args_list[4][1]
assert "quay.io/pypa/musllinux_1_1_x86_64" in kwargs["docker"]["docker_image"]
assert kwargs["docker"]["cwd"] == Path("/project")
assert not kwargs["docker"]["simulate_32_bit"]
kwargs = build_in_container.call_args_list[4][1]
assert "quay.io/pypa/musllinux_1_1_x86_64" in kwargs["container"]["image"]
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
assert not kwargs["container"]["simulate_32_bit"]
identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {
f"{x}-musllinux_x86_64" for x in ALL_IDS for x in ALL_IDS if "pp" not in x
}
kwargs = build_on_docker.call_args_list[5][1]
assert "quay.io/pypa/musllinux_1_1_i686" in kwargs["docker"]["docker_image"]
assert kwargs["docker"]["cwd"] == Path("/project")
assert kwargs["docker"]["simulate_32_bit"]
kwargs = build_in_container.call_args_list[5][1]
assert "quay.io/pypa/musllinux_1_1_i686" in kwargs["container"]["image"]
assert kwargs["container"]["cwd"] == PurePosixPath("/project")
assert kwargs["container"]["simulate_32_bit"]
identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {f"{x}-musllinux_i686" for x in ALL_IDS if "pp" not in x}
+5 -5
View File
@@ -4,7 +4,7 @@ import pytest
from cibuildwheel.__main__ import get_build_identifiers
from cibuildwheel.environment import parse_environment
from cibuildwheel.options import Options, _get_pinned_docker_images
from cibuildwheel.options import Options, _get_pinned_container_images
from .utils import get_default_command_line_arguments
@@ -58,18 +58,18 @@ test_command: 'pyproject'
assert default_build_options.environment == parse_environment('FOO="BAR"')
all_pinned_docker_images = _get_pinned_docker_images()
pinned_x86_64_docker_image = all_pinned_docker_images["x86_64"]
all_pinned_container_images = _get_pinned_container_images()
pinned_x86_64_container_image = all_pinned_container_images["x86_64"]
local = options.build_options("cp38-manylinux_x86_64")
assert local.manylinux_images is not None
assert local.test_command == "pyproject"
assert local.manylinux_images["x86_64"] == pinned_x86_64_docker_image["manylinux1"]
assert local.manylinux_images["x86_64"] == pinned_x86_64_container_image["manylinux1"]
local = options.build_options("cp37-manylinux_x86_64")
assert local.manylinux_images is not None
assert local.test_command == "pyproject-override"
assert local.manylinux_images["x86_64"] == pinned_x86_64_docker_image["manylinux2014"]
assert local.manylinux_images["x86_64"] == pinned_x86_64_container_image["manylinux2014"]
def test_passthrough(tmp_path, monkeypatch):
+10 -10
View File
@@ -4,15 +4,15 @@ from cibuildwheel.options import CommandLineArguments
def get_default_command_line_arguments() -> CommandLineArguments:
defaults = CommandLineArguments()
defaults.platform = "auto"
defaults.allow_empty = False
defaults.archs = None
defaults.config_file = ""
defaults.output_dir = Path("wheelhouse")
defaults.package_dir = Path(".")
defaults.prerelease_pythons = False
defaults.print_build_identifiers = False
defaults = CommandLineArguments(
platform="auto",
allow_empty=False,
archs=None,
config_file="",
output_dir=Path("wheelhouse"),
package_dir=Path("."),
prerelease_pythons=False,
print_build_identifiers=False,
)
return defaults
+43 -1
View File
@@ -1,4 +1,8 @@
from cibuildwheel.util import format_safe, prepare_command
from pathlib import PurePath
import pytest
from cibuildwheel.util import find_compatible_wheel, format_safe, prepare_command
def test_format_safe():
@@ -46,3 +50,41 @@ def test_prepare_command():
prepare_command("{a}{a,b}{b:.2e}{c}{d%s}{e:3}{f[0]}", a="42", b="3.14159")
== "42{a,b}{b:.2e}{c}{d%s}{e:3}{f[0]}"
)
@pytest.mark.parametrize(
"wheel,identifier",
(
("foo-0.1-cp38-abi3-win_amd64.whl", "cp310-win_amd64"),
("foo-0.1-cp38-abi3-macosx_11_0_x86_64.whl", "cp310-macosx_x86_64"),
("foo-0.1-cp38-abi3-manylinux2014_x86_64.whl", "cp310-manylinux_x86_64"),
("foo-0.1-cp38-abi3-musllinux_1_1_x86_64.whl", "cp310-musllinux_x86_64"),
("foo-0.1-py2.py3-none-win_amd64.whl", "cp310-win_amd64"),
("foo-0.1-py2.py3-none-win_amd64.whl", "pp310-win_amd64"),
("foo-0.1-py3-none-win_amd64.whl", "cp310-win_amd64"),
("foo-0.1-py38-none-win_amd64.whl", "cp310-win_amd64"),
("foo-0.1-py38-none-win_amd64.whl", "pp310-win_amd64"),
),
)
def test_find_compatible_wheel_found(wheel: str, identifier: str):
wheel_ = PurePath(wheel)
found = find_compatible_wheel([wheel_], identifier)
assert found is wheel_
@pytest.mark.parametrize(
"wheel,identifier",
(
("foo-0.1-cp38-abi3-win_amd64.whl", "cp310-win32"),
("foo-0.1-cp38-abi3-win_amd64.whl", "cp37-win_amd64"),
("foo-0.1-cp38-abi3-macosx_11_0_x86_64.whl", "cp310-macosx_universal2"),
("foo-0.1-cp38-abi3-manylinux2014_x86_64.whl", "cp310-musllinux_x86_64"),
("foo-0.1-cp38-abi3-musllinux_1_1_x86_64.whl", "cp310-manylinux_x86_64"),
("foo-0.1-py2-none-win_amd64.whl", "cp310-win_amd64"),
("foo-0.1-py38-none-win_amd64.whl", "cp37-win_amd64"),
("foo-0.1-py38-none-win_amd64.whl", "pp37-win_amd64"),
("foo-0.1-cp38-cp38-win_amd64.whl", "cp310-win_amd64"),
),
)
def test_find_compatible_wheel_not_found(wheel: str, identifier: str):
assert find_compatible_wheel([PurePath(wheel)], identifier) is None