Compare commits

...
72 Commits
Author SHA1 Message Date
Joe Rickerby 1a5fec7075 Bump version: v2.4.0 2022-04-02 14:52:27 +01:00
cibuildwheel-bot[bot]andjoerick e88a29cbe7 Update dependencies (#1070)
Co-authored-by: joerick <joerick@users.noreply.github.com>
2022-04-01 22:00:22 -04:00
Henry Schreiner 7ef593c2ad fix: minor touchups based on stricter mypy settings (#1060)
* fix: minor touchups based on stricter mypy settings

* refactor: address review comments
2022-04-01 22:00:07 -04:00
Matthieu Darbois dc10f1a654 Revert "chore: skip PyPy 3.7 7.3.8 updates" (#1037)
This reverts commit a0341ab064.
2022-04-01 21:59:55 -04:00
Joe Rickerby 7d097cb618 Merge pull request #1066 from pypa/update-dependencies-pr
[Bot] Update dependencies
2022-04-01 16:52:44 +01:00
Joe Rickerby 481f2eb623 Merge pull request #1065 from abravalheri/main
docs: add note about opting into PEP 621
2022-04-01 16:52:10 +01:00
pre-commit-ci[bot] 0ccd623e60 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-03-30 08:13:46 +00:00
Joe RickerbyandHenry Schreiner cd808df0e9 Apply suggestions from code review
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2022-03-30 09:13:17 +01:00
Henry Schreiner 9c046c26db fix: issue with typer breaking pycln 2022-03-29 16:58:32 -04:00
Joe Rickerby 901f07b586 Redraft to respond to comments 2022-03-29 20:45:23 +01:00
mayeut 23dc92c5f3 Update dependencies 2022-03-29 18:40:49 +01:00
Kjell Jorner 63a45ab2c0 ci: change github.event.ref to github.ref (#1061) 2022-03-29 10:11:28 -04:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> e1bcc10600 chore(deps): bump peter-evans/create-pull-request from 3 to 4 (#1067)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 3 to 4.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v3...v4)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  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-03-29 10:10:59 -04:00
pre-commit-ci[bot]pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Henry Schreiner
7feee994a7 [pre-commit.ci] pre-commit autoupdate (#1069)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/mirrors-mypy: v0.941 → v0.942](https://github.com/pre-commit/mirrors-mypy/compare/v0.941...v0.942)

* fix: black update

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2022-03-29 10:10:47 -04:00
Joe Rickerby 9e1a11cc83 Fix docs build (#1068) 2022-03-29 14:09:19 +00:00
Henry SchreinerandCAM Gerlach 1d6a1c0209 Update docs/options.md
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-03-29 09:31:39 -04:00
Joe Rickerby 93477cab80 Fix docs build 2022-03-27 21:58:57 +01:00
Joe Rickerby d76d019ada Reword requires-python section note 2022-03-27 21:47:30 +01:00
Joe Rickerby 8b5753e56c Merge pull request #1059 from pypa/gitlab-reduce-testing
Reduce Gitlab testing to just the basic tests
2022-03-27 20:56:22 +01:00
Anderson Bravalheri 985be06a61 docs: add note about opting into PEP 621 2022-03-26 10:29:22 +00:00
Joe Rickerby 358362d08c Merge pull request #1058 from pypa/update-dependencies-pr
[Bot] Update dependencies
2022-03-21 21:48:18 +00:00
Joe Rickerby 2141ab26a2 Reduce Gitlab testing to just the basic tests 2022-03-21 21:09:27 +00:00
mayeut bc3ebefe35 Update dependencies 2022-03-21 06:14:03 +00:00
Joe Rickerby f3e608e42c Merge pull request #1049 from Mamba413/patch-1
Add abess
2022-03-18 18:26:45 +00:00
Jin Zhu a603863afd Update projects.yml 2022-03-18 21:51:30 +08:00
02cc5bdaea [Bot] Update dependencies (#1050)
* Update dependencies

* chore: minor updates

Co-authored-by: mayeut <mayeut@users.noreply.github.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-03-18 00:13:35 -04:00
Jin Zhu f8f988ead9 Add abess
A machine learning software using cibuildwheel. cibuildwheel is excellent and very helpful!
2022-03-12 20:46:51 +08:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 13b65414ae chore(deps): bump actions/checkout from 2 to 3 (#1046)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  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-03-07 10:50:33 -05:00
cibuildwheel-bot[bot]andmayeut 2f2ef924d5 Update dependencies (#1043)
Co-authored-by: mayeut <mayeut@users.noreply.github.com>
2022-03-07 10:50:11 -05:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> b07db4ef08 chore(deps): bump actions/setup-python from 2 to 3 (#1040)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2 to 3.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v2...v3)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-01 17:32:32 -05:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> 8f6f3bc79d [pre-commit.ci] pre-commit autoupdate (#1042)
updates:
- [github.com/hadialqattan/pycln: v1.2.0 → v1.2.4](https://github.com/hadialqattan/pycln/compare/v1.2.0...v1.2.4)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-03-01 17:32:22 -05:00
cibuildwheel-bot[bot]andmayeut a591d08c46 Update dependencies (#1039)
Co-authored-by: mayeut <mayeut@users.noreply.github.com>
2022-02-28 10:54:11 -05:00
Henry SchreinerandJoe Rickerby d6dc3b7cd9 chore: add PyLint and fix most issues (#999)
* chore: add PyLint and fix most issues

* fix: minor fixes after first push

* chore: remove reference to old toml lib

* chore: minor options cleanup

* ci: only fail with many pylint issues, annotate in GHA

* refactor: address review

* ci: force nox to report in CI

* refactor: use map instead of if chain

* refactor: simpler shell_with_arch

* refactor: even simpler shell_with_arch

* Restore if...elif...else blocks where guard-style is not intended

Co-authored-by: Joe Rickerby <joerick@mac.com>
2022-02-27 14:16:37 -05:00
Matthieu Darbois 6d120e7a6b Merge pull request #1031 from mayeut/pypy-3.9
feature: add PyPy 3.9
2022-02-26 07:00:46 +01:00
mayeut 70780dbc4e feature: Add PyPy 3.9 2022-02-25 06:29:11 +01:00
mayeut a0341ab064 chore: skip PyPy 3.7 7.3.8 updates 2022-02-24 22:45:54 +01:00
mayeut e9fc3332fd fix: revert to PyPy 3.7 7.3.7 2022-02-24 22:45:21 +01:00
cibuildwheel-bot[bot]andmayeut 4465ec193f Update dependencies (#1027)
Co-authored-by: mayeut <mayeut@users.noreply.github.com>
2022-02-22 17:27:47 -05:00
Henry SchreinerandJoe Rickerby 45a211eb1c chore: cleanup and harden pytest config (#1011)
* chore: cleanup and harden pytest config

* fix: try alternate terminate strategy

* Update cibuildwheel/docker_container.py

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

Co-authored-by: Joe Rickerby <joerick@mac.com>
2022-02-22 17:27:20 -05:00
Eric Larson 2d1fee2b35 Update Azure Windows image names (#1029) 2022-02-22 17:26:51 -05:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> f78331da10 [pre-commit.ci] pre-commit autoupdate (#1033)
updates:
- [github.com/hadialqattan/pycln: v1.1.0 → v1.2.0](https://github.com/hadialqattan/pycln/compare/v1.1.0...v1.2.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-02-22 17:26:20 -05:00
Henry Schreiner 51b50db510 fix: A type alias cannot be final (#1024)
Addition of Python 3.10 to the checks exposed this.
2022-02-12 18:29:58 +01:00
cibuildwheel-bot[bot]andmayeut 07be87f34c Update dependencies (#1012)
Co-authored-by: mayeut <mayeut@users.noreply.github.com>
2022-02-11 16:09:45 -05:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> d7e8bed295 [pre-commit.ci] pre-commit autoupdate (#1013)
updates:
- [github.com/shellcheck-py/shellcheck-py: v0.8.0.3 → v0.8.0.4](https://github.com/shellcheck-py/shellcheck-py/compare/v0.8.0.3...v0.8.0.4)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-02-11 16:09:31 -05:00
Brent Huismanpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Henry Schreiner
508785192c docs: add Arbor (#1016)
* Add Arbor

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update docs/data/projects.yml

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2022-02-11 16:08:49 -05:00
Matthieu Darbois 27db8355cd chore: use Final type annotation on every top-level constant (#1010) 2022-02-11 16:08:28 -05:00
Henry Schreiner bc3106a4d0 fix: include Requires-Python info in printout (#1017) 2022-02-11 10:17:40 -05:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> b52698dad6 [pre-commit.ci] pre-commit autoupdate (#1009)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 21.12b0 → 22.1.0](https://github.com/psf/black/compare/21.12b0...22.1.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-02-04 16:04:47 -05:00
Joe Rickerby e80ec3ff25 Merge pull request #1008 from pypa/update-dependencies-pr
[Bot] Update dependencies
2022-02-04 18:37:05 +00:00
mayeut 697693ae4d Update dependencies 2022-01-31 06:11:14 +00:00
Bo Bayles 1d2f86e6cf docs: use consistent spelling for "license" in README.md (#1000) 2022-01-26 16:17:13 -05:00
cibuildwheel-bot[bot]andmayeut af2014c954 Update dependencies (#994)
Co-authored-by: mayeut <mayeut@users.noreply.github.com>
2022-01-25 07:56:17 +01:00
cibuildwheel-bot[bot]andmayeut 5255155bc5 Update dependencies (#986)
Co-authored-by: mayeut <mayeut@users.noreply.github.com>
2022-01-10 22:55:28 -05:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 8e1a520007 chore(deps): bump pypa/gh-action-pypi-publish from 1.4.2 to 1.5.0 (#987)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.4.2 to 1.5.0.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.4.2...v1.5.0)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-11 01:27:32 +01:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> b6a95cb8bc [pre-commit.ci] pre-commit autoupdate (#988)
updates:
- [github.com/pre-commit/mirrors-mypy: v0.930 → v0.931](https://github.com/pre-commit/mirrors-mypy/compare/v0.930...v0.931)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-10 21:45:48 +01:00
Matthieu Darbois 5149aacda4 Merge pull request #983 from pypa/appveyor-debug-failures
Debug Appveyor failures
2022-01-09 15:03:11 +01:00
mayeut 55eb1ca7b5 fix(ci): always upgrade pip on travis-ci 2022-01-09 12:17:51 +01:00
mayeut 4cb90fcfe4 fix(ci): always upgrade pip on appveyor
pip was too old to download windows abi3 wheels leading to  pynacl failing to build from sources
2022-01-09 10:47:46 +01:00
mayeut fffa64f344 fix(tests): bump virtualenv version used in test_dependency_constraints_file
Versions before 20.11.2 did not respect pinned versions when a periodic/manual update cache exists.
2022-01-09 10:44:55 +01:00
Matthieu DarboisandJoe Rickerby ab13f7a9de feature: allow local runs on windows/macOS (#974)
* feature: allow local runs on windows/macOS

Cache python installations to a user cache folder using platformdirs.
The build environment is now a virtual environment to allow proper isolation.
Allows to run tests in parallel.

Co-authored-by: Joe Rickerby <joerick@mac.com>
2022-01-08 11:30:48 +01:00
Joe Rickerby 81243337fd Add release steps to bump_version script 2022-01-06 19:31:45 +00:00
Axel Hueblpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>mayeut
65c7a69af8 Travis-CI: Fix Container Network (#906)
* Travis-CI: Fix Container Network

Add `--network=host` to Travis-CI PPC64le runners.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Travis PPC64le: Move Docker Work-Around

Move the control of the work-around for docker on ppc64le on travis
into the `docker_container` logic and do not expose as interface.

* style: minor fix

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: mayeut <mayeut@users.noreply.github.com>
2022-01-06 08:55:49 +01:00
Matthieu Darbois 9e18cb8656 refactor: Use utils.call & utils.shell in macos.py & windows.py (#978) 2022-01-05 02:59:24 +01:00
Matthieu Darbois 73b7de0a75 fix: remove warnings on macOS when installing certificates (#979) 2022-01-04 22:46:45 +01:00
Matthieu DarboisandJoe Rickerby 45e5768514 feat: include size in the final printout (#975)
* feat: include size in the final printout

Co-authored-by: Joe Rickerby <joerick@mac.com>
2022-01-04 22:45:36 +01:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> 18ba7700f6 [pre-commit.ci] pre-commit autoupdate (#980)
updates:
- [github.com/asottile/pyupgrade: v2.29.1 → v2.31.0](https://github.com/asottile/pyupgrade/compare/v2.29.1...v2.31.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-03 23:48:20 +01:00
cibuildwheel-bot[bot]andmayeut e5c210c086 Update dependencies (#967)
Co-authored-by: mayeut <mayeut@users.noreply.github.com>
2022-01-03 12:15:24 +01:00
Forest Greggpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>mayeut
e9ef3e9750 fix: open setup.py as utf-8 in get_requires_python_str (#977)
* open setup.py as utf-8 in get_requires_python_str

fix #976

* update test for UTF-8 setup.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: mayeut <mayeut@users.noreply.github.com>
2021-12-30 10:14:16 +01:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> d6bede539d [pre-commit.ci] pre-commit autoupdate (#973)
updates:
- [github.com/pre-commit/pre-commit-hooks: v4.0.1 → v4.1.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.0.1...v4.1.0)
- [github.com/pre-commit/mirrors-mypy: v0.920 → v0.930](https://github.com/pre-commit/mirrors-mypy/compare/v0.920...v0.930)
- [github.com/shellcheck-py/shellcheck-py: v0.8.0.2 → v0.8.0.3](https://github.com/shellcheck-py/shellcheck-py/compare/v0.8.0.2...v0.8.0.3)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-12-27 23:09:35 +01:00
Matthieu Darbois 21df1e576d fix: minor fixes to get pycharm not to complain too much (#972) 2021-12-27 09:26:33 +01:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> 4ed927c4a2 [pre-commit.ci] pre-commit autoupdate (#968)
updates:
- [github.com/pre-commit/mirrors-mypy: v0.910-1 → v0.920](https://github.com/pre-commit/mirrors-mypy/compare/v0.910-1...v0.920)
- [github.com/shellcheck-py/shellcheck-py: v0.8.0.1 → v0.8.0.2](https://github.com/shellcheck-py/shellcheck-py/compare/v0.8.0.1...v0.8.0.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-12-21 10:58:00 -05:00
cibuildwheel-bot[bot]andhenryiii f30aaa6e3f Update dependencies (#963)
Co-authored-by: henryiii <henryiii@users.noreply.github.com>
2021-12-14 18:47:01 -05:00
62 changed files with 1418 additions and 903 deletions
+32
View File
@@ -0,0 +1,32 @@
{
"problemMatcher": [
{
"severity": "warning",
"pattern": [
{
"regexp": "^([^:]+):(\\d+):(\\d+): ([A-DF-Z]\\d+): \\033\\[[\\d;]+m([^\\033]+).*$",
"file": 1,
"line": 2,
"column": 3,
"code": 4,
"message": 5
}
],
"owner": "pylint-warning"
},
{
"severity": "error",
"pattern": [
{
"regexp": "^([^:]+):(\\d+):(\\d+): (E\\d+): \\033\\[[\\d;]+m([^\\033]+).*$",
"file": 1,
"line": 2,
"column": 3,
"code": 4,
"message": 5
}
],
"owner": "pylint-error"
}
]
}
+2 -2
View File
@@ -11,7 +11,7 @@ jobs:
dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build SDist and wheel
run: pipx run build
@@ -34,7 +34,7 @@ jobs:
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 }}
+16 -11
View File
@@ -15,18 +15,23 @@ concurrency:
cancel-in-progress: true
jobs:
pre-commit:
name: Pre-commit checks (mypy, flake8, etc.)
lint:
name: Linters (mypy, flake8, etc.)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v2.0.3
- run: pipx run nox -s check_manifest
- name: Check manifest
run: pipx run nox -s check_manifest
- name: PyLint checks
run: |
echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
pipx run nox -s pylint
test:
name: Test cibuildwheel on ${{ matrix.os }}
needs: pre-commit
needs: lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
@@ -34,8 +39,8 @@ jobs:
python_version: ['3.10']
timeout-minutes: 180
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
name: Install Python ${{ matrix.python_version }}
with:
python-version: ${{ matrix.python_version }}
@@ -67,12 +72,12 @@ jobs:
test-emulated:
name: Test emulated cibuildwheel using qemu
needs: pre-commit
needs: lint
runs-on: ubuntu-latest
timeout-minutes: 180
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- name: Install dependencies
run: |
python -m pip install ".[test]"
+2 -2
View File
@@ -11,7 +11,7 @@ jobs:
if: github.repository_owner == 'pypa' || github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: excitedleigh/setup-nox@v2.0.0
- name: "Run update: dependencies"
@@ -32,7 +32,7 @@ jobs:
- name: Create Pull Request
if: github.ref == 'refs/heads/main' && github.repository == 'pypa/cibuildwheel'
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4
with:
commit-message: Update dependencies
title: '[Bot] Update dependencies'
+5 -1
View File
@@ -9,7 +9,11 @@ linux:
DOCKER_DRIVER: overlay2
# See https://github.com/docker-library/docker/pull/166
DOCKER_TLS_CERTDIR: ""
# skip all but the basic tests
# (comment the below line in a PR to debug a Gitlab-specific issue)
PYTEST_ADDOPTS: -k "unit_test or test_0_basic" --suppress-no-test-exit-code
script:
- curl -sSL https://get.docker.com/ | sh
- python -m pip install -e ".[dev]"
- python -m pip install -e ".[dev]" pytest-custom-exit-code
- python ./bin/run_tests.py
+16 -11
View File
@@ -1,7 +1,7 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.1.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.29.1
rev: v2.31.1
hooks:
- id: pyupgrade
name: PyUpgrade 3.6+
@@ -27,10 +27,11 @@ repos:
# Autoremoves unused imports
- repo: https://github.com/hadialqattan/pycln
rev: v1.1.0
rev: v1.2.5
hooks:
- id: pycln
args: [--config=pyproject.toml]
args: [--all]
stages: [manual]
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
@@ -38,7 +39,7 @@ repos:
- id: isort
- repo: https://github.com/psf/black
rev: 21.12b0
rev: 22.3.0
hooks:
- id: black
@@ -48,11 +49,12 @@ repos:
- id: setup-cfg-fmt
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910-1
rev: v0.942
hooks:
- id: mypy
name: mypy 3.6 on cibuildwheel/
exclude: ^(bin|cibuildwheel/resources|docs)/.*py$
args: ["--python-version=3.6", "--scripts-are-modules", "--show-error-codes"]
args: ["--python-version=3.6"]
additional_dependencies: &mypy-dependencies
- nox
- packaging>=21.0
@@ -66,10 +68,15 @@ repos:
- types-pyyaml
- types-requests
- bracex
- dataclasses
- id: mypy
name: mypy 3.7+ on bin/
files: ^((bin|docs)/.*py)$
args: ["--python-version=3.7", "--scripts-are-modules", "--show-error-codes"]
args: ["--python-version=3.7"]
additional_dependencies: *mypy-dependencies
- id: mypy
name: mypy 3.10
args: ["--python-version=3.10"]
additional_dependencies: *mypy-dependencies
- repo: https://github.com/asottile/yesqa
@@ -91,14 +98,12 @@ repos:
hooks:
- id: python-check-blanket-noqa
stages: [manual]
- id: python-check-blanket-type-ignore
stages: [manual]
- id: python-no-log-warn
- id: python-no-eval
- id: python-use-type-annotations
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.8.0.1
rev: v0.8.0.4
hooks:
- id: shellcheck
+3 -1
View File
@@ -48,6 +48,8 @@ jobs:
arch: s390x
env: PYTHON=python
install: $PYTHON -m pip install -e ".[dev]" pytest-custom-exit-code
install:
- $PYTHON -m pip install -U pip
- $PYTHON -m pip install -e ".[dev]" pytest-custom-exit-code
script: $PYTHON ./bin/run_tests.py
+17 -25
View File
@@ -31,6 +31,7 @@ What does it do?
| CPython 3.10 | ✅ | ✅ | ✅ | ✅ | ✅² | ✅ | ✅ | ✅ | ✅ | ✅ |
| PyPy 3.7 v7.3 | ✅ | N/A | ✅ | N/A | N/A | ✅¹ | ✅¹ | ✅¹ | N/A | N/A |
| PyPy 3.8 v7.3 | ✅ | N/A | ✅ | N/A | N/A | ✅¹ | ✅¹ | ✅¹ | N/A | N/A |
| PyPy 3.9 v7.3 | ✅ | N/A | ✅ | N/A | N/A | ✅¹ | ✅¹ | ✅¹ | N/A | N/A |
<sup>¹ PyPy is only supported for manylinux wheels.</sup><br>
<sup>² Windows arm64 support is experimental.</sup><br>
@@ -59,8 +60,6 @@ Usage
<sup>¹ [Requires emulation](https://cibuildwheel.readthedocs.io/en/stable/faq/#emulation), distributed separately. Other services may also support Linux ARM through emulation or third-party build hosts, but these are not tested in our CI.</sup><br>
`cibuildwheel` is not intended to run on your development machine. Because it uses system Python from Python.org on macOS and Windows, it will try to install packages globally - not what you expect from a build tool! Instead, isolated CI services like those mentioned above are ideal. For Linux builds, it uses manylinux docker images, so those can be done locally for testing in a pinch.
<!--intro-end-->
Example setup
@@ -88,7 +87,7 @@ jobs:
- uses: actions/setup-python@v2
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.3.1
run: python -m pip install cibuildwheel==2.4.0
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
@@ -149,7 +148,7 @@ Here are some repos that use cibuildwheel.
| [pydantic][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Data parsing and validation using Python type hints |
| [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 |
| [vaex][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Out-of-Core hybrid Apache Arrow/NumPy DataFrame for Python, ML, visualize and explore big tabular data at a billion rows per second 🚀 |
| [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 |
[scikit-learn]: https://github.com/scikit-learn/scikit-learn
@@ -184,7 +183,7 @@ Since `cibuildwheel` repairs the wheel with `delocate` or `auditwheel`, it might
It helps ensure that the library can run without any dependencies outside of the pip toolchain.
This is similar to static linking, so it might have some licence implications. Check the license for any code you're pulling in to make sure that's allowed.
This is similar to static linking, so it might have some license implications. Check the license for any code you're pulling in to make sure that's allowed.
Changelog
=========
@@ -193,6 +192,19 @@ Changelog
<!-- this section was generated by bin/update_readme_changelog.py -- do not edit manually -->
### 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_
@@ -226,26 +238,6 @@ _26 October 2021_
- 🛠 Added a `config-file` option on the GitHub Action to specify something other than pyproject.toml in your GitHub Workflow file. (#883)
- 🐛 Fix missing resources in sdist and released wheel on PyPI. We've also made some internal changes to our release processes to make them more reliable. (#893, #894)
### v2.2.0
_22 October 2021_
- 🌟 Added support for [musllinux](https://www.python.org/dev/peps/pep-0656/). Support for this new wheel format lets projects build wheels for Linux distributions that use [musl libc](https://musl.libc.org/), notably, [Alpine](https://alpinelinux.org/) Docker containers. (#768)
Musllinux builds are enabled by default. If you're not ready to build musllinux, add `*-musllinux_*` to your [`CIBW_SKIP`/`skip`](https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip) option. Or, you might have to make some changes to your options - to simplify that process, you can use...
- 🌟 TOML option overrides! This provides much greater flexibility in configuration via pyproject.toml. (#854)
You can now set build options for any subset of your builds using a match pattern. So, for example, you can customise CPython 3.8 builds with an override on `cp38-*` or musllinux builds by selecting `*musllinux*`. Check out [the docs](https://cibuildwheel.readthedocs.io/en/latest/options/#overrides) for more info on the specifics.
- 🛠 Added support for building PyPy wheels on macOS 11 CI runners. (#875)
- 🛠 Setting an empty string for the [`CIBW_*_IMAGE`](https://cibuildwheel.readthedocs.io/en/stable/options/#manylinux-image) option will now fallthrough to the config file or cibuildwheel's default, rather than causing an error. This makes the option easier to use in CI build matricies. (#829)
- 🛠 Support for TOML 1.0 when reading config files, via the `tomli` package. (#876)
<sup>Note: This version is not available on PyPI due to some missing resources in the release files. Please use a later version instead.</sup>
<!-- END bin/update_readme_changelog.py -->
---
+1
View File
@@ -18,6 +18,7 @@ init:
if (-not ($BRANCH -eq 'main' -or $BRANCH.ToLower().StartsWith('appveyor-'))) {
$env:PYTEST_ADDOPTS='-k "unit_test or test_0_basic" --suppress-no-test-exit-code'
}
python -m pip install -U pip
install: python -m pip install -e ".[dev]" pytest-custom-exit-code
+2 -2
View File
@@ -21,7 +21,7 @@ jobs:
python ./bin/run_tests.py
- job: windows_36
pool: {vmImage: 'vs2017-win2016'}
pool: {vmImage: 'windows-2019'}
timeoutInMinutes: 180
steps:
- task: UsePythonVersion@0
@@ -32,7 +32,7 @@ jobs:
python ./bin/run_tests.py
- job: windows_38
pool: {vmImage: 'vs2017-win2016'}
pool: {vmImage: 'windows-2019'}
timeoutInMinutes: 180
steps:
- task: UsePythonVersion@0
+11
View File
@@ -177,6 +177,17 @@ def bump_version() -> None:
)
print("Done.")
print()
print("Push the new version to GitHub with:")
print(" git push && git push --tags")
print()
release_url = "https://github.com/pypa/cibuildwheel/releases/new?" + urllib.parse.urlencode(
{"tag": new_version}
)
print("Then create a release at the URL:")
print(f" {release_url}")
if __name__ == "__main__":
+1 -3
View File
@@ -16,15 +16,13 @@ if __name__ == "__main__":
unit_test_args += ["--run-docker"]
subprocess.run(unit_test_args, check=True)
xdist_test_args = ["-n", "2"] if sys.platform.startswith("linux") else []
# run the integration tests
subprocess.run(
[
sys.executable,
"-m",
"pytest",
*xdist_test_args,
"--numprocesses=2",
"-x",
"--durations",
"0",
+120
View File
@@ -0,0 +1,120 @@
#!/usr/bin/env python3
from __future__ import annotations
import difflib
import logging
import subprocess
from pathlib import Path
from typing import NamedTuple
import click
import rich
import tomli
from packaging.version import InvalidVersion, Version
from rich.logging import RichHandler
from rich.syntax import Syntax
from cibuildwheel.typing import Final
log = logging.getLogger("cibw")
# Looking up the dir instead of using utils.resources_dir
# since we want to write to it.
DIR: Final[Path] = Path(__file__).parent.parent.resolve()
RESOURCES_DIR: Final[Path] = DIR / "cibuildwheel/resources"
GET_VIRTUALENV_GITHUB: Final[str] = "https://github.com/pypa/get-virtualenv"
GET_VIRTUALENV_URL_TEMPLATE: Final[
str
] = f"{GET_VIRTUALENV_GITHUB}/blob/{{version}}/public/virtualenv.pyz?raw=true"
class VersionTuple(NamedTuple):
version: Version
version_string: str
def git_ls_remote_versions(url) -> list[VersionTuple]:
versions: list[VersionTuple] = []
tags = subprocess.run(
["git", "ls-remote", "--tags", url], check=True, text=True, capture_output=True
).stdout.splitlines()
for tag in tags:
_, ref = tag.split()
assert ref.startswith("refs/tags/")
version_string = ref[10:]
try:
version = Version(version_string)
if version.is_devrelease:
log.info(f"Ignoring development release '{version}'")
continue
if version.is_prerelease:
log.info(f"Ignoring pre-release '{version}'")
continue
versions.append(VersionTuple(version, version_string))
except InvalidVersion:
log.warning(f"Ignoring ref '{ref}'")
versions.sort(reverse=True)
return versions
@click.command()
@click.option("--force", is_flag=True)
@click.option(
"--level", default="INFO", type=click.Choice(["WARNING", "INFO", "DEBUG"], case_sensitive=False)
)
def update_virtualenv(force: bool, level: str) -> None:
logging.basicConfig(
level="INFO",
format="%(message)s",
datefmt="[%X]",
handlers=[RichHandler(rich_tracebacks=True, markup=True)],
)
log.setLevel(level)
toml_file_path = RESOURCES_DIR / "virtualenv.toml"
original_toml = toml_file_path.read_text()
with toml_file_path.open("rb") as f:
loaded_file = tomli.load(f)
version = str(loaded_file["version"])
versions = git_ls_remote_versions(GET_VIRTUALENV_GITHUB)
if versions[0].version > Version(version):
version = versions[0].version_string
result_toml = (
f'version = "{version}"\n'
f'url = "{GET_VIRTUALENV_URL_TEMPLATE.format(version=version)}"\n'
)
rich.print() # spacer
if original_toml == result_toml:
rich.print("[green]Check complete, virtualenv version unchanged.")
return
rich.print("virtualenv version updated.")
rich.print("Changes:")
rich.print()
toml_relpath = toml_file_path.relative_to(DIR).as_posix()
diff_lines = difflib.unified_diff(
original_toml.splitlines(keepends=True),
result_toml.splitlines(keepends=True),
fromfile=toml_relpath,
tofile=toml_relpath,
)
rich.print(Syntax("".join(diff_lines), "diff", theme="ansi_light"))
rich.print()
if force:
toml_file_path.write_text(result_toml)
rich.print("[green]TOML file updated.")
else:
rich.print("[yellow]File left unchanged. Use --force flag to update.")
if __name__ == "__main__":
update_virtualenv()
+1 -1
View File
@@ -1 +1 @@
__version__ = "2.3.1"
__version__ = "2.4.0"
+39 -20
View File
@@ -1,7 +1,10 @@
import argparse
import os
import shutil
import sys
import textwrap
from pathlib import Path
from tempfile import mkdtemp
from typing import List, Set, Union
import cibuildwheel
@@ -10,9 +13,15 @@ import cibuildwheel.macos
import cibuildwheel.util
import cibuildwheel.windows
from cibuildwheel.architecture import Architecture, allowed_architectures_check
from cibuildwheel.logger import log
from cibuildwheel.options import CommandLineArguments, Options, compute_options
from cibuildwheel.typing import PLATFORMS, PlatformName, assert_never
from cibuildwheel.util import BuildSelector, Unbuffered, detect_ci_provider
from cibuildwheel.util import (
CIBW_CACHE_PATH,
BuildSelector,
Unbuffered,
detect_ci_provider,
)
def main() -> None:
@@ -32,12 +41,11 @@ def main() -> None:
choices=["auto", "linux", "macos", "windows"],
default=os.environ.get("CIBW_PLATFORM", "auto"),
help="""
Platform to build for. For "linux" you need docker running, on Mac
or Linux. For "macos", you need a Mac machine, and note that this
script is going to automatically install MacPython on your system,
so don't run on your development machine. For "windows", you need to
run in Windows, and it will build and test for all versions of
Python. Default: auto.
Platform to build for. Use this option to override the
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.
""",
)
@@ -165,6 +173,9 @@ def main() -> None:
# Python is buffering by default when running on the CI platforms, giving problems interleaving subprocess call output with unflushed calls to 'print'
sys.stdout = Unbuffered(sys.stdout) # type: ignore[assignment]
# create the cache dir before it gets printed & builds performed
CIBW_CACHE_PATH.mkdir(parents=True, exist_ok=True)
print_preamble(platform=platform, options=options, identifiers=identifiers)
try:
@@ -187,17 +198,23 @@ def main() -> None:
if not output_dir.exists():
output_dir.mkdir(parents=True)
with cibuildwheel.util.print_new_wheels(
"\n{n} wheels produced in {m:.0f} minutes:", output_dir
):
if platform == "linux":
cibuildwheel.linux.build(options)
elif platform == "windows":
cibuildwheel.windows.build(options)
elif platform == "macos":
cibuildwheel.macos.build(options)
else:
assert_never(platform)
tmp_path = Path(mkdtemp(prefix="cibw-run-")).resolve(strict=True)
try:
with cibuildwheel.util.print_new_wheels(
"\n{n} wheels produced in {m:.0f} minutes:", output_dir
):
if platform == "linux":
cibuildwheel.linux.build(options, tmp_path)
elif platform == "windows":
cibuildwheel.windows.build(options, tmp_path)
elif platform == "macos":
cibuildwheel.macos.build(options, tmp_path)
else:
assert_never(platform)
finally:
shutil.rmtree(tmp_path, ignore_errors=sys.platform.startswith("win"))
if tmp_path.exists():
log.warning(f"Can't delete temporary folder '{str(tmp_path)}'")
def print_preamble(platform: str, options: Options, identifiers: List[str]) -> None:
@@ -218,7 +235,9 @@ def print_preamble(platform: str, options: Options, identifiers: List[str]) -> N
print(f" platform: {platform!r}")
print(textwrap.indent(options.summary(identifiers), " "))
warnings = detect_warnings(platform=platform, options=options, identifiers=identifiers)
print(f"Cache folder: {CIBW_CACHE_PATH}")
warnings = detect_warnings(options=options, identifiers=identifiers)
if warnings:
print("\nWarnings:")
for warning in warnings:
@@ -254,7 +273,7 @@ def get_build_identifiers(
return [config.identifier for config in python_configurations]
def detect_warnings(platform: str, options: Options, identifiers: List[str]) -> List[str]:
def detect_warnings(*, options: Options, identifiers: List[str]) -> List[str]:
warnings = []
# warn about deprecated {python} and {pip}
+9 -11
View File
@@ -4,9 +4,9 @@ import re
from enum import Enum
from typing import Set
from .typing import Literal, PlatformName, assert_never
from .typing import Final, Literal, PlatformName, assert_never
PRETTY_NAMES = {"linux": "Linux", "macos": "macOS", "windows": "Windows"}
PRETTY_NAMES: Final = {"linux": "Linux", "macos": "macOS", "windows": "Windows"}
@functools.total_ordering
@@ -73,20 +73,18 @@ class Architecture(Enum):
@staticmethod
def all_archs(platform: PlatformName) -> "Set[Architecture]":
if platform == "linux":
return {
all_archs_map = {
"linux": {
Architecture.x86_64,
Architecture.i686,
Architecture.aarch64,
Architecture.ppc64le,
Architecture.s390x,
}
elif platform == "macos":
return {Architecture.x86_64, Architecture.arm64, Architecture.universal2}
elif platform == "windows":
return {Architecture.x86, Architecture.AMD64, Architecture.ARM64}
else:
assert_never(platform)
},
"macos": {Architecture.x86_64, Architecture.arm64, Architecture.universal2},
"windows": {Architecture.x86, Architecture.AMD64, Architecture.ARM64},
}
return all_archs_map[platform]
@staticmethod
def bitness_archs(platform: PlatformName, bitness: Literal["64", "32"]) -> "Set[Architecture]":
+28 -11
View File
@@ -1,6 +1,7 @@
import io
import json
import os
import platform
import shlex
import subprocess
import sys
@@ -9,6 +10,8 @@ from pathlib import Path, PurePath
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
@@ -44,6 +47,15 @@ class DockerContainer:
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
# https://github.com/pypa/cibuildwheel/issues/904
# https://github.com/conda-forge/conda-smithy/pull/1520
network_args = []
if detect_ci_provider() == CIProvider.travis_ci and platform.machine() == "ppc64le":
network_args = ["--network=host"]
shell_args = ["linux32", "/bin/bash"] if self.simulate_32_bit else ["/bin/bash"]
subprocess.run(
[
@@ -53,6 +65,7 @@ class DockerContainer:
f"--name={self.name}",
"--interactive",
"--volume=/:/host", # ignored on CircleCI
*network_args,
*cwd_args,
self.docker_image,
*shell_args,
@@ -87,13 +100,17 @@ class DockerContainer:
exc_tb: Optional[TracebackType],
) -> None:
self.bash_stdin.write(b"exit 0\n")
self.bash_stdin.flush()
self.process.wait(timeout=30)
self.bash_stdin.close()
self.process.terminate()
self.process.wait()
self.bash_stdout.close()
assert isinstance(self.name, str)
subprocess.run(["docker", "rm", "--force", "-v", self.name], stdout=subprocess.DEVNULL)
subprocess.run(
["docker", "rm", "--force", "-v", self.name], stdout=subprocess.DEVNULL, check=False
)
self.name = None
def copy_into(self, from_path: Path, to_path: PurePath) -> None:
@@ -131,7 +148,7 @@ class DockerContainer:
def glob(self, path: PurePath, pattern: str) -> List[PurePath]:
glob_pattern = os.path.join(str(path), pattern)
path_strs = json.loads(
path_strings = json.loads(
self.call(
[
self.UTILITY_PYTHON,
@@ -142,7 +159,7 @@ class DockerContainer:
)
)
return [PurePath(p) for p in path_strs]
return [PurePath(p) for p in path_strings]
def call(
self,
@@ -170,7 +187,7 @@ class DockerContainer:
# can cope with spaces and strange characters in the name or value.
# Finally, the remote shell is told to write a footer - this will show
# up in the output so we know when to stop reading, and will include
# the returncode of `command`.
# the return code of `command`.
self.bash_stdin.write(
bytes(
f"""(
@@ -199,11 +216,11 @@ class DockerContainer:
len(line)
- 1 # newline character
- len(end_of_message) # delimiter
- 4 # 4 returncode decimals
- 4 # 4 return code decimals
)
# fmt: on
returncode_str = line[footer_offset : footer_offset + 4]
returncode = int(returncode_str)
return_code_str = line[footer_offset : footer_offset + 4]
return_code = int(return_code_str)
# add the last line to output, without the footer
output_io.write(line[0:footer_offset])
break
@@ -215,8 +232,8 @@ class DockerContainer:
else:
output = ""
if returncode != 0:
raise subprocess.CalledProcessError(returncode, args, output)
if return_code != 0:
raise subprocess.CalledProcessError(return_code, args, output)
return output
+1 -1
View File
@@ -66,7 +66,7 @@ class EnvironmentAssignmentRaw:
def __repr__(self) -> str:
return f"{self.name}: {self.value}"
def evaluated_value(self, **kwargs: Any) -> str:
def evaluated_value(self, **_: Any) -> str:
return self.value
@@ -0,0 +1,65 @@
from threading import RLock
from typing import Any, Callable, Generic, Optional, Type, TypeVar, overload
__all__ = ["cached_property"]
_NOT_FOUND = object()
_T = TypeVar("_T")
class cached_property(Generic[_T]):
def __init__(self, func: Callable[[Any], _T]):
self.func = func
self.attrname: Optional[str] = None
self.__doc__ = func.__doc__
self.lock = RLock()
def __set_name__(self, owner: Type[Any], name: str) -> None:
if self.attrname is None:
self.attrname = name
elif name != self.attrname:
raise TypeError(
"Cannot assign the same cached_property to two different names "
f"({self.attrname!r} and {name!r})."
)
@overload
def __get__(self, instance: None, owner: Optional[Type[Any]] = ...) -> "cached_property[_T]":
...
@overload
def __get__(self, instance: object, owner: Optional[Type[Any]] = ...) -> _T:
...
def __get__(self, instance: Optional[object], owner: Optional[Type[Any]] = None) -> Any:
if instance is None:
return self
if self.attrname is None:
raise TypeError(
"Cannot use cached_property instance without calling __set_name__ on it."
)
try:
cache = instance.__dict__
except AttributeError: # not all objects have __dict__ (e.g. class defines slots)
msg = (
f"No '__dict__' attribute on {type(instance).__name__!r} "
f"instance to cache {self.attrname!r} property."
)
raise TypeError(msg) from None
val = cache.get(self.attrname, _NOT_FOUND)
if val is _NOT_FOUND:
with self.lock:
# check if another thread filled cache while we awaited lock
val = cache.get(self.attrname, _NOT_FOUND)
if val is _NOT_FOUND:
val = self.func(instance)
try:
cache[self.attrname] = val
except TypeError:
msg = (
f"The '__dict__' attribute on {type(instance).__name__!r} instance "
f"does not support item assignment for caching {self.attrname!r} property."
)
raise TypeError(msg) from None
return val
+2 -2
View File
@@ -303,11 +303,11 @@ def build_on_docker(
log.step_end()
def build(options: Options) -> None:
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)
except Exception:
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."
+10 -16
View File
@@ -5,16 +5,17 @@ import sys
import time
from typing import IO, AnyStr, Optional, Union
from cibuildwheel.typing import Final
from cibuildwheel.util import CIProvider, detect_ci_provider
DEFAULT_FOLD_PATTERN = ("{name}", "")
FOLD_PATTERNS = {
DEFAULT_FOLD_PATTERN: Final = ("{name}", "")
FOLD_PATTERNS: Final = {
"azure": ("##[group]{name}", "##[endgroup]"),
"travis": ("travis_fold:start:{identifier}\n{name}", "travis_fold:end:{identifier}"),
"github": ("::group::{name}", "::endgroup::{name}"),
}
PLATFORM_IDENTIFIER_DESCIPTIONS = {
PLATFORM_IDENTIFIER_DESCRIPTIONS: Final = {
"manylinux_x86_64": "manylinux x86_64",
"manylinux_i686": "manylinux i686",
"manylinux_aarch64": "manylinux aarch64",
@@ -157,7 +158,8 @@ class Logger:
sys.stdout.flush()
self.active_fold_group_name = None
def _fold_group_identifier(self, name: str) -> str:
@staticmethod
def _fold_group_identifier(name: str) -> str:
"""
Travis doesn't like fold groups identifiers that have spaces in. This
method converts them to ascii identifiers
@@ -173,17 +175,11 @@ class Logger:
@property
def colors(self) -> "Colors":
if self.colors_enabled:
return Colors(enabled=True)
else:
return Colors(enabled=False)
return Colors(enabled=self.colors_enabled)
@property
def symbols(self) -> "Symbols":
if self.unicode_enabled:
return Symbols(unicode=True)
else:
return Symbols(unicode=False)
return Symbols(unicode=self.unicode_enabled)
def build_description_from_identifier(identifier: str) -> str:
@@ -204,7 +200,7 @@ def build_description_from_identifier(identifier: str) -> str:
build_description += f" {python_version[0]}.{python_version[1:]} "
try:
build_description += PLATFORM_IDENTIFIER_DESCIPTIONS[platform_identifier]
build_description += PLATFORM_IDENTIFIER_DESCRIPTIONS[platform_identifier]
except KeyError as e:
raise Exception("unknown platform") from e
@@ -262,8 +258,6 @@ def file_supports_unicode(file_obj: IO[AnyStr]) -> bool:
return "utf" in codec_info.name
"""
Global instance of the Logger.
"""
# Global instance of the Logger.
# (there's only one stdout per-process, so a global instance is justified)
log = Logger()
+138 -205
View File
@@ -1,13 +1,14 @@
import functools
import os
import platform
import re
import shlex
import shutil
import subprocess
import sys
import tempfile
from pathlib import Path
from typing import Any, Dict, List, NamedTuple, Optional, Sequence, Set, Tuple, cast
from typing import Dict, List, NamedTuple, Sequence, Set, Tuple, cast
from filelock import FileLock
from .architecture import Architecture
from .environment import ParsedEnvironment
@@ -15,34 +16,24 @@ from .logger import log
from .options import Options
from .typing import Literal, PathOrStr, assert_never
from .util import (
CIBW_CACHE_PATH,
BuildFrontend,
BuildSelector,
NonPlatformWheelError,
call,
detect_ci_provider,
download,
get_build_verbosity_extra_flags,
get_pip_version,
install_certifi_script,
prepare_command,
read_python_configs,
shell,
unwrap,
virtualenv,
)
def call(
args: Sequence[PathOrStr],
env: Optional[Dict[str, str]] = None,
cwd: Optional[str] = None,
shell: bool = False,
) -> None:
# print the command executing for the logs
if shell:
print(f"+ {args}")
else:
print("+ " + " ".join(shlex.quote(str(a)) for a in args))
subprocess.run(args, env=env, cwd=cwd, shell=shell, check=True)
def get_macos_version() -> Tuple[int, int]:
"""
Returns the macOS major/minor version, as a tuple, e.g. (10, 15) or (11, 0)
@@ -58,13 +49,7 @@ def get_macos_version() -> Tuple[int, int]:
def get_macos_sdks() -> List[str]:
output = subprocess.run(
["xcodebuild", "-showsdks"],
universal_newlines=True,
check=True,
stdout=subprocess.PIPE,
).stdout
output = call("xcodebuild", "-showsdks", capture_stdout=True)
return [m.group(1) for m in re.finditer(r"-sdk (macosx\S+)", output)]
@@ -93,98 +78,75 @@ def get_python_configurations(
return [c for c in python_configurations if build_selector(c.identifier)]
SYMLINKS_DIR = Path("/tmp/cibw_bin")
def install_cpython(tmp: Path, version: str, url: str) -> Path:
installation_path = Path(f"/Library/Frameworks/Python.framework/Versions/{version}")
with FileLock(CIBW_CACHE_PATH / f"cpython{version}.lock"):
installed_system_packages = call("pkgutil", "--pkgs", capture_stdout=True).splitlines()
# if this version of python isn't installed, get it from python.org and install
python_package_identifier = f"org.python.Python.PythonFramework-{version}"
if python_package_identifier not in installed_system_packages:
if detect_ci_provider() is None:
# if running locally, we don't want to install CPython with sudo
# let the user know & provide a link to the installer
print(
f"Error: CPython {version} is not installed.\n"
"cibuildwheel will not perform system-wide installs when running outside of CI.\n"
f"To build locally, install CPython {version} on this machine, or, disable this version of Python using CIBW_SKIP=cp{version.replace('.', '')}-macosx_*\n"
f"\nDownload link: {url}",
file=sys.stderr,
)
raise SystemExit(1)
pkg_path = tmp / "Python.pkg"
# download the pkg
download(url, pkg_path)
# install
call("sudo", "installer", "-pkg", pkg_path, "-target", "/")
pkg_path.unlink()
env = os.environ.copy()
env["PIP_DISABLE_PIP_VERSION_CHECK"] = "1"
call(installation_path / "bin" / "python3", install_certifi_script, env=env)
return installation_path / "bin" / "python3"
def make_symlinks(installation_bin_path: Path, python_executable: str, pip_executable: str) -> None:
assert (installation_bin_path / python_executable).exists()
# Python bin folders on Mac don't symlink `python3` to `python`, and neither
# does PyPy for `pypy` or `pypy3`, so we do that so `python` and `pip` always
# point to the active configuration.
if SYMLINKS_DIR.exists():
shutil.rmtree(SYMLINKS_DIR)
SYMLINKS_DIR.mkdir(parents=True)
(SYMLINKS_DIR / "python").symlink_to(installation_bin_path / python_executable)
(SYMLINKS_DIR / "python-config").symlink_to(
installation_bin_path / (python_executable + "-config")
)
(SYMLINKS_DIR / "pip").symlink_to(installation_bin_path / pip_executable)
def install_cpython(version: str, url: str) -> Path:
installed_system_packages = subprocess.run(
["pkgutil", "--pkgs"], universal_newlines=True, check=True, stdout=subprocess.PIPE
).stdout.splitlines()
# if this version of python isn't installed, get it from python.org and install
python_package_identifier = f"org.python.Python.PythonFramework-{version}"
python_executable = "python3"
installation_bin_path = Path(f"/Library/Frameworks/Python.framework/Versions/{version}/bin")
if python_package_identifier not in installed_system_packages:
# download the pkg
download(url, Path("/tmp/Python.pkg"))
# install
call(["sudo", "installer", "-pkg", "/tmp/Python.pkg", "-target", "/"])
call(["sudo", str(installation_bin_path / python_executable), str(install_certifi_script)])
pip_executable = "pip3"
make_symlinks(installation_bin_path, python_executable, pip_executable)
return installation_bin_path
def install_pypy(version: str, url: str) -> Path:
def install_pypy(tmp: Path, url: str) -> Path:
pypy_tar_bz2 = url.rsplit("/", 1)[-1]
extension = ".tar.bz2"
assert pypy_tar_bz2.endswith(extension)
pypy_base_filename = pypy_tar_bz2[: -len(extension)]
installation_path = Path("/tmp") / pypy_base_filename
if not installation_path.exists():
downloaded_tar_bz2 = Path("/tmp") / pypy_tar_bz2
download(url, downloaded_tar_bz2)
call(["tar", "-C", "/tmp", "-xf", downloaded_tar_bz2])
installation_bin_path = installation_path / "bin"
python_executable = "pypy3"
pip_executable = "pip3"
make_symlinks(installation_bin_path, python_executable, pip_executable)
return installation_bin_path
installation_path = CIBW_CACHE_PATH / pypy_tar_bz2[: -len(extension)]
with FileLock(str(installation_path) + ".lock"):
if not installation_path.exists():
downloaded_tar_bz2 = tmp / pypy_tar_bz2
download(url, downloaded_tar_bz2)
installation_path.parent.mkdir(parents=True, exist_ok=True)
call("tar", "-C", installation_path.parent, "-xf", downloaded_tar_bz2)
downloaded_tar_bz2.unlink()
return installation_path / "bin" / "pypy3"
def setup_python(
tmp: Path,
python_configuration: PythonConfiguration,
dependency_constraint_flags: Sequence[PathOrStr],
environment: ParsedEnvironment,
build_frontend: BuildFrontend,
) -> Dict[str, str]:
tmp.mkdir()
implementation_id = python_configuration.identifier.split("-")[0]
log.step(f"Installing Python {implementation_id}...")
if implementation_id.startswith("cp"):
installation_bin_path = install_cpython(
python_configuration.version, python_configuration.url
)
base_python = install_cpython(tmp, python_configuration.version, python_configuration.url)
elif implementation_id.startswith("pp"):
installation_bin_path = install_pypy(python_configuration.version, python_configuration.url)
base_python = install_pypy(tmp, python_configuration.url)
else:
raise ValueError("Unknown Python implementation")
assert base_python.exists()
log.step("Setting up build environment...")
env = os.environ.copy()
env["PATH"] = os.pathsep.join(
[
str(SYMLINKS_DIR),
str(installation_bin_path),
env["PATH"],
]
)
venv_path = tmp / "venv"
env = virtualenv(base_python, venv_path, dependency_constraint_flags)
venv_bin_path = venv_path / "bin"
assert venv_bin_path.exists()
# Fix issue with site.py setting the wrong `sys.prefix`, `sys.exec_prefix`,
# `sys.path`, ... for PyPy: https://foss.heptapod.net/pypy/pypy/issues/3175
# Also fix an issue with the shebang of installed scripts inside the
@@ -196,40 +158,29 @@ def setup_python(
# we version pip ourselves, so we don't care about pip version checking
env["PIP_DISABLE_PIP_VERSION_CHECK"] = "1"
# Install pip
requires_reinstall = not (installation_bin_path / "pip").exists()
if requires_reinstall:
# maybe pip isn't installed at all. ensurepip resolves that.
call(["python", "-m", "ensurepip"], env=env, cwd="/tmp")
# upgrade pip to the version matching our constraints
# if necessary, reinstall it to ensure that it's available on PATH as 'pip'
call(
[
"python",
"-m",
"pip",
"install",
"--force-reinstall" if requires_reinstall else "--upgrade",
"pip",
*dependency_constraint_flags,
],
"python",
"-m",
"pip",
"install",
"--upgrade",
"pip",
*dependency_constraint_flags,
env=env,
cwd="/tmp",
cwd=venv_path,
)
# Apply our environment after pip is ready
env = environment.as_dictionary(prev_environment=env)
# check what pip version we're on
assert (installation_bin_path / "pip").exists()
call(["which", "pip"], env=env)
call(["pip", "--version"], env=env)
which_pip = subprocess.run(
["which", "pip"], env=env, universal_newlines=True, check=True, stdout=subprocess.PIPE
).stdout.strip()
if which_pip != "/tmp/cibw_bin/pip":
assert (venv_bin_path / "pip").exists()
call("which", "pip", env=env)
call("pip", "--version", env=env)
which_pip = call("which", "pip", env=env, capture_stdout=True).strip()
if which_pip != str(venv_bin_path / "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,
@@ -237,12 +188,10 @@ def setup_python(
sys.exit(1)
# check what Python version we're on
call(["which", "python"], env=env)
call(["python", "--version"], env=env)
which_python = subprocess.run(
["which", "python"], env=env, universal_newlines=True, check=True, stdout=subprocess.PIPE
).stdout.strip()
if which_python != "/tmp/cibw_bin/python":
call("which", "python", env=env)
call("python", "--version", env=env)
which_python = call("which", "python", env=env, capture_stdout=True).strip()
if which_python != str(venv_bin_path / "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,
@@ -296,27 +245,23 @@ def setup_python(
log.step("Installing build tools...")
if build_frontend == "pip":
call(
[
"pip",
"install",
"--upgrade",
"setuptools",
"wheel",
"delocate",
*dependency_constraint_flags,
],
"pip",
"install",
"--upgrade",
"setuptools",
"wheel",
"delocate",
*dependency_constraint_flags,
env=env,
)
elif build_frontend == "build":
call(
[
"pip",
"install",
"--upgrade",
"delocate",
"build[virtualenv]",
*dependency_constraint_flags,
],
"pip",
"install",
"--upgrade",
"delocate",
"build[virtualenv]",
*dependency_constraint_flags,
env=env,
)
else:
@@ -325,11 +270,7 @@ def setup_python(
return env
def build(options: Options) -> None:
temp_dir = Path(tempfile.mkdtemp(prefix="cibuildwheel"))
built_wheel_dir = temp_dir / "built_wheel"
repaired_wheel_dir = temp_dir / "repaired_wheel"
def build(options: Options, tmp_path: Path) -> None:
python_configurations = get_python_configurations(
options.globals.build_selector, options.globals.architectures
)
@@ -345,12 +286,17 @@ def build(options: Options) -> None:
before_all_prepared = prepare_command(
before_all_options.before_all, project=".", package=before_all_options.package_dir
)
call([before_all_prepared], shell=True, env=env)
shell(before_all_prepared, env=env)
for config in python_configurations:
build_options = options.build_options(config.identifier)
log.build_start(config.identifier)
identifier_tmp_dir = tmp_path / config.identifier
identifier_tmp_dir.mkdir()
built_wheel_dir = identifier_tmp_dir / "built_wheel"
repaired_wheel_dir = identifier_tmp_dir / "repaired_wheel"
config_is_arm64 = config.identifier.endswith("arm64")
config_is_universal2 = config.identifier.endswith("universal2")
@@ -362,6 +308,7 @@ def build(options: Options) -> None:
]
env = setup_python(
identifier_tmp_dir / "build",
config,
dependency_constraint_flags,
build_options.environment,
@@ -373,12 +320,10 @@ def build(options: Options) -> None:
before_build_prepared = prepare_command(
build_options.before_build, project=".", package=build_options.package_dir
)
call(before_build_prepared, env=env, shell=True)
shell(before_build_prepared, env=env)
log.step("Building wheel...")
if built_wheel_dir.exists():
shutil.rmtree(built_wheel_dir)
built_wheel_dir.mkdir(parents=True)
built_wheel_dir.mkdir()
verbosity_flags = get_build_verbosity_extra_flags(build_options.build_verbosity)
@@ -386,37 +331,33 @@ def build(options: Options) -> None:
# Path.resolve() is needed. Without it pip wheel may try to fetch package from pypi.org
# see https://github.com/pypa/cibuildwheel/pull/369
call(
[
"python",
"-m",
"pip",
"wheel",
build_options.package_dir.resolve(),
f"--wheel-dir={built_wheel_dir}",
"--no-deps",
*verbosity_flags,
],
"python",
"-m",
"pip",
"wheel",
build_options.package_dir.resolve(),
f"--wheel-dir={built_wheel_dir}",
"--no-deps",
*verbosity_flags,
env=env,
)
elif build_options.build_frontend == "build":
config_setting = " ".join(verbosity_flags)
build_env = env.copy()
if build_options.dependency_constraints:
constr = build_options.dependency_constraints.get_for_python_version(
constraint_path = build_options.dependency_constraints.get_for_python_version(
config.version
)
build_env["PIP_CONSTRAINT"] = constr.as_uri()
build_env["PIP_CONSTRAINT"] = constraint_path.as_uri()
build_env["VIRTUALENV_PIP"] = get_pip_version(env)
call(
[
"python",
"-m",
"build",
build_options.package_dir,
"--wheel",
f"--outdir={built_wheel_dir}",
f"--config-setting={config_setting}",
],
"python",
"-m",
"build",
build_options.package_dir,
"--wheel",
f"--outdir={built_wheel_dir}",
f"--config-setting={config_setting}",
env=build_env,
)
else:
@@ -424,9 +365,7 @@ def build(options: Options) -> None:
built_wheel = next(built_wheel_dir.glob("*.whl"))
if repaired_wheel_dir.exists():
shutil.rmtree(repaired_wheel_dir)
repaired_wheel_dir.mkdir(parents=True)
repaired_wheel_dir.mkdir()
if built_wheel.name.endswith("none-any.whl"):
raise NonPlatformWheelError()
@@ -447,7 +386,7 @@ def build(options: Options) -> None:
dest_dir=repaired_wheel_dir,
delocate_archs=delocate_archs,
)
call(repair_command_prepared, env=env, shell=True)
shell(repair_command_prepared, env=env)
else:
shutil.move(str(built_wheel), repaired_wheel_dir)
@@ -457,7 +396,7 @@ def build(options: Options) -> None:
if build_options.test_command and build_options.test_selector(config.identifier):
machine_arch = platform.machine()
testing_archs: List[Literal["x86_64", "arm64"]] = []
testing_archs: List[Literal["x86_64", "arm64"]]
if config_is_arm64:
testing_archs = ["arm64"]
@@ -512,8 +451,9 @@ def build(options: Options) -> None:
# set up a virtual environment to install and test from, to make sure
# there are no dependencies that were pulled in at build time.
call(["pip", "install", "virtualenv", *dependency_constraint_flags], env=env)
venv_dir = Path(tempfile.mkdtemp())
call("pip", "install", "virtualenv", *dependency_constraint_flags, env=env)
venv_dir = identifier_tmp_dir / "venv-test"
arch_prefix = []
if testing_arch != machine_arch:
@@ -521,23 +461,16 @@ def build(options: Options) -> None:
# rosetta2 will provide the emulation with just the arch prefix.
arch_prefix = ["arch", "-x86_64"]
else:
raise RuntimeError(
"don't know how to emulate {testing_arch} on {machine_arch}"
)
msg = f"don't know how to emulate {testing_arch} on {machine_arch}"
raise RuntimeError(msg)
# define a custom 'call' function that adds the arch prefix each time
def call_with_arch(args: Sequence[PathOrStr], **kwargs: Any) -> None:
if isinstance(args, str):
args = " ".join(arch_prefix) + " " + args
else:
args = [*arch_prefix, *args]
call(args, **kwargs)
call_with_arch = functools.partial(call, *arch_prefix)
shell_with_arch = functools.partial(shell, *arch_prefix)
# Use --no-download to ensure determinism by using seed libraries
# built into virtualenv
call_with_arch(
["python", "-m", "virtualenv", "--no-download", venv_dir], env=env
)
call_with_arch("python", "-m", "virtualenv", "--no-download", venv_dir, env=env)
virtualenv_env = env.copy()
virtualenv_env["PATH"] = os.pathsep.join(
@@ -548,7 +481,7 @@ def build(options: Options) -> None:
)
# check that we are using the Python from the virtual environment
call_with_arch(["which", "python"], env=virtualenv_env)
call_with_arch("which", "python", env=virtualenv_env)
if build_options.before_test:
before_test_prepared = prepare_command(
@@ -556,18 +489,20 @@ def build(options: Options) -> None:
project=".",
package=build_options.package_dir,
)
call_with_arch(before_test_prepared, env=virtualenv_env, shell=True)
shell_with_arch(before_test_prepared, env=virtualenv_env)
# install the wheel
call_with_arch(
["pip", "install", f"{repaired_wheel}{build_options.test_extras}"],
"pip",
"install",
f"{repaired_wheel}{build_options.test_extras}",
env=virtualenv_env,
)
# test the wheel
if build_options.test_requires:
call_with_arch(
["pip", "install"] + build_options.test_requires, env=virtualenv_env
"pip", "install", *build_options.test_requires, env=virtualenv_env
)
# run the tests from $HOME, with an absolute path in the command
@@ -578,18 +513,16 @@ def build(options: Options) -> None:
project=Path(".").resolve(),
package=build_options.package_dir.resolve(),
)
call_with_arch(
test_command_prepared,
cwd=os.environ["HOME"],
env=virtualenv_env,
shell=True,
shell_with_arch(
test_command_prepared, cwd=os.environ["HOME"], env=virtualenv_env
)
# clean up
shutil.rmtree(venv_dir)
# we're all done here; move it to output (overwrite existing)
shutil.move(str(repaired_wheel), build_options.output_dir)
# clean up
shutil.rmtree(identifier_tmp_dir)
log.build_end()
except subprocess.CalledProcessError as error:
log.step_end_with_error(
+21 -23
View File
@@ -1,3 +1,4 @@
import functools
import os
import sys
import traceback
@@ -31,6 +32,7 @@ from .util import (
BuildSelector,
DependencyConstraints,
TestSelector,
cached_property,
resources_dir,
selector_matches,
strtobool,
@@ -94,7 +96,7 @@ class BuildOptions(NamedTuple):
return self.globals.architectures
Setting = Union[Dict[str, str], List[str], str]
Setting = Union[Dict[str, str], List[str], str, int]
class Override(NamedTuple):
@@ -139,7 +141,8 @@ def _dig_first(*pairs: Tuple[Mapping[str, Setting], str], ignore_empty: bool = F
return value
raise KeyError(key)
last_key = pairs[-1][1]
raise KeyError(last_key)
class OptionsReader:
@@ -310,14 +313,16 @@ class OptionsReader:
if table is None:
raise ConfigOptionError(f"{name} does not accept a table")
return table["sep"].join(table["item"].format(k=k, v=v) for k, v in result.items())
elif isinstance(result, list):
if isinstance(result, list):
if sep is None:
raise ConfigOptionError(f"{name} does not accept a list")
return sep.join(result)
elif isinstance(result, int):
if isinstance(result, int):
return str(result)
else:
return result
return result
class Options:
@@ -345,12 +350,10 @@ class Options:
return None
@property
@cached_property
def package_requires_python_str(self) -> Optional[str]:
if not hasattr(self, "_package_requires_python_str"):
args = self.command_line_arguments
self._package_requires_python_str = get_requires_python_str(Path(args.package_dir))
return self._package_requires_python_str
args = self.command_line_arguments
return get_requires_python_str(Path(args.package_dir))
@property
def globals(self) -> GlobalOptions:
@@ -479,13 +482,12 @@ class Options:
if not config_value:
# default to manylinux2014
image = pinned_images.get("manylinux2014")
image = pinned_images["manylinux2014"]
elif config_value in pinned_images:
image = pinned_images[config_value]
else:
image = config_value
assert image is not None
manylinux_images[build_platform] = image
for build_platform in MUSLLINUX_ARCHS:
@@ -493,7 +495,7 @@ class Options:
config_value = self.reader.get(f"musllinux-{build_platform}-image")
if config_value is None:
if not config_value:
image = pinned_images["musllinux_1_1"]
elif config_value in pinned_images:
image = pinned_images[config_value]
@@ -574,9 +576,7 @@ def compute_options(
return options
_all_pinned_docker_images: Optional[ConfigParser] = None
@functools.lru_cache(maxsize=None)
def _get_pinned_docker_images() -> Mapping[str, Mapping[str, str]]:
"""
This looks like a dict of dicts, e.g.
@@ -585,13 +585,11 @@ def _get_pinned_docker_images() -> Mapping[str, Mapping[str, str]]:
'pypy_x86_64': {'manylinux2010': '...' }
... }
"""
global _all_pinned_docker_images
if _all_pinned_docker_images is None:
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_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
def deprecated_selectors(name: str, selector: str, *, error: bool = False) -> None:
+8 -8
View File
@@ -23,11 +23,11 @@ class Analyzer(ast.NodeVisitor):
def __init__(self) -> None:
self.requires_python: Optional[str] = None
def visit(self, content: ast.AST) -> None:
for node in ast.walk(content):
for child in ast.iter_child_nodes(node):
child.parent = node # type: ignore[attr-defined]
super().visit(content)
def visit(self, node: ast.AST) -> None:
for inner_node in ast.walk(node):
for child in ast.iter_child_nodes(inner_node):
child.parent = inner_node # type: ignore[attr-defined]
super().visit(node)
def visit_keyword(self, node: ast.keyword) -> None:
self.generic_visit(node)
@@ -46,12 +46,12 @@ def setup_py_python_requires(content: str) -> Optional[str]:
analyzer = Analyzer()
analyzer.visit(tree)
return analyzer.requires_python or None
except Exception:
except Exception: # pylint: disable=broad-except
return None
def get_requires_python_str(package_dir: Path) -> Optional[str]:
"Return the python requires string from the most canonical source available, or None"
"""Return the python requires string from the most canonical source available, or None"""
# Read in from pyproject.toml:project.requires-python
try:
@@ -70,7 +70,7 @@ def get_requires_python_str(package_dir: Path) -> Optional[str]:
pass
try:
with (package_dir / "setup.py").open() as f2:
with (package_dir / "setup.py").open(encoding="utf8") as f2:
return setup_py_python_requires(f2.read())
except FileNotFoundError:
pass
+21 -16
View File
@@ -12,6 +12,7 @@ python_configurations = [
{ identifier = "cp310-manylinux_i686", version = "3.10", path_str = "/opt/python/cp310-cp310" },
{ identifier = "pp37-manylinux_x86_64", version = "3.7", path_str = "/opt/python/pp37-pypy37_pp73" },
{ identifier = "pp38-manylinux_x86_64", version = "3.8", path_str = "/opt/python/pp38-pypy38_pp73" },
{ identifier = "pp39-manylinux_x86_64", version = "3.9", path_str = "/opt/python/pp39-pypy39_pp73" },
{ identifier = "cp36-manylinux_aarch64", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-manylinux_aarch64", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-manylinux_aarch64", version = "3.8", path_str = "/opt/python/cp38-cp38" },
@@ -29,8 +30,10 @@ python_configurations = [
{ identifier = "cp310-manylinux_s390x", version = "3.10", path_str = "/opt/python/cp310-cp310" },
{ identifier = "pp37-manylinux_aarch64", version = "3.7", path_str = "/opt/python/pp37-pypy37_pp73" },
{ identifier = "pp38-manylinux_aarch64", version = "3.8", path_str = "/opt/python/pp38-pypy38_pp73" },
{ identifier = "pp39-manylinux_aarch64", version = "3.9", path_str = "/opt/python/pp39-pypy39_pp73" },
{ identifier = "pp37-manylinux_i686", version = "3.7", path_str = "/opt/python/pp37-pypy37_pp73" },
{ identifier = "pp38-manylinux_i686", version = "3.8", path_str = "/opt/python/pp38-pypy38_pp73" },
{ identifier = "pp39-manylinux_i686", version = "3.9", path_str = "/opt/python/pp39-pypy39_pp73" },
{ identifier = "cp36-musllinux_x86_64", version = "3.6", path_str = "/opt/python/cp36-cp36m" },
{ identifier = "cp37-musllinux_x86_64", version = "3.7", path_str = "/opt/python/cp37-cp37m" },
{ identifier = "cp38-musllinux_x86_64", version = "3.8", path_str = "/opt/python/cp38-cp38" },
@@ -65,14 +68,15 @@ python_configurations = [
{ identifier = "cp38-macosx_x86_64", version = "3.8", url = "https://www.python.org/ftp/python/3.8.10/python-3.8.10-macosx10.9.pkg" },
{ identifier = "cp38-macosx_arm64", version = "3.8", url = "https://www.python.org/ftp/python/3.8.10/python-3.8.10-macosx10.9.pkg" },
{ identifier = "cp38-macosx_universal2", version = "3.8", url = "https://www.python.org/ftp/python/3.8.10/python-3.8.10-macosx10.9.pkg" },
{ identifier = "cp39-macosx_x86_64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.9/python-3.9.9-macos11.pkg" },
{ identifier = "cp39-macosx_arm64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.9/python-3.9.9-macos11.pkg" },
{ identifier = "cp39-macosx_universal2", version = "3.9", url = "https://www.python.org/ftp/python/3.9.9/python-3.9.9-macos11.pkg" },
{ identifier = "cp310-macosx_x86_64", version = "3.10", url = "https://www.python.org/ftp/python/3.10.1/python-3.10.1-macos11.pkg" },
{ identifier = "cp310-macosx_arm64", version = "3.10", url = "https://www.python.org/ftp/python/3.10.1/python-3.10.1-macos11.pkg" },
{ identifier = "cp310-macosx_universal2", version = "3.10", url = "https://www.python.org/ftp/python/3.10.1/python-3.10.1-macos11.pkg" },
{ identifier = "pp37-macosx_x86_64", version = "3.7", url = "https://downloads.python.org/pypy/pypy3.7-v7.3.7-osx64.tar.bz2" },
{ identifier = "pp38-macosx_x86_64", version = "3.8", url = "https://downloads.python.org/pypy/pypy3.8-v7.3.7-osx64.tar.bz2" },
{ identifier = "cp39-macosx_x86_64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.12/python-3.9.12-macos11.pkg" },
{ identifier = "cp39-macosx_arm64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.12/python-3.9.12-macos11.pkg" },
{ identifier = "cp39-macosx_universal2", version = "3.9", url = "https://www.python.org/ftp/python/3.9.12/python-3.9.12-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 = "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" },
]
[windows]
@@ -83,12 +87,13 @@ python_configurations = [
{ identifier = "cp37-win_amd64", version = "3.7.9", arch = "64" },
{ identifier = "cp38-win32", version = "3.8.10", arch = "32" },
{ identifier = "cp38-win_amd64", version = "3.8.10", arch = "64" },
{ identifier = "cp39-win32", version = "3.9.9", arch = "32" },
{ identifier = "cp39-win_amd64", version = "3.9.9", arch = "64" },
{ identifier = "cp310-win32", version = "3.10.1", arch = "32" },
{ identifier = "cp310-win_amd64", version = "3.10.1", arch = "64" },
{ identifier = "cp39-win_arm64", version = "3.9.9", arch = "ARM64" },
{ identifier = "cp310-win_arm64", version = "3.10.1", arch = "ARM64" },
{ identifier = "pp37-win_amd64", version = "3.7", arch = "64", url = "https://downloads.python.org/pypy/pypy3.7-v7.3.7-win64.zip" },
{ identifier = "pp38-win_amd64", version = "3.8", arch = "64", url = "https://downloads.python.org/pypy/pypy3.8-v7.3.7-win64.zip" },
{ identifier = "cp39-win32", version = "3.9.12", arch = "32" },
{ identifier = "cp39-win_amd64", version = "3.9.12", arch = "64" },
{ identifier = "cp310-win32", version = "3.10.4", arch = "32" },
{ identifier = "cp310-win_amd64", version = "3.10.4", arch = "64" },
{ identifier = "cp39-win_arm64", version = "3.9.10", arch = "ARM64" },
{ identifier = "cp310-win_arm64", version = "3.10.4", 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" },
]
@@ -0,0 +1,30 @@
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# bin/update_dependencies.py
#
delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.4
# via virtualenv
filelock==3.6.0
# via virtualenv
platformdirs==2.5.1
# via virtualenv
six==1.16.0
# via virtualenv
typing-extensions==4.1.1
# via delocate
virtualenv==20.14.0
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.1
# via
# -r cibuildwheel/resources/constraints.in
# delocate
# The following packages are considered to be unsafe in a requirements file:
pip==22.0.4
# via -r cibuildwheel/resources/constraints.in
setuptools==61.3.0
# via -r cibuildwheel/resources/constraints.in
@@ -4,31 +4,27 @@
#
# bin/update_dependencies.py
#
backports.entry-points-selectable==1.1.1
# via virtualenv
delocate==0.10.1
delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.4
# via virtualenv
filelock==3.4.0
filelock==3.4.1
# via virtualenv
importlib-metadata==4.8.3
# via virtualenv
importlib-metadata==4.8.2
# via
# backports.entry-points-selectable
# virtualenv
importlib-resources==5.4.0
# via virtualenv
platformdirs==2.4.0
# via virtualenv
six==1.16.0
# via virtualenv
typing-extensions==4.0.1
typing-extensions==4.1.1
# via
# delocate
# importlib-metadata
virtualenv==20.10.0
virtualenv==20.14.0
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.0
wheel==0.37.1
# via
# -r cibuildwheel/resources/constraints.in
# delocate
+11 -15
View File
@@ -4,37 +4,33 @@
#
# bin/update_dependencies.py
#
backports.entry-points-selectable==1.1.1
# via virtualenv
delocate==0.10.1
delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.4
# via virtualenv
filelock==3.4.0
filelock==3.6.0
# via virtualenv
importlib-metadata==4.8.2
# via
# backports.entry-points-selectable
# virtualenv
platformdirs==2.4.0
importlib-metadata==4.11.3
# via virtualenv
platformdirs==2.5.1
# via virtualenv
six==1.16.0
# via virtualenv
typing-extensions==4.0.1
typing-extensions==4.1.1
# via
# delocate
# importlib-metadata
virtualenv==20.10.0
virtualenv==20.14.0
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.0
wheel==0.37.1
# via
# -r cibuildwheel/resources/constraints.in
# delocate
zipp==3.6.0
zipp==3.7.0
# via importlib-metadata
# The following packages are considered to be unsafe in a requirements file:
pip==21.3.1
pip==22.0.4
# via -r cibuildwheel/resources/constraints.in
setuptools==59.6.0
setuptools==61.3.0
# via -r cibuildwheel/resources/constraints.in
@@ -4,29 +4,27 @@
#
# bin/update_dependencies.py
#
backports.entry-points-selectable==1.1.1
# via virtualenv
delocate==0.10.1
delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.4
# via virtualenv
filelock==3.4.0
filelock==3.6.0
# via virtualenv
platformdirs==2.4.0
platformdirs==2.5.1
# via virtualenv
six==1.16.0
# via virtualenv
typing-extensions==4.0.1
typing-extensions==4.1.1
# via delocate
virtualenv==20.10.0
virtualenv==20.14.0
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.0
wheel==0.37.1
# via
# -r cibuildwheel/resources/constraints.in
# delocate
# The following packages are considered to be unsafe in a requirements file:
pip==21.3.1
pip==22.0.4
# via -r cibuildwheel/resources/constraints.in
setuptools==59.6.0
setuptools==61.3.0
# via -r cibuildwheel/resources/constraints.in
@@ -4,29 +4,27 @@
#
# bin/update_dependencies.py
#
backports.entry-points-selectable==1.1.1
# via virtualenv
delocate==0.10.1
delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.4
# via virtualenv
filelock==3.4.0
filelock==3.6.0
# via virtualenv
platformdirs==2.4.0
platformdirs==2.5.1
# via virtualenv
six==1.16.0
# via virtualenv
typing-extensions==4.0.1
typing-extensions==4.1.1
# via delocate
virtualenv==20.10.0
virtualenv==20.14.0
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.0
wheel==0.37.1
# via
# -r cibuildwheel/resources/constraints.in
# delocate
# The following packages are considered to be unsafe in a requirements file:
pip==21.3.1
pip==22.0.4
# via -r cibuildwheel/resources/constraints.in
setuptools==59.6.0
setuptools==61.3.0
# via -r cibuildwheel/resources/constraints.in
+8 -10
View File
@@ -4,29 +4,27 @@
#
# bin/update_dependencies.py
#
backports.entry-points-selectable==1.1.1
# via virtualenv
delocate==0.10.1
delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.4
# via virtualenv
filelock==3.4.0
filelock==3.6.0
# via virtualenv
platformdirs==2.4.0
platformdirs==2.5.1
# via virtualenv
six==1.16.0
# via virtualenv
typing-extensions==4.0.1
typing-extensions==4.1.1
# via delocate
virtualenv==20.10.0
virtualenv==20.14.0
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.0
wheel==0.37.1
# via
# -r cibuildwheel/resources/constraints.in
# delocate
# The following packages are considered to be unsafe in a requirements file:
pip==21.3.1
pip==22.0.4
# via -r cibuildwheel/resources/constraints.in
setuptools==59.6.0
setuptools==61.3.0
# via -r cibuildwheel/resources/constraints.in
+27 -27
View File
@@ -1,43 +1,43 @@
[x86_64]
manylinux1 = quay.io/pypa/manylinux1_x86_64:2021-12-11-951973d
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2021-12-12-e5100b5
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2021-12-12-e5100b5
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2021-12-12-e5100b5
musllinux_1_1 = quay.io/pypa/musllinux_1_1_x86_64:2021-12-12-e5100b5
manylinux1 = quay.io/pypa/manylinux1_x86_64:2022-03-31-9afae1d
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2022-03-31-361e6b6
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2022-03-31-361e6b6
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2022-03-31-361e6b6
musllinux_1_1 = quay.io/pypa/musllinux_1_1_x86_64:2022-03-31-361e6b6
[i686]
manylinux1 = quay.io/pypa/manylinux1_i686:2021-12-11-951973d
manylinux2010 = quay.io/pypa/manylinux2010_i686:2021-12-12-e5100b5
manylinux2014 = quay.io/pypa/manylinux2014_i686:2021-12-12-e5100b5
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2021-12-12-e5100b5
musllinux_1_1 = quay.io/pypa/musllinux_1_1_i686:2021-12-12-e5100b5
manylinux1 = quay.io/pypa/manylinux1_i686:2022-03-31-9afae1d
manylinux2010 = quay.io/pypa/manylinux2010_i686:2022-03-31-361e6b6
manylinux2014 = quay.io/pypa/manylinux2014_i686:2022-03-31-361e6b6
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2022-03-31-361e6b6
musllinux_1_1 = quay.io/pypa/musllinux_1_1_i686:2022-03-31-361e6b6
[pypy_x86_64]
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2021-12-12-e5100b5
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2021-12-12-e5100b5
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2021-12-12-e5100b5
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2022-03-31-361e6b6
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2022-03-31-361e6b6
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2022-03-31-361e6b6
[pypy_i686]
manylinux2010 = quay.io/pypa/manylinux2010_i686:2021-12-12-e5100b5
manylinux2014 = quay.io/pypa/manylinux2014_i686:2021-12-12-e5100b5
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2021-12-12-e5100b5
manylinux2010 = quay.io/pypa/manylinux2010_i686:2022-03-31-361e6b6
manylinux2014 = quay.io/pypa/manylinux2014_i686:2022-03-31-361e6b6
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2022-03-31-361e6b6
[aarch64]
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2021-12-12-e5100b5
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2021-12-12-e5100b5
musllinux_1_1 = quay.io/pypa/musllinux_1_1_aarch64:2021-12-12-e5100b5
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2022-03-31-361e6b6
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2022-03-31-361e6b6
musllinux_1_1 = quay.io/pypa/musllinux_1_1_aarch64:2022-03-31-361e6b6
[ppc64le]
manylinux2014 = quay.io/pypa/manylinux2014_ppc64le:2021-12-12-e5100b5
manylinux_2_24 = quay.io/pypa/manylinux_2_24_ppc64le:2021-12-12-e5100b5
musllinux_1_1 = quay.io/pypa/musllinux_1_1_ppc64le:2021-12-12-e5100b5
manylinux2014 = quay.io/pypa/manylinux2014_ppc64le:2022-03-31-361e6b6
manylinux_2_24 = quay.io/pypa/manylinux_2_24_ppc64le:2022-03-31-361e6b6
musllinux_1_1 = quay.io/pypa/musllinux_1_1_ppc64le:2022-03-31-361e6b6
[s390x]
manylinux2014 = quay.io/pypa/manylinux2014_s390x:2021-12-12-e5100b5
manylinux_2_24 = quay.io/pypa/manylinux_2_24_s390x:2021-12-12-e5100b5
musllinux_1_1 = quay.io/pypa/musllinux_1_1_s390x:2021-12-12-e5100b5
manylinux2014 = quay.io/pypa/manylinux2014_s390x:2022-03-31-361e6b6
manylinux_2_24 = quay.io/pypa/manylinux_2_24_s390x:2022-03-31-361e6b6
musllinux_1_1 = quay.io/pypa/musllinux_1_1_s390x:2022-03-31-361e6b6
[pypy_aarch64]
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2021-12-12-e5100b5
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2021-12-12-e5100b5
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2022-03-31-361e6b6
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2022-03-31-361e6b6
+2
View File
@@ -0,0 +1,2 @@
version = "20.13.3"
url = "https://github.com/pypa/get-virtualenv/blob/20.13.3/public/virtualenv.pyz?raw=true"
+245 -56
View File
@@ -1,8 +1,10 @@
import contextlib
import dataclasses
import fnmatch
import itertools
import os
import re
import shlex
import ssl
import subprocess
import sys
@@ -10,25 +12,56 @@ import textwrap
import time
import urllib.request
from enum import Enum
from functools import lru_cache
from pathlib import Path
from time import sleep
from typing import Any, Dict, Iterable, Iterator, List, Optional, TextIO
from typing import (
Any,
ClassVar,
Dict,
Iterable,
Iterator,
List,
NamedTuple,
Optional,
Sequence,
TextIO,
cast,
overload,
)
import bracex
import certifi
import tomli
from filelock import FileLock
from packaging.requirements import InvalidRequirement, Requirement
from packaging.specifiers import SpecifierSet
from packaging.version import Version
from platformdirs import user_cache_path
from .typing import Literal, PathOrStr, PlatformName
from cibuildwheel.typing import Final, Literal, PathOrStr, PlatformName
resources_dir = Path(__file__).parent / "resources"
__all__ = [
"resources_dir",
"MANYLINUX_ARCHS",
"call",
"shell",
"format_safe",
"prepare_command",
"get_build_verbosity_extra_flags",
"read_python_configs",
"selector_matches",
"strtobool",
"cached_property",
]
install_certifi_script = resources_dir / "install_certifi.py"
resources_dir: Final = Path(__file__).parent / "resources"
install_certifi_script: Final = resources_dir / "install_certifi.py"
BuildFrontend = Literal["pip", "build"]
MANYLINUX_ARCHS = (
MANYLINUX_ARCHS: Final = (
"x86_64",
"i686",
"pypy_x86_64",
@@ -39,7 +72,7 @@ MANYLINUX_ARCHS = (
"pypy_i686",
)
MUSLLINUX_ARCHS = (
MUSLLINUX_ARCHS: Final = (
"x86_64",
"i686",
"aarch64",
@@ -47,6 +80,64 @@ MUSLLINUX_ARCHS = (
"s390x",
)
DEFAULT_CIBW_CACHE_PATH: Final = user_cache_path(appname="cibuildwheel", appauthor="pypa")
CIBW_CACHE_PATH: Final = Path(os.environ.get("CIBW_CACHE_PATH", DEFAULT_CIBW_CACHE_PATH)).resolve()
IS_WIN: Final = sys.platform.startswith("win")
@overload
def call(
*args: PathOrStr,
env: Optional[Dict[str, str]] = None,
cwd: Optional[PathOrStr] = None,
capture_stdout: Literal[False] = ...,
) -> None:
...
@overload
def call(
*args: PathOrStr,
env: Optional[Dict[str, str]] = None,
cwd: Optional[PathOrStr] = None,
capture_stdout: Literal[True],
) -> str:
...
def call(
*args: PathOrStr,
env: Optional[Dict[str, str]] = None,
cwd: Optional[PathOrStr] = None,
capture_stdout: bool = False,
) -> Optional[str]:
"""
Run subprocess.run, but print the commands first. Takes the commands as
*args. Uses shell=True on Windows due to a bug. Also converts to
Paths to strings, due to Windows behavior at least on older Pythons.
https://bugs.python.org/issue8557
"""
args_ = [str(arg) for arg in args]
# print the command executing for the logs
print("+ " + " ".join(shlex.quote(a) for a in args_))
kwargs: Dict[str, Any] = {}
if capture_stdout:
kwargs["universal_newlines"] = True
kwargs["stdout"] = subprocess.PIPE
result = subprocess.run(args_, check=True, shell=IS_WIN, env=env, cwd=cwd, **kwargs)
if not capture_stdout:
return None
return cast(str, result.stdout)
def shell(
*commands: str, env: Optional[Dict[str, str]] = None, cwd: Optional[PathOrStr] = None
) -> None:
command = " ".join(commands)
print(f"+ {command}")
subprocess.run(command, env=env, cwd=cwd, shell=True, check=True)
def format_safe(template: str, **kwargs: Any) -> str:
"""
@@ -67,7 +158,7 @@ def format_safe(template: str, **kwargs: Any) -> str:
for key, value in kwargs.items():
find_pattern = re.compile(
fr"""
rf"""
(?<!\#) # don't match if preceded by a hash
{{ # literal open curly bracket
{re.escape(key)} # the field name
@@ -76,11 +167,11 @@ def format_safe(template: str, **kwargs: Any) -> str:
re.VERBOSE,
)
# we use a lambda for repl to prevent re.sub interpreting backslashes
# in repl as escape sequences
# we use a function for repl to prevent re.sub interpreting backslashes
# in repl as escape sequences.
result = re.sub(
pattern=find_pattern,
repl=lambda _: str(value),
repl=lambda _: str(value), # pylint: disable=cell-var-from-loop
string=result,
)
@@ -131,6 +222,8 @@ def selector_matches(patterns: str, string: str) -> bool:
return any(fnmatch.fnmatch(string, pat) for pat in expanded_patterns)
# Once we require Python 3.10+, we can add kw_only=True
@dataclasses.dataclass
class IdentifierSelector:
"""
This class holds a set of build/skip patterns. You call an instance with a
@@ -141,20 +234,12 @@ class IdentifierSelector:
"""
# a pattern that skips prerelease versions, when include_prereleases is False.
PRERELEASE_SKIP = ""
PRERELEASE_SKIP: ClassVar[str] = ""
def __init__(
self,
*,
build_config: str,
skip_config: str,
requires_python: Optional[SpecifierSet] = None,
prerelease_pythons: bool = False,
):
self.build_config = build_config
self.skip_config = skip_config
self.requires_python = requires_python
self.prerelease_pythons = prerelease_pythons
skip_config: str
build_config: str
requires_python: Optional[SpecifierSet] = None
prerelease_pythons: bool = False
def __call__(self, build_id: str) -> bool:
# Filter build selectors by python_requires if set
@@ -167,9 +252,7 @@ class IdentifierSelector:
return False
# filter out the prerelease pythons if self.prerelease_pythons is False
if not self.prerelease_pythons and selector_matches(
BuildSelector.PRERELEASE_SKIP, build_id
):
if not self.prerelease_pythons and selector_matches(self.PRERELEASE_SKIP, build_id):
return False
should_build = selector_matches(self.build_config, build_id)
@@ -177,28 +260,17 @@ class IdentifierSelector:
return should_build and not should_skip
def __repr__(self) -> str:
result = f"{self.__class__.__name__}(build_config={self.build_config!r}"
if self.skip_config:
result += f", skip_config={self.skip_config!r}"
if self.prerelease_pythons:
result += ", prerelease_pythons=True"
result += ")"
return result
@dataclasses.dataclass
class BuildSelector(IdentifierSelector):
pass
# Note that requires-python is not needed for TestSelector, as you can't test
# what you can't build.
@dataclasses.dataclass
class TestSelector(IdentifierSelector):
def __init__(self, *, skip_config: str):
super().__init__(build_config="*", skip_config=skip_config)
build_config: str = "*"
# Taken from https://stackoverflow.com/a/107717
@@ -231,18 +303,14 @@ def download(url: str, dest: Path) -> None:
repeat_num = 3
for i in range(repeat_num):
try:
response = urllib.request.urlopen(url, context=context)
except Exception:
with urllib.request.urlopen(url, context=context) as response:
dest.write_bytes(response.read())
return
except urllib.error.URLError:
if i == repeat_num - 1:
raise
sleep(3)
continue
break
try:
dest.write_bytes(response.read())
finally:
response.close()
class DependencyConstraints:
@@ -262,6 +330,7 @@ class DependencyConstraints:
specific_stem = self.base_file_path.stem + f"-python{version_parts[0]}{version_parts[1]}"
specific_name = specific_stem + self.base_file_path.suffix
specific_file_path = self.base_file_path.with_name(specific_name)
if specific_file_path.exists():
return specific_file_path
else:
@@ -352,19 +421,32 @@ def print_new_wheels(msg: str, output_dir: Path) -> Iterator[None]:
existing_contents = set(output_dir.iterdir())
yield
final_contents = set(output_dir.iterdir())
new_contents = final_contents - existing_contents
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
]
max_name_len = max(len(f.name) for f in new_contents)
max_size_len = max(len(f.size) for f in new_contents)
n = len(new_contents)
s = time.time() - start_time
m = s / 60
print(msg.format(n=n, s=s, m=m), *sorted(f" {f.name}" for f in new_contents), sep="\n")
print(
msg.format(n=n, s=s, m=m),
*sorted(
f" {f.name:<{max_name_len}s} {f.size:>{max_size_len}s} kB" for f in new_contents
),
sep="\n",
)
def get_pip_version(env: Dict[str, str]) -> str:
# we use shell=True here for windows, even though we don't need a shell due to a bug
# https://bugs.python.org/issue8557
shell = sys.platform.startswith("win")
versions_output_text = subprocess.check_output(
["python", "-m", "pip", "freeze", "--all"], universal_newlines=True, shell=shell, env=env
versions_output_text = call(
"python", "-m", "pip", "freeze", "--all", capture_stdout=True, env=env
)
(pip_version,) = (
version[5:]
@@ -372,3 +454,110 @@ def get_pip_version(env: Dict[str, str]) -> str:
if version.startswith("pip==")
)
return pip_version
@lru_cache(maxsize=None)
def _ensure_virtualenv() -> Path:
input_file = resources_dir / "virtualenv.toml"
with input_file.open("rb") as f:
loaded_file = tomli.load(f)
version = str(loaded_file["version"])
url = str(loaded_file["url"])
path = CIBW_CACHE_PATH / f"virtualenv-{version}.pyz"
with FileLock(str(path) + ".lock"):
if not path.exists():
download(url, path)
return path
def _parse_constraints_for_virtualenv(
dependency_constraint_flags: Sequence[PathOrStr],
) -> Dict[str, str]:
"""
Parses the constraints file referenced by `dependency_constraint_flags` and returns a dict where
the key is the package name, and the value is the constraint version.
If a package version cannot be found, its value is "embed" meaning that virtualenv will install
its bundled version, already available locally.
The function does not try to be too smart and just handles basic constraints.
If it can't get an exact version, the real constraint will be handled by the
{macos|windows}.setup_python function.
"""
assert len(dependency_constraint_flags) in {0, 2}
packages = ["pip", "setuptools", "wheel"]
constraints_dict = {package: "embed" for package in packages}
if len(dependency_constraint_flags) == 2:
assert dependency_constraint_flags[0] == "-c"
constraint_path = Path(dependency_constraint_flags[1])
assert constraint_path.exists()
with constraint_path.open(encoding="utf-8") as constraint_file:
for line in constraint_file:
line = line.strip()
if len(line) == 0:
continue
if line.startswith("#"):
continue
try:
requirement = Requirement(line)
package = requirement.name
if (
package not in packages
or requirement.url is not None
or requirement.marker is not None
or len(requirement.extras) != 0
or len(requirement.specifier) != 1
):
continue
specifier = next(iter(requirement.specifier))
if specifier.operator != "==":
continue
constraints_dict[package] = specifier.version
except InvalidRequirement:
continue
return constraints_dict
def virtualenv(
python: Path, venv_path: Path, dependency_constraint_flags: Sequence[PathOrStr]
) -> Dict[str, str]:
assert python.exists()
virtualenv_app = _ensure_virtualenv()
constraints = _parse_constraints_for_virtualenv(dependency_constraint_flags)
additional_flags = [f"--{package}={version}" for package, version in constraints.items()]
# Using symlinks to pre-installed seed packages is really the fastest way to get a virtual
# environment. The initial cost is a bit higher but reusing is much faster.
# Windows does not always allow symlinks so just disabling for now.
# Requires pip>=19.3 so disabling for "embed" because this means we don't know what's the
# version of pip that will end-up installed.
# c.f. https://virtualenv.pypa.io/en/latest/cli_interface.html#section-seeder
if (
not IS_WIN
and constraints["pip"] != "embed"
and Version(constraints["pip"]) >= Version("19.3")
):
additional_flags.append("--symlink-app-data")
call(
sys.executable,
"-sS", # just the stdlib, https://github.com/pypa/virtualenv/issues/2133#issuecomment-1003710125
virtualenv_app,
"--activators=",
"--no-periodic-update",
*additional_flags,
"--python",
python,
venv_path,
)
if IS_WIN:
paths = [str(venv_path), str(venv_path / "Scripts")]
else:
paths = [str(venv_path / "bin")]
env = os.environ.copy()
env["PATH"] = os.pathsep.join(paths + [env["PATH"]])
return env
if sys.version_info >= (3, 8):
from functools import cached_property
else:
from .functools_cached_property_38 import cached_property
+125 -172
View File
@@ -2,11 +2,12 @@ import os
import shutil
import subprocess
import sys
import tempfile
from functools import lru_cache
from pathlib import Path
from typing import Dict, List, NamedTuple, Optional, Sequence, Set
from zipfile import ZipFile
from filelock import FileLock
from packaging.version import Version
from .architecture import Architecture
@@ -15,36 +16,22 @@ from .logger import log
from .options import Options
from .typing import PathOrStr, assert_never
from .util import (
CIBW_CACHE_PATH,
BuildFrontend,
BuildSelector,
NonPlatformWheelError,
call,
download,
get_build_verbosity_extra_flags,
get_pip_version,
prepare_command,
read_python_configs,
shell,
virtualenv,
)
CIBW_INSTALL_PATH = Path("C:\\cibw")
def call(
args: Sequence[PathOrStr], env: Optional[Dict[str, str]] = None, cwd: Optional[PathOrStr] = None
) -> None:
print("+ " + " ".join(str(a) for a in args))
# we use shell=True here, even though we don't need a shell due to a bug
# https://bugs.python.org/issue8557
subprocess.run([str(a) for a in args], env=env, cwd=cwd, shell=True, check=True)
def shell(
command: str, env: Optional[Dict[str, str]] = None, cwd: Optional[PathOrStr] = None
) -> None:
print(f"+ {command}")
subprocess.run(command, env=env, cwd=cwd, shell=True, check=True)
def get_nuget_args(version: str, arch: str) -> List[str]:
def get_nuget_args(version: str, arch: str, output_directory: Path) -> List[str]:
platform_suffix = {"32": "x86", "64": "", "ARM64": "arm64"}
python_name = "python" + platform_suffix[arch]
return [
@@ -54,7 +41,7 @@ def get_nuget_args(version: str, arch: str) -> List[str]:
"-FallbackSource",
"https://api.nuget.org/v3/index.json",
"-OutputDirectory",
str(CIBW_INSTALL_PATH / "python"),
str(output_directory),
]
@@ -87,86 +74,74 @@ def get_python_configurations(
def extract_zip(zip_src: Path, dest: Path) -> None:
with ZipFile(zip_src) as zip:
zip.extractall(dest)
with ZipFile(zip_src) as zip_:
zip_.extractall(dest)
def install_cpython(version: str, arch: str, nuget: Path) -> Path:
nuget_args = get_nuget_args(version, arch)
installation_path = Path(nuget_args[-1]) / (nuget_args[0] + "." + version) / "tools"
call([nuget, "install", *nuget_args])
# "python3" is not included in the vanilla nuget package,
# though it can be present if modified (like on Azure).
if not (installation_path / "python3.exe").exists():
(installation_path / "python3.exe").symlink_to(installation_path / "python.exe")
return installation_path
@lru_cache(maxsize=None)
def _ensure_nuget() -> Path:
nuget = CIBW_CACHE_PATH / "nuget.exe"
with FileLock(str(nuget) + ".lock"):
if not nuget.exists():
download("https://dist.nuget.org/win-x86-commandline/latest/nuget.exe", nuget)
return nuget
def install_pypy(version: str, arch: str, url: str) -> Path:
def install_cpython(version: str, arch: str) -> Path:
base_output_dir = CIBW_CACHE_PATH / "nuget-cpython"
nuget_args = get_nuget_args(version, arch, base_output_dir)
installation_path = base_output_dir / (nuget_args[0] + "." + version) / "tools"
with FileLock(str(base_output_dir) + f"-{version}-{arch}.lock"):
if not installation_path.exists():
nuget = _ensure_nuget()
call(nuget, "install", *nuget_args)
return installation_path / "python.exe"
def install_pypy(tmp: Path, arch: str, url: str) -> Path:
assert arch == "64" and "win64" in url
# Inside the PyPy zip file is a directory with the same name
zip_filename = url.rsplit("/", 1)[-1]
extension = ".zip"
assert zip_filename.endswith(extension)
installation_path = CIBW_INSTALL_PATH / zip_filename[: -len(extension)]
if not installation_path.exists():
pypy_zip = CIBW_INSTALL_PATH / zip_filename
download(url, pypy_zip)
# Extract to the parent directory because the zip file still contains a directory
extract_zip(pypy_zip, installation_path.parent)
return installation_path
installation_path = CIBW_CACHE_PATH / zip_filename[: -len(extension)]
with FileLock(str(installation_path) + ".lock"):
if not installation_path.exists():
pypy_zip = tmp / zip_filename
download(url, pypy_zip)
# Extract to the parent directory because the zip file still contains a directory
extract_zip(pypy_zip, installation_path.parent)
return installation_path / "python.exe"
def setup_python(
tmp: Path,
python_configuration: PythonConfiguration,
dependency_constraint_flags: Sequence[PathOrStr],
environment: ParsedEnvironment,
build_frontend: BuildFrontend,
) -> Dict[str, str]:
nuget = CIBW_INSTALL_PATH / "nuget.exe"
if not nuget.exists():
log.step("Downloading nuget...")
download("https://dist.nuget.org/win-x86-commandline/latest/nuget.exe", nuget)
tmp.mkdir()
implementation_id = python_configuration.identifier.split("-")[0]
log.step(f"Installing Python {implementation_id}...")
if implementation_id.startswith("cp"):
installation_path = install_cpython(
python_configuration.version, python_configuration.arch, nuget
)
base_python = install_cpython(python_configuration.version, python_configuration.arch)
elif implementation_id.startswith("pp"):
assert python_configuration.url is not None
installation_path = install_pypy(
python_configuration.version, python_configuration.arch, python_configuration.url
)
base_python = install_pypy(tmp, python_configuration.arch, python_configuration.url)
else:
raise ValueError("Unknown Python implementation")
assert (installation_path / "python.exe").exists()
assert base_python.exists()
log.step("Setting up build environment...")
venv_path = tmp / "venv"
env = virtualenv(base_python, venv_path, dependency_constraint_flags)
# set up PATH and environment variables for run_with_env
env = os.environ.copy()
# set up environment variables for run_with_env
env["PYTHON_VERSION"] = python_configuration.version
env["PYTHON_ARCH"] = python_configuration.arch
env["PATH"] = os.pathsep.join(
[str(installation_path), str(installation_path / "Scripts"), env["PATH"]]
)
env["PIP_DISABLE_PIP_VERSION_CHECK"] = "1"
log.step("Installing build tools...")
# Install pip
requires_reinstall = not (installation_path / "Scripts" / "pip.exe").exists()
if requires_reinstall:
# maybe pip isn't installed at all. ensurepip resolves that.
call(["python", "-m", "ensurepip"], env=env, cwd=CIBW_INSTALL_PATH)
# pip older than 21.3 builds executables such as pip.exe for x64 platform.
# The first re-install of pip updates pip module but builds pip.exe using
# the old pip which still generates x64 executable. But the second
@@ -175,55 +150,41 @@ def setup_python(
# pip versions newer than 21.3.
if python_configuration.arch == "ARM64" and Version(get_pip_version(env)) < Version("21.3"):
call(
[
"python",
"-m",
"pip",
"install",
"--force-reinstall",
"--upgrade",
"pip",
*dependency_constraint_flags,
],
"python",
"-m",
"pip",
"install",
"--force-reinstall",
"--upgrade",
"pip",
*dependency_constraint_flags,
env=env,
cwd=CIBW_INSTALL_PATH,
cwd=venv_path,
)
# upgrade pip to the version matching our constraints
# if necessary, reinstall it to ensure that it's available on PATH as 'pip.exe'
call(
[
"python",
"-m",
"pip",
"install",
"--force-reinstall" if requires_reinstall else "--upgrade",
"pip",
*dependency_constraint_flags,
],
"python",
"-m",
"pip",
"install",
"--upgrade",
"pip",
*dependency_constraint_flags,
env=env,
cwd=CIBW_INSTALL_PATH,
cwd=venv_path,
)
# update env with results from CIBW_ENVIRONMENT
env = environment.as_dictionary(prev_environment=env)
# check what Python version we're on
call(["where", "python"], env=env)
call(["python", "--version"], env=env)
call(["python", "-c", "\"import struct; print(struct.calcsize('P') * 8)\""], env=env)
where_python = (
subprocess.run(
["where", "python"],
env=env,
universal_newlines=True,
check=True,
stdout=subprocess.PIPE,
)
.stdout.splitlines()[0]
.strip()
)
if where_python != str(installation_path / "python.exe"):
call("where", "python", env=env)
call("python", "--version", env=env)
call("python", "-c", "\"import struct; print(struct.calcsize('P') * 8)\"", env=env)
where_python = call("where", "python", env=env, capture_stdout=True).splitlines()[0].strip()
if where_python != str(venv_path / "Scripts" / "python.exe"):
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,
@@ -231,38 +192,35 @@ def setup_python(
sys.exit(1)
# check what pip version we're on
assert (installation_path / "Scripts" / "pip.exe").exists()
where_pip = (
subprocess.run(
["where", "pip"], env=env, universal_newlines=True, check=True, stdout=subprocess.PIPE
)
.stdout.splitlines()[0]
.strip()
)
if where_pip.strip() != str(installation_path / "Scripts" / "pip.exe"):
assert (venv_path / "Scripts" / "pip.exe").exists()
where_pip = call("where", "pip", env=env, capture_stdout=True).splitlines()[0].strip()
if where_pip.strip() != str(venv_path / "Scripts" / "pip.exe"):
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)
call(["pip", "--version"], env=env)
call("pip", "--version", env=env)
log.step("Installing build tools...")
if build_frontend == "pip":
call(
[
"pip",
"install",
"--upgrade",
"setuptools",
"wheel",
*dependency_constraint_flags,
],
"pip",
"install",
"--upgrade",
"setuptools",
"wheel",
*dependency_constraint_flags,
env=env,
)
elif build_frontend == "build":
call(
["pip", "install", "--upgrade", "build[virtualenv]", *dependency_constraint_flags],
"pip",
"install",
"--upgrade",
"build[virtualenv]",
*dependency_constraint_flags,
env=env,
)
else:
@@ -271,11 +229,7 @@ def setup_python(
return env
def build(options: Options) -> None:
temp_dir = Path(tempfile.mkdtemp(prefix="cibuildwheel"))
built_wheel_dir = temp_dir / "built_wheel"
repaired_wheel_dir = temp_dir / "repaired_wheel"
def build(options: Options, tmp_path: Path) -> None:
python_configurations = get_python_configurations(
options.globals.build_selector, options.globals.architectures
)
@@ -296,6 +250,11 @@ def build(options: Options) -> None:
build_options = options.build_options(config.identifier)
log.build_start(config.identifier)
identifier_tmp_dir = tmp_path / config.identifier
identifier_tmp_dir.mkdir()
built_wheel_dir = identifier_tmp_dir / "built_wheel"
repaired_wheel_dir = identifier_tmp_dir / "repaired_wheel"
dependency_constraint_flags: Sequence[PathOrStr] = []
if build_options.dependency_constraints:
dependency_constraint_flags = [
@@ -305,6 +264,7 @@ def build(options: Options) -> None:
# install Python
env = setup_python(
identifier_tmp_dir / "build",
config,
dependency_constraint_flags,
build_options.environment,
@@ -320,9 +280,7 @@ def build(options: Options) -> None:
shell(before_build_prepared, env=env)
log.step("Building wheel...")
if built_wheel_dir.exists():
shutil.rmtree(built_wheel_dir)
built_wheel_dir.mkdir(parents=True)
built_wheel_dir.mkdir()
verbosity_flags = get_build_verbosity_extra_flags(build_options.build_verbosity)
@@ -330,16 +288,14 @@ def build(options: Options) -> None:
# Path.resolve() is needed. Without it pip wheel may try to fetch package from pypi.org
# see https://github.com/pypa/cibuildwheel/pull/369
call(
[
"python",
"-m",
"pip",
"wheel",
options.globals.package_dir.resolve(),
f"--wheel-dir={built_wheel_dir}",
"--no-deps",
*get_build_verbosity_extra_flags(build_options.build_verbosity),
],
"python",
"-m",
"pip",
"wheel",
options.globals.package_dir.resolve(),
f"--wheel-dir={built_wheel_dir}",
"--no-deps",
*get_build_verbosity_extra_flags(build_options.build_verbosity),
env=env,
)
elif build_options.build_frontend == "build":
@@ -354,25 +310,21 @@ def build(options: Options) -> None:
# in uhi. After probably pip 21.2, we can use uri. For
# now, use a temporary file.
if " " in str(constraints_path):
tmp_file = tempfile.NamedTemporaryFile(
"w", suffix="constraints.txt", delete=False, dir=CIBW_INSTALL_PATH
)
with tmp_file as new_constraints_file, open(constraints_path) as f:
new_constraints_file.write(f.read())
constraints_path = Path(new_constraints_file.name)
assert " " not in str(identifier_tmp_dir)
tmp_file = identifier_tmp_dir / "constraints.txt"
tmp_file.write_bytes(constraints_path.read_bytes())
constraints_path = tmp_file
build_env["PIP_CONSTRAINT"] = str(constraints_path)
build_env["VIRTUALENV_PIP"] = get_pip_version(env)
call(
[
"python",
"-m",
"build",
build_options.package_dir,
"--wheel",
f"--outdir={built_wheel_dir}",
f"--config-setting={config_setting}",
],
"python",
"-m",
"build",
build_options.package_dir,
"--wheel",
f"--outdir={built_wheel_dir}",
f"--config-setting={config_setting}",
env=build_env,
)
else:
@@ -381,9 +333,7 @@ def build(options: Options) -> None:
built_wheel = next(built_wheel_dir.glob("*.whl"))
# repair the wheel
if repaired_wheel_dir.exists():
shutil.rmtree(repaired_wheel_dir)
repaired_wheel_dir.mkdir(parents=True)
repaired_wheel_dir.mkdir()
if built_wheel.name.endswith("none-any.whl"):
raise NonPlatformWheelError()
@@ -403,12 +353,12 @@ def build(options: Options) -> None:
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.
call(["pip", "install", "virtualenv", *dependency_constraint_flags], env=env)
venv_dir = Path(tempfile.mkdtemp())
call("pip", "install", "virtualenv", *dependency_constraint_flags, env=env)
venv_dir = identifier_tmp_dir / "venv-test"
# Use --no-download to ensure determinism by using seed libraries
# built into virtualenv
call(["python", "-m", "virtualenv", "--no-download", venv_dir], env=env)
call("python", "-m", "virtualenv", "--no-download", venv_dir, env=env)
virtualenv_env = env.copy()
virtualenv_env["PATH"] = os.pathsep.join(
@@ -419,7 +369,7 @@ def build(options: Options) -> None:
)
# check that we are using the Python from the virtual environment
call(["where", "python"], env=virtualenv_env)
call("where", "python", env=virtualenv_env)
if build_options.before_test:
before_test_prepared = prepare_command(
@@ -431,13 +381,15 @@ def build(options: Options) -> None:
# install the wheel
call(
["pip", "install", str(repaired_wheel) + build_options.test_extras],
"pip",
"install",
str(repaired_wheel) + build_options.test_extras,
env=virtualenv_env,
)
# test the wheel
if build_options.test_requires:
call(["pip", "install"] + build_options.test_requires, env=virtualenv_env)
call("pip", "install", *build_options.test_requires, env=virtualenv_env)
# run the tests from c:\, with an absolute path in the command
# (this ensures that Python runs the tests against the installed wheel
@@ -449,13 +401,14 @@ def build(options: Options) -> None:
)
shell(test_command_prepared, cwd="c:\\", env=virtualenv_env)
# clean up
# (we ignore errors because occasionally Windows fails to unlink a file and we
# don't want to abort a build because of that)
shutil.rmtree(venv_dir, ignore_errors=True)
# we're all done here; move it to output (remove if already exists)
shutil.move(str(repaired_wheel), build_options.output_dir)
# clean up
# (we ignore errors because occasionally Windows fails to unlink a file and we
# don't want to abort a build because of that)
shutil.rmtree(identifier_tmp_dir, ignore_errors=True)
log.build_end()
except subprocess.CalledProcessError as error:
log.step_end_with_error(
+13
View File
@@ -2,6 +2,19 @@
title: Changelog
---
### 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_
+18
View File
@@ -7,6 +7,12 @@
# ci: [appveyor, github, azurepipelines, circleci, gitlab, travisci] (optional)
# notes: (text, optional)
- name: abess
gh: abess-team/abess
notes: A fast best-subset selection library. It uses cibuildwheel to build a large project with C++ extensions.
ci: [github]
os: [windows, apple, linux]
- name: Matplotlib
gh: matplotlib/matplotlib
notes: The venerable Matplotlib, a Python library with C++ portions
@@ -510,3 +516,15 @@
notes: A modern implementation of a PostgreSQL adapter for Python
ci: [github]
os: [windows, apple, linux]
- name: Arbor
gh: arbor-sim/arbor
ci: [github]
os: [apple, linux]
pypi: arbor
notes: >
Arbor is a multi-compartment neuron simulation library; compatible with
next-generation accelerators; best-practices applied to research software;
focused on community-driven development. Includes a
[small script](https://github.com/arbor-sim/arbor/blob/master/scripts/patchwheel.py)
patching `rpath` in bundled libraries.
+2 -2
View File
@@ -127,7 +127,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.3.1
uses: pypa/cibuildwheel@v2.4.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.
@@ -153,7 +153,7 @@ The second option, and the only one that supports other CI systems, is using a `
```bash
# requirements-cibw.txt
cibuildwheel==2.3.1
cibuildwheel==2.4.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:
+23 -35
View File
@@ -174,14 +174,13 @@ Default: `auto`
`auto` will auto-detect platform using environment variables, such as `TRAVIS_OS_NAME`/`APPVEYOR`/`CIRCLECI`.
- For `linux`, you need Docker running, on macOS or Linux.
- For `macos`, you need a Mac machine. Note that cibuildwheel is going to install MacPython on your system, so you probably don't want to run this on your development machine.
- For `windows`, you need to run in Windows. cibuildwheel will install required versions of Python to `C:\cibw\python` using NuGet.
- For `linux`, you need Docker 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.
!!! tip
If you have Docker installed, you can locally debug your cibuildwheel Linux config, instead of pushing to CI to test every change. For example:
You can use this option to locally debug your cibuildwheel config, instead of pushing to CI to test every change. For example:
```bash
export CIBW_BUILD='cp37-*'
@@ -189,6 +188,7 @@ This option can also be set using the [command-line option](#command-line) `--pl
cibuildwheel --platform linux .
```
This is even more convenient if you store your cibuildwheel config in [`pyproject.toml`](#configuration-file).
### `CIBW_BUILD`, `CIBW_SKIP` {: #build-skip}
@@ -211,6 +211,7 @@ When setting the options, you can use shell-style globbing syntax, as per [fnmat
| Python 3.10 | cp310-macosx_x86_64<br/>cp310-macosx_universal2<br/>cp310-macosx_arm64 | cp310-win_amd64<br/>cp310-win32<br/>cp310-win_arm64 | cp310-manylinux_x86_64<br/>cp310-manylinux_i686<br/>cp310-musllinux_x86_64<br/>cp310-musllinux_i686 | cp310-manylinux_aarch64<br/>cp310-manylinux_ppc64le<br/>cp310-manylinux_s390x<br/>cp310-musllinux_aarch64<br/>cp310-musllinux_ppc64le<br/>cp310-musllinux_s390x |
| PyPy3.7 v7.3 | pp37-macosx_x86_64 | pp37-win_amd64 | pp37-manylinux_x86_64<br/>pp37-manylinux_i686 | pp37-manylinux_aarch64 |
| PyPy3.8 v7.3 | pp38-macosx_x86_64 | pp38-win_amd64 | pp38-manylinux_x86_64<br/>pp38-manylinux_i686 | pp38-manylinux_aarch64 |
| PyPy3.9 v7.3 | pp39-macosx_x86_64 | pp39-win_amd64 | pp39-manylinux_x86_64<br/>pp39-manylinux_i686 | pp39-manylinux_aarch64 |
The list of supported and currently selected build identifiers can also be retrieved by passing the `--print-build-identifiers` flag to cibuildwheel.
The format is `python_tag-platform_tag`, with tags similar to those in [PEP 425](https://www.python.org/dev/peps/pep-0425/#details).
@@ -401,7 +402,7 @@ This option can also be set using the [command-line option](#command-line)
> Manually set the Python compatibility of your project
By default, cibuildwheel reads your package's Python compatibility from
`pyproject.toml` following [PEP621](https://www.python.org/dev/peps/pep-0621/)
`pyproject.toml` following the [project metadata specification](https://packaging.python.org/en/latest/specifications/declaring-project-metadata/)
or from `setup.cfg`; finally it will try to inspect the AST of `setup.py` for a
simple keyword assignment in a top level function call. If you need to override
this behaviour for some reason, you can use this option.
@@ -415,42 +416,29 @@ Default: reads your package's Python compatibility from `pyproject.toml`
`setup.py` `setup(python_requires="...")`. If not found, cibuildwheel assumes
the package is compatible with all versions of Python that it can build.
!!! note
Rather than using this option, it's recommended you set
`project.requires-python` in `pyproject.toml` instead:
Example `pyproject.toml`:
Rather than using this environment variable, it's recommended you set this value
statically in a way that your build backend can use it, too. This ensures
that your package's metadata is correct when published on PyPI. This
cibuildwheel-specific option is provided as an override, and therefore is only
available in environment variable form.
- If you have a `pyproject.toml` containing a `[project]` table, you can
specify `requires-python` there.
```toml
[project]
...
requires-python = ">=3.6"
```
# Aside - in pyproject.toml you should always specify minimal build
# system options, like this:
Note that not all build backends fully support using a `[project]` table yet;
specifically setuptools just added experimental support in version 61.
Adding `[project]` to `pyproject.toml` requires all the other supported
values to be specified there, or to be listed in `dynamic`.
[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"
Currently, setuptools has not yet added support for reading this value from
pyproject.toml yet, and so does not copy it to Requires-Python in the wheel
metadata. This mechanism is used by pip to scan through older versions of
your package until it finds a release compatible with the current version
of Python compatible when installing, so it is an important value to set if
you plan to drop support for a version of Python in the future.
If you don't want to list this value twice, you can also use the setuptools
specific location in `setup.cfg` and cibuildwheel will detect it from
there. Example `setup.cfg`:
[options]
python_requires = ">=3.6"
This option is not available in `pyproject.toml` under
`tool.cibuildwheel.project-requires-python`, since it should be set with the
[PEP621](https://www.python.org/dev/peps/pep-0621/) location instead,
`project.requires-python`.
- If you're using setuptools, [you can set this value in `setup.cfg` (preferred) or `setup.py`](https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#python-requirement)
and cibuildwheel will read it from there.
#### Examples
+88 -23
View File
@@ -5,31 +5,49 @@ title: 'Setup'
# Run cibuildwheel locally (optional) {: #local}
Before getting to CI setup, it can be convenient to test cibuildwheel
locally to quickly iterate and track down issues. If you've got
[Docker](https://www.docker.com/products/docker-desktop) installed on
your development machine, you can run a Linux build without even
touching CI.
!!! tip
You can run the Linux build on any platform. Even Windows can run
Linux containers these days, but there are a few hoops to jump
through. Check [this document](https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/quick-start-windows-10-linux)
for more info.
This is convenient as it's quicker to iterate, and because the builds are
happening in manylinux Docker containers, they're perfectly reproducible.
locally to quickly iterate and track down issues without even touching CI.
Install cibuildwheel and run a build like this:
```sh
pip install cibuildwheel
cibuildwheel --platform linux
```
!!! tab "Linux"
Or, using [pipx](https://github.com/pypa/pipx):
```sh
pipx run cibuildwheel --platform linux
```
Using [pipx](https://github.com/pypa/pipx):
```sh
pipx run cibuildwheel --platform linux
```
Or,
```sh
pip install cibuildwheel
cibuildwheel --platform linux
```
!!! tab "macOS"
Using [pipx](https://github.com/pypa/pipx):
```sh
pipx run cibuildwheel --platform macos
```
Or,
```sh
pip install cibuildwheel
cibuildwheel --platform macos
```
!!! tab "Windows"
Using [pipx](https://github.com/pypa/pipx):
```bat
pipx run cibuildwheel --platform windows
```
Or,
```bat
pip install cibuildwheel
cibuildwheel --platform windows
```
You should see the builds taking place. You can experiment with options using environment variables or pyproject.toml.
@@ -71,6 +89,53 @@ You should see the builds taking place. You can experiment with options using en
cibuildwheel --platform linux
```
## Linux builds
If you've got [Docker](https://www.docker.com/products/docker-desktop) installed on
your development machine, you can run a Linux build.
!!! tip
You can run the Linux build on any platform. Even Windows can run
Linux containers these days, but there are a few hoops to jump
through. Check [this document](https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/quick-start-windows-10-linux)
for more info.
Because the builds are happening in manylinux Docker containers,
they're perfectly reproducible.
The only side effect to your system will be docker images being pulled.
## macOS / Windows builds
Pre-requisite: you need to have native build tools installed.
Because the builds are happening without full isolation, there might be some
differences compared to CI builds (Xcode version, Visual Studio version,
OS version, local files, ...) that might prevent you from finding an issue only
seen in CI.
In order to speed-up builds, cibuildwheel will cache the tools it needs to be
reused for future builds. The folder used for caching is system/user dependent and is
reported in the printed preamble of each run (e.g. "Cache folder: /Users/Matt/Library/Caches/cibuildwheel").
You can override the cache folder using the ``CIBW_CACHE_PATH`` environment variable.
!!! warning
cibuildwheel uses official python.org macOS installers for CPython but
those can only be installed globally.
In order not to mess with your system, cibuildwheel won't install those if they are
missing. Instead, it will error out with a message to let you install the missing
CPython:
```console
Error: CPython 3.6 is not installed.
cibuildwheel will not perform system-wide installs when running outside of CI.
To build locally, install CPython 3.6 on this machine, or, disable this version of Python using CIBW_SKIP=cp36-macosx_*
Download link: https://www.python.org/ftp/python/3.6.8/python-3.6.8-macosx10.9.pkg
```
# Configure a CI service
@@ -118,7 +183,7 @@ To build Linux, Mac, and Windows wheels using GitHub Actions, create a `.github/
- uses: actions/checkout@v2
- name: Build wheels
run: pipx run cibuildwheel==2.3.1
run: pipx run cibuildwheel==2.4.0
- uses: actions/upload-artifact@v2
with:
@@ -153,7 +218,7 @@ To build Linux, Mac, and Windows wheels using GitHub Actions, create a `.github/
- uses: actions/setup-python@v2
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.3.1
run: python -m pip install cibuildwheel==2.4.0
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
+126 -120
View File
@@ -16,59 +16,60 @@ title: Working examples
| [pydantic][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Data parsing and validation using Python type hints |
| [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 |
| [vaex][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Out-of-Core hybrid Apache Arrow/NumPy DataFrame for Python, ML, visualize and explore big tabular data at a billion rows per second 🚀 |
| [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 |
| [asyncpg][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | A fast PostgreSQL Database Client Library for Python/asyncio. |
| [Apache Beam][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Apache Beam is a unified programming model for Batch and Streaming |
| [asyncpg][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | A fast PostgreSQL Database Client Library for Python/asyncio. |
| [scikit-image][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Image processing library. Uses cibuildwheel to build and test a project that uses Cython with platform-native code. |
| [twisted-iocpsupport][] | ![github icon][] | ![windows icon][] | A submodule of Twisted that hooks into native C APIs using Cython. |
| [cmake][] | ![github icon][] ![travisci icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Multitagged binary builds for all supported platforms, using cibw 2 config configuration. |
| [duckdb][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | DuckDB is an in-process SQL OLAP Database Management System |
| [twisted-iocpsupport][] | ![github icon][] | ![windows icon][] | A submodule of Twisted that hooks into native C APIs using Cython. |
| [websockets][] | ![travisci icon][] | ![apple icon][] ![linux icon][] | Library for building WebSocket servers and clients. Mostly written in Python, with a small C 'speedups' extension module. |
| [cvxpy][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | A Python-embedded modeling language for convex optimization problems. |
| [Triton][] | ![github icon][] | ![linux icon][] | Self hosted runners |
| [PyOxidizer][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | A modern Python application packaging and distribution tool |
| [Triton][] | ![github icon][] | ![linux icon][] | Self hosted runners |
| [River][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | 🌊 Online machine learning in Python |
| [OpenSpiel][] | ![github icon][] | ![apple icon][] ![linux icon][] | OpenSpiel is a collection of environments and algorithms for research in general reinforcement learning and search/planning in games. |
| [pyzmq][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Python bindings for zeromq, the networking library. Uses Cython and CFFI. |
| [River][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | 🌊 Online machine learning in Python |
| [vispy][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Main repository for Vispy |
| [aiortc][] | ![github icon][] | ![apple icon][] ![linux icon][] | WebRTC and ORTC implementation for Python using asyncio. |
| [vispy][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Main repository for Vispy |
| [Confluent client for Kafka][] | ![travisci icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | setup in `tools/wheels/build-wheels.bat` |
| [tinyobjloader][] | ![azurepipelines icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Tiny but powerful single file wavefront obj loader |
| [Dependency Injector][] | ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Dependency injection framework for Python, uses Windows TravisCI |
| [coverage.py][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | The coverage tool for Python |
| [PyCryptodome][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | A self-contained cryptographic library for Python |
| [Dependency Injector][] | ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Dependency injection framework for Python, uses Windows TravisCI |
| [numexpr][] | ![github icon][] ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Fast numerical array expression evaluator for Python, NumPy, PyTables, pandas, bcolz and more |
| [PyYAML][] | ![github icon][] | ![apple icon][] | Canonical source repository for PyYAML |
| [numexpr][] | ![github icon][] ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Fast numerical array expression evaluator for Python, NumPy, PyTables, pandas, bcolz and more |
| [h5py][] | ![azurepipelines icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | HDF5 for Python -- The h5py package is a Pythonic interface to the HDF5 binary data format. |
| [PyAV][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Pythonic bindings for FFmpeg's libraries. |
| [OpenColorIO][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | A color management framework for visual effects and animation. |
| [PyTables][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A Python package to manage extremely large amounts of data |
| [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. |
| [ruptures][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Extensive Cython + NumPy [pyproject.toml](https://github.com/deepcharles/ruptures/blob/master/pyproject.toml) example. |
| [pikepdf][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A Python library for reading and writing PDF, powered by qpdf |
| [ruptures][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Extensive Cython + NumPy [pyproject.toml](https://github.com/deepcharles/ruptures/blob/master/pyproject.toml) example. |
| [aioquic][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | QUIC and HTTP/3 implementation in Python |
| [google neuroglancer][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | WebGL-based viewer for volumetric data |
| [DeepForest][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | An Efficient, Scalable and Optimized Python Framework for Deep Forest (2021.2.1) |
| [google neuroglancer][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | WebGL-based viewer for volumetric data |
| [Psycopg 3][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A modern implementation of a PostgreSQL adapter for Python |
| [Parselmouth][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A Python interface to the Praat software package, using pybind11, C++17 and CMake, with the core Praat static library built only once and shared between wheels. |
| [AutoPy][] | ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Includes a Windows Travis build. |
| [Psycopg 3][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A modern implementation of a PostgreSQL adapter for Python |
| [H3-py][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Python bindings for H3, a hierarchical hexagonal geospatial indexing system |
| [markupsafe][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Safely add untrusted strings to HTML/XML markup. |
| [python-rapidjson][] | ![travisci icon][] ![gitlab icon][] ![appveyor icon][] | ![windows icon][] ![linux icon][] | Python wrapper around rapidjson |
| [Rtree][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Rtree: spatial index for Python GIS ¶ |
| [python-rapidjson][] | ![travisci icon][] ![gitlab icon][] ![appveyor icon][] | ![windows icon][] ![linux icon][] | Python wrapper around rapidjson |
| [python-snappy][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Python bindings for the snappy google library |
| [pybind11 cmake_example][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Example pybind11 module built with a CMake-based build system |
| [KDEpy][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Kernel Density Estimation in Python |
| [tgcalls][] | ![github icon][] | ![apple icon][] ![windows icon][] | Python `pybind11` binding to Telegram's WebRTC library with third party dependencies like `OpenSSL`, `MozJPEG`, `FFmpeg`, etc. |
| [dd-trace-py][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Uses custom alternate arch emulation on GitHub |
| [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 |
| [cyvcf2][] | ![github icon][] | ![apple icon][] ![linux icon][] | cython + htslib == fast VCF and BCF processing |
| [sourmash][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Quickly search, compare, and analyze genomic and metagenomic data sets. |
| [time-machine][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Time mocking library using only the CPython C API. |
| [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. |
| [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. |
| [matrixprofile][] | ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | A Python 3 library making time series data mining tasks, utilizing matrix profile algorithms, accessible to everyone. |
| [CTranslate2][] | ![github icon][] | ![apple icon][] ![linux icon][] | Includes libraries from the [Intel oneAPI toolkit](https://software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit.html). The Linux wheels also include CUDA libraries for GPU execution. |
| [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 |
@@ -78,20 +79,21 @@ title: Working examples
| [iDynTree][] | ![github icon][] | ![linux icon][] | Uses manylinux_2_24 |
| [TgCrypto][] | ![travisci icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Includes a Windows Travis build. |
| [pybase64][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | Fast Base64 encoding/decoding in Python |
| [Arbor][] | ![github icon][] | ![apple icon][] ![linux icon][] | Arbor is a multi-compartment neuron simulation library; compatible with next-generation accelerators; best-practices applied to research software; focused on community-driven development. Includes a [small script](https://github.com/arbor-sim/arbor/blob/master/scripts/patchwheel.py) patching `rpath` in bundled libraries. |
| [etebase-py][] | ![travisci icon][] | ![linux icon][] | Python bindings to a Rust library using `setuptools-rust`, and `sccache` for improved speed. |
| [fathon][] | ![travisci icon][] | ![apple icon][] ![linux icon][] | python package for DFA (Detrended Fluctuation Analysis) and related algorithms |
| [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. |
| [numpythia][] | ![github icon][] | ![apple icon][] ![linux icon][] | The interface between PYTHIA and NumPy |
| [pyjet][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | The interface between FastJet and NumPy |
| [polaroid][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Full range of wheels for setuptools rust, with auto release and PyPI deploy. |
| [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. |
| [clang-format][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Scikit-build wrapper around LLVM's CMake, all platforms, generic wheels. |
| [ninja][] | ![github icon][] ![travisci icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Multitagged binary builds for all supported platforms, using cibw 2 config configuration. |
| [pybind11 scikit_build_example][] | ![github icon][] | ![windows icon][] ![apple icon][] ![linux icon][] | An example combining scikit-build and pybind11 |
| [GSD][] | ![github icon][] | ![apple icon][] ![linux icon][] ![windows icon][] | Cython and NumPy project with 64-bit wheels. |
| [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. |
| [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. |
| [CorrectionLib][] | ![github icon][] | ![apple icon][] ![linux icon][] | Structured JSON powered correction library for HEP, designed for the CMS experiment at CERN. |
| [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. |
| [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
@@ -104,57 +106,58 @@ title: Working examples
[psutil]: https://github.com/giampaolo/psutil
[vaex]: https://github.com/vaexio/vaex
[Google Benchmark]: https://github.com/google/benchmark
[asyncpg]: https://github.com/MagicStack/asyncpg
[Apache Beam]: https://github.com/apache/beam
[asyncpg]: https://github.com/MagicStack/asyncpg
[scikit-image]: https://github.com/scikit-image/scikit-image
[twisted-iocpsupport]: https://github.com/twisted/twisted-iocpsupport
[cmake]: https://github.com/scikit-build/cmake-python-distributions
[duckdb]: https://github.com/duckdb/duckdb
[twisted-iocpsupport]: https://github.com/twisted/twisted-iocpsupport
[websockets]: https://github.com/aaugustin/websockets
[cvxpy]: https://github.com/cvxpy/cvxpy
[Triton]: https://github.com/openai/triton
[PyOxidizer]: https://github.com/indygreg/PyOxidizer
[Triton]: https://github.com/openai/triton
[River]: https://github.com/online-ml/river
[OpenSpiel]: https://github.com/deepmind/open_spiel
[pyzmq]: https://github.com/zeromq/pyzmq
[River]: https://github.com/online-ml/river
[vispy]: https://github.com/vispy/vispy
[aiortc]: https://github.com/aiortc/aiortc
[vispy]: https://github.com/vispy/vispy
[Confluent client for Kafka]: https://github.com/confluentinc/confluent-kafka-python
[tinyobjloader]: https://github.com/tinyobjloader/tinyobjloader
[Dependency Injector]: https://github.com/ets-labs/python-dependency-injector
[coverage.py]: https://github.com/nedbat/coveragepy
[PyCryptodome]: https://github.com/Legrandin/pycryptodome
[Dependency Injector]: https://github.com/ets-labs/python-dependency-injector
[numexpr]: https://github.com/pydata/numexpr
[PyYAML]: https://github.com/yaml/pyyaml
[numexpr]: https://github.com/pydata/numexpr
[h5py]: https://github.com/h5py/h5py
[PyAV]: https://github.com/PyAV-Org/PyAV
[OpenColorIO]: https://github.com/AcademySoftwareFoundation/OpenColorIO
[PyTables]: https://github.com/PyTables/PyTables
[Line Profiler]: https://github.com/pyutils/line_profiler
[PyTables]: https://github.com/PyTables/PyTables
[OpenTimelineIO]: https://github.com/PixarAnimationStudios/OpenTimelineIO
[ruptures]: https://github.com/deepcharles/ruptures
[pikepdf]: https://github.com/pikepdf/pikepdf
[ruptures]: https://github.com/deepcharles/ruptures
[aioquic]: https://github.com/aiortc/aioquic
[google neuroglancer]: https://github.com/google/neuroglancer
[DeepForest]: https://github.com/LAMDA-NJU/Deep-Forest
[google neuroglancer]: https://github.com/google/neuroglancer
[Psycopg 3]: https://github.com/psycopg/psycopg
[Parselmouth]: https://github.com/YannickJadoul/Parselmouth
[AutoPy]: https://github.com/autopilot-rs/autopy
[Psycopg 3]: https://github.com/psycopg/psycopg
[H3-py]: https://github.com/uber/h3-py
[markupsafe]: https://github.com/pallets/markupsafe
[python-rapidjson]: https://github.com/python-rapidjson/python-rapidjson
[Rtree]: https://github.com/Toblerity/rtree
[python-rapidjson]: https://github.com/python-rapidjson/python-rapidjson
[python-snappy]: https://github.com/andrix/python-snappy
[pybind11 cmake_example]: https://github.com/pybind/cmake_example
[KDEpy]: https://github.com/tommyod/KDEpy
[tgcalls]: https://github.com/MarshalX/tgcalls
[dd-trace-py]: https://github.com/DataDog/dd-trace-py
[pybind11 python_example]: https://github.com/pybind/python_example
[dd-trace-py]: https://github.com/DataDog/dd-trace-py
[cyvcf2]: https://github.com/brentp/cyvcf2
[sourmash]: https://github.com/dib-lab/sourmash
[time-machine]: https://github.com/adamchainz/time-machine
[matrixprofile]: https://github.com/matrix-profile-foundation/matrixprofile
[abess]: https://github.com/abess-team/abess
[CTranslate2]: https://github.com/OpenNMT/CTranslate2
[matrixprofile]: https://github.com/matrix-profile-foundation/matrixprofile
[jq.py]: https://github.com/mwilliamson/jq.py
[iminuit]: https://github.com/scikit-hep/iminuit
[Tokenizer]: https://github.com/OpenNMT/Tokenizer
@@ -164,20 +167,21 @@ title: Working examples
[iDynTree]: https://github.com/robotology/idyntree
[TgCrypto]: https://github.com/pyrogram/tgcrypto
[pybase64]: https://github.com/mayeut/pybase64
[Arbor]: https://github.com/arbor-sim/arbor
[etebase-py]: https://github.com/etesync/etebase-py
[fathon]: https://github.com/stfbnc/fathon
[Imagecodecs (fork)]: https://github.com/czaki/imagecodecs_build
[polaroid]: https://github.com/daggy1234/polaroid
[numpythia]: https://github.com/scikit-hep/numpythia
[pyjet]: https://github.com/scikit-hep/pyjet
[polaroid]: https://github.com/daggy1234/polaroid
[Imagecodecs (fork)]: https://github.com/czaki/imagecodecs_build
[clang-format]: https://github.com/ssciwr/clang-format-wheel
[ninja]: https://github.com/scikit-build/ninja-python-distributions
[pybind11 scikit_build_example]: https://github.com/pybind/scikit_build_example
[GSD]: https://github.com/glotzerlab/gsd
[pillow-heif]: https://github.com/bigcat88/pillow_heif
[pyinstrument_cext]: https://github.com/joerick/pyinstrument_cext
[xmlstarlet]: https://github.com/dimitern/xmlstarlet
[CorrectionLib]: https://github.com/cms-nanoAOD/correctionlib
[pillow-heif]: https://github.com/bigcat88/pillow_heif
[SiPM]: https://github.com/EdoPro98/SimSiPM
[appveyor icon]: data/readme_icons/appveyor.svg
@@ -190,91 +194,93 @@ title: Working examples
[apple icon]: data/readme_icons/apple.svg
[linux icon]: data/readme_icons/linux.svg
<!-- scikit-learn: 48265, last pushed 0 days ago -->
<!-- Tornado: 20306, last pushed 4 days ago -->
<!-- pytorch-fairseq: 14811, last pushed 2 days ago -->
<!-- Matplotlib: 14705, last pushed 0 days ago -->
<!-- MyPy: 11966, last pushed 0 days ago -->
<!-- pydantic: 8289, last pushed 0 days ago -->
<!-- uvloop: 8233, last pushed 3 days ago -->
<!-- psutil: 7929, last pushed 5 days ago -->
<!-- vaex: 6784, last pushed 0 days ago -->
<!-- Google Benchmark: 5975, last pushed 0 days ago -->
<!-- asyncpg: 5208, last pushed 4 days ago -->
<!-- Apache Beam: 5141, last pushed 0 days ago -->
<!-- scikit-image: 4682, last pushed 0 days ago -->
<!-- twisted-iocpsupport: 4437, last pushed 6 days ago -->
<!-- cmake: 4340, last pushed 0 days ago -->
<!-- duckdb: 3989, last pushed 0 days ago -->
<!-- websockets: 3712, last pushed 22 days ago -->
<!-- cvxpy: 3634, last pushed 0 days ago -->
<!-- Triton: 3402, last pushed 2 days ago -->
<!-- PyOxidizer: 3377, last pushed 1 days ago -->
<!-- OpenSpiel: 2978, last pushed 3 days ago -->
<!-- pyzmq: 2968, last pushed 4 days ago -->
<!-- River: 2967, last pushed 1 days ago -->
<!-- vispy: 2769, last pushed 2 days ago -->
<!-- aiortc: 2696, last pushed 10 days ago -->
<!-- Confluent client for Kafka: 2572, last pushed 2 days ago -->
<!-- tinyobjloader: 2362, last pushed 7 days ago -->
<!-- coverage.py: 1851, last pushed 0 days ago -->
<!-- PyCryptodome: 1812, last pushed 9 days ago -->
<!-- Dependency Injector: 1758, last pushed 14 days ago -->
<!-- numexpr: 1691, last pushed 1 days ago -->
<!-- PyYAML: 1678, last pushed 10 days ago -->
<!-- h5py: 1641, last pushed 1 days ago -->
<!-- PyAV: 1406, last pushed 3 days ago -->
<!-- OpenColorIO: 1201, last pushed 0 days ago -->
<!-- PyTables: 1080, last pushed 0 days ago -->
<!-- Line Profiler: 983, last pushed 10 days ago -->
<!-- OpenTimelineIO: 946, last pushed 0 days ago -->
<!-- ruptures: 869, last pushed 3 days ago -->
<!-- pikepdf: 827, last pushed 1 days ago -->
<!-- aioquic: 790, last pushed 6 days ago -->
<!-- google neuroglancer: 704, last pushed 9 days ago -->
<!-- DeepForest: 686, last pushed 142 days ago -->
<!-- Parselmouth: 596, last pushed 12 days ago -->
<!-- AutoPy: 596, last pushed 178 days ago -->
<!-- Psycopg 3: 544, last pushed 3 days ago -->
<!-- H3-py: 457, last pushed 40 days ago -->
<!-- markupsafe: 437, last pushed 6 days ago -->
<!-- python-rapidjson: 433, last pushed 57 days ago -->
<!-- Rtree: 432, last pushed 67 days ago -->
<!-- python-snappy: 413, last pushed 4 days ago -->
<!-- pybind11 cmake_example: 336, last pushed 14 days ago -->
<!-- KDEpy: 315, last pushed 192 days ago -->
<!-- tgcalls: 293, last pushed 83 days ago -->
<!-- dd-trace-py: 286, last pushed 0 days ago -->
<!-- pybind11 python_example: 285, last pushed 14 days ago -->
<!-- cyvcf2: 279, last pushed 4 days ago -->
<!-- sourmash: 267, last pushed 9 days ago -->
<!-- time-machine: 236, last pushed 5 days ago -->
<!-- matrixprofile: 217, last pushed 170 days ago -->
<!-- CTranslate2: 213, last pushed 0 days ago -->
<!-- jq.py: 189, last pushed 132 days ago -->
<!-- iminuit: 189, last pushed 29 days ago -->
<!-- Tokenizer: 161, last pushed 4 days ago -->
<!-- PyGLM: 124, last pushed 7 days ago -->
<!-- bx-python: 108, last pushed 1 days ago -->
<!-- boost-histogram: 101, last pushed 6 days ago -->
<!-- iDynTree: 92, last pushed 6 days ago -->
<!-- TgCrypto: 80, last pushed 62 days ago -->
<!-- pybase64: 76, last pushed 6 days ago -->
<!-- etebase-py: 53, last pushed 342 days ago -->
<!-- fathon: 41, last pushed 25 days ago -->
<!-- numpythia: 32, last pushed 13 days ago -->
<!-- pyjet: 31, last pushed 14 days ago -->
<!-- polaroid: 27, last pushed 1 days ago -->
<!-- Imagecodecs (fork): 26, last pushed 23 days ago -->
<!-- clang-format: 22, last pushed 59 days ago -->
<!-- ninja: 20, last pushed 0 days ago -->
<!-- pybind11 scikit_build_example: 19, last pushed 14 days ago -->
<!-- GSD: 18, last pushed 25 days ago -->
<!-- pyinstrument_cext: 10, last pushed 65 days ago -->
<!-- xmlstarlet: 7, last pushed 34 days ago -->
<!-- CorrectionLib: 7, last pushed 2 days ago -->
<!-- pillow-heif: 7, last pushed 1 days ago -->
<!-- SiPM: 4, last pushed 35 days ago -->
<!-- scikit-learn: 49555, last pushed 0 days ago -->
<!-- Tornado: 20477, last pushed 1 days ago -->
<!-- pytorch-fairseq: 16526, last pushed 2 days ago -->
<!-- Matplotlib: 15257, last pushed 0 days ago -->
<!-- MyPy: 12783, last pushed 0 days ago -->
<!-- pydantic: 9538, last pushed 3 days ago -->
<!-- uvloop: 8496, last pushed 85 days ago -->
<!-- psutil: 8240, last pushed 3 days ago -->
<!-- vaex: 6968, last pushed 0 days ago -->
<!-- Google Benchmark: 6312, last pushed 0 days ago -->
<!-- Apache Beam: 5409, last pushed 0 days ago -->
<!-- asyncpg: 5394, last pushed 4 days ago -->
<!-- scikit-image: 4842, last pushed 0 days ago -->
<!-- cmake: 4616, last pushed 0 days ago -->
<!-- duckdb: 4607, last pushed 0 days ago -->
<!-- twisted-iocpsupport: 4550, last pushed 0 days ago -->
<!-- websockets: 3862, last pushed 0 days ago -->
<!-- cvxpy: 3840, last pushed 5 days ago -->
<!-- PyOxidizer: 3571, last pushed 0 days ago -->
<!-- Triton: 3552, last pushed 0 days ago -->
<!-- River: 3261, last pushed 0 days ago -->
<!-- OpenSpiel: 3129, last pushed 3 days ago -->
<!-- pyzmq: 3057, last pushed 3 days ago -->
<!-- aiortc: 2857, last pushed 2 days ago -->
<!-- vispy: 2836, last pushed 0 days ago -->
<!-- Confluent client for Kafka: 2699, last pushed 0 days ago -->
<!-- tinyobjloader: 2460, last pushed 95 days ago -->
<!-- Dependency Injector: 1986, last pushed 2 days ago -->
<!-- coverage.py: 1972, last pushed 3 days ago -->
<!-- PyCryptodome: 1961, last pushed 2 days ago -->
<!-- PyYAML: 1785, last pushed 9 days ago -->
<!-- numexpr: 1741, last pushed 2 days ago -->
<!-- h5py: 1703, last pushed 0 days ago -->
<!-- PyAV: 1503, last pushed 0 days ago -->
<!-- OpenColorIO: 1275, last pushed 0 days ago -->
<!-- Line Profiler: 1140, last pushed 0 days ago -->
<!-- PyTables: 1113, last pushed 6 days ago -->
<!-- OpenTimelineIO: 1023, last pushed 0 days ago -->
<!-- pikepdf: 982, last pushed 2 days ago -->
<!-- ruptures: 930, last pushed 3 days ago -->
<!-- aioquic: 893, last pushed 2 days ago -->
<!-- DeepForest: 737, last pushed 252 days ago -->
<!-- google neuroglancer: 725, last pushed 3 days ago -->
<!-- Psycopg 3: 638, last pushed 0 days ago -->
<!-- Parselmouth: 634, last pushed 0 days ago -->
<!-- AutoPy: 629, last pushed 97 days ago -->
<!-- H3-py: 498, last pushed 2 days ago -->
<!-- markupsafe: 459, last pushed 17 days ago -->
<!-- Rtree: 456, last pushed 1 days ago -->
<!-- python-rapidjson: 447, last pushed 23 days ago -->
<!-- python-snappy: 426, last pushed 15 days ago -->
<!-- pybind11 cmake_example: 380, last pushed 2 days ago -->
<!-- KDEpy: 356, last pushed 50 days ago -->
<!-- tgcalls: 346, last pushed 83 days ago -->
<!-- pybind11 python_example: 312, last pushed 81 days ago -->
<!-- dd-trace-py: 300, last pushed 0 days ago -->
<!-- cyvcf2: 294, last pushed 17 days ago -->
<!-- sourmash: 281, last pushed 0 days ago -->
<!-- time-machine: 274, last pushed 3 days ago -->
<!-- abess: 258, last pushed 6 days ago -->
<!-- CTranslate2: 254, last pushed 0 days ago -->
<!-- matrixprofile: 250, last pushed 279 days ago -->
<!-- jq.py: 206, last pushed 54 days ago -->
<!-- iminuit: 197, last pushed 2 days ago -->
<!-- Tokenizer: 169, last pushed 25 days ago -->
<!-- PyGLM: 133, last pushed 3 days ago -->
<!-- bx-python: 113, last pushed 86 days ago -->
<!-- boost-histogram: 107, last pushed 1 days ago -->
<!-- iDynTree: 98, last pushed 4 days ago -->
<!-- TgCrypto: 94, last pushed 28 days ago -->
<!-- pybase64: 82, last pushed 2 days ago -->
<!-- Arbor: 70, last pushed 0 days ago -->
<!-- etebase-py: 56, last pushed 95 days ago -->
<!-- fathon: 43, last pushed 134 days ago -->
<!-- Imagecodecs (fork): 41, last pushed 32 days ago -->
<!-- polaroid: 35, last pushed 110 days ago -->
<!-- numpythia: 33, last pushed 34 days ago -->
<!-- pyjet: 32, last pushed 34 days ago -->
<!-- clang-format: 32, last pushed 38 days ago -->
<!-- ninja: 23, last pushed 10 days ago -->
<!-- pybind11 scikit_build_example: 21, last pushed 51 days ago -->
<!-- GSD: 19, last pushed 87 days ago -->
<!-- pillow-heif: 16, last pushed 0 days ago -->
<!-- pyinstrument_cext: 10, last pushed 175 days ago -->
<!-- xmlstarlet: 8, last pushed 11 days ago -->
<!-- CorrectionLib: 8, last pushed 0 days ago -->
<!-- SiPM: 5, last pushed 1 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.3.1
install: python -m pip install cibuildwheel==2.4.0
build_script: python -m cibuildwheel --output-dir wheelhouse
+4 -4
View File
@@ -6,7 +6,7 @@ jobs:
- bash: |
set -o errexit
python3 -m pip install --upgrade pip
pip3 install cibuildwheel==2.3.1
pip3 install cibuildwheel==2.4.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.3.1
python3 -m pip install cibuildwheel==2.4.0
displayName: Install dependencies
- bash: cibuildwheel --output-dir wheelhouse .
displayName: Build wheels
@@ -28,13 +28,13 @@ jobs:
inputs: {pathtoPublish: wheelhouse}
- job: windows
pool: {vmImage: 'vs2017-win2016'}
pool: {vmImage: 'windows-2019'}
steps:
- task: UsePythonVersion@0
- bash: |
set -o errexit
python -m pip install --upgrade pip
pip install cibuildwheel==2.3.1
pip install cibuildwheel==2.4.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.3.1
pip3 install --user cibuildwheel==2.4.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.3.1
pip3 install cibuildwheel==2.4.0
cibuildwheel --output-dir wheelhouse
- store_artifacts:
path: wheelhouse/
+1 -1
View File
@@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v2
- name: Build wheels
uses: pypa/cibuildwheel@v2.3.1
uses: pypa/cibuildwheel@v2.4.0
env:
CIBW_ARCHS_MACOS: x86_64 universal2
+2 -2
View File
@@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v2
- name: Build wheels
uses: pypa/cibuildwheel@v2.3.1
uses: pypa/cibuildwheel@v2.4.0
- uses: actions/upload-artifact@v2
with:
@@ -45,7 +45,7 @@ jobs:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
steps:
+1 -1
View File
@@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- name: Build wheels
uses: pypa/cibuildwheel@v2.3.1
uses: pypa/cibuildwheel@v2.4.0
# to supply options, put them in 'env', like:
# env:
# CIBW_SOME_OPTION: value
+1 -1
View File
@@ -25,7 +25,7 @@ jobs:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v2.3.1
uses: pypa/cibuildwheel@v2.4.0
env:
# configure cibuildwheel to build native archs ('auto'), and some
# emulated ones
+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.3.1
- python -m pip install cibuildwheel==2.4.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.3.1
- python3 -m pip install cibuildwheel==2.4.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.3.1
- python3 -m pip install cibuildwheel==2.4.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.3.1 twine
install: python3 -m pip install cibuildwheel==2.4.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.3.1 twine
install: python3 -m pip install cibuildwheel==2.4.0 twine
script: python3 -m cibuildwheel --output-dir wheelhouse
after_success: python3 -m twine upload --skip-existing wheelhouse/*.whl
+18 -3
View File
@@ -1,15 +1,19 @@
import os
import shutil
import sys
from pathlib import Path
import nox
nox.options.sessions = ["lint", "check_manifest", "tests"]
nox.options.sessions = ["lint", "pylint", "check_manifest", "tests"]
PYTHON_ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
PYTHON_ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
DIR = Path(__file__).parent.resolve()
if os.environ.get("CI", None):
nox.options.error_on_missing_interpreters = True
@nox.session
def tests(session: nox.Session) -> None:
@@ -34,6 +38,16 @@ def lint(session: nox.Session) -> None:
session.run("pre-commit", "run", "--all-files", *session.posargs)
@nox.session
def pylint(session: nox.Session) -> None:
"""
Run pylint.
"""
session.install("pylint", ".")
session.run("pylint", "cibuildwheel", *session.posargs)
@nox.session
def check_manifest(session: nox.Session) -> None:
"""
@@ -56,11 +70,12 @@ def update_constraints(session: nox.Session) -> None:
@nox.session
def update_pins(session: nox.Session) -> None:
"""
Update the python and docker pins version inplace.
Update the python, docker and virtualenv pins version inplace.
"""
session.install("-e", ".[bin]")
session.run("python", "bin/update_pythons.py", "--force")
session.run("python", "bin/update_docker.py")
session.run("python", "bin/update_virtualenv.py", "--force")
@nox.session
+45 -6
View File
@@ -1,7 +1,6 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"
@@ -9,21 +8,24 @@ build-backend = "setuptools.build_meta"
[tool.black]
line-length = 100
target-version = ['py36', 'py37', 'py38', 'py39']
target-version = ['py36', 'py37', 'py38', 'py39', 'py310']
[tool.isort]
profile = "black"
multi_line_output = 3
[tool.pytest.ini_options]
minversion = 6.0
minversion = "6.0"
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
junit_family = "xunit2"
testpaths = [
"test",
"unit_test",
]
xfail_strict = true
filterwarnings = ["error"]
log_cli_level = "info"
[tool.mypy]
@@ -36,6 +38,8 @@ files = [
"noxfile.py",
]
warn_unused_configs = true
show_error_codes = true
warn_redundant_casts = true
no_implicit_reexport = true
strict_equality = true
@@ -47,6 +51,9 @@ disallow_any_generics = true
warn_return_any = true
no_implicit_optional = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
warn_unreachable = true
[[tool.mypy.overrides]]
module = "cibuildwheel.*"
disallow_untyped_defs = true
@@ -64,8 +71,6 @@ module = [
]
ignore_missing_imports = true
[tool.pycln]
all = true
[tool.check-manifest]
ignore = [
@@ -81,3 +86,37 @@ ignore = [
"requirements-dev.txt",
"noxfile.py",
]
[tool.pylint]
master.py-version = "3.6"
master.jobs = "0"
master.fail-on = ["E", "F"]
master.fail-under = "9.8"
reports.output-format = "colorized"
messages_control.enable = [
"useless-suppression",
]
messages_control.disable = [
"abstract-class-instantiated", # filelock triggers this
"duplicate-code",
"fixme",
"invalid-name",
"line-too-long",
"missing-class-docstring",
"missing-function-docstring",
"missing-module-docstring",
"no-else-break",
"no-else-return",
"protected-access",
"too-few-public-methods",
"too-many-arguments",
"too-many-branches",
"too-many-instance-attributes",
"too-many-lines",
"too-many-locals",
"too-many-nested-blocks",
"too-many-return-statements",
"too-many-statements",
"unsubscriptable-object",
"wrong-import-position",
]
+3 -1
View File
@@ -1,6 +1,6 @@
[metadata]
name = cibuildwheel
version = 2.3.1
version = 2.4.0
description = Build Python wheels on CI with minimal configuration.
long_description = file: README.md
long_description_content_type = text/markdown
@@ -34,7 +34,9 @@ install_requires =
bashlex!=0.13
bracex
certifi
filelock
packaging
platformdirs
tomli
dataclasses;python_version < '3.7'
typing-extensions>=3.10.0.0;python_version < '3.8'
+2 -2
View File
@@ -4,6 +4,7 @@ extras = {
"docs": [
"mkdocs-include-markdown-plugin==2.8.0",
"mkdocs==1.0.4",
"jinja2==3.0.3",
"pymdown-extensions",
"mkdocs-macros-plugin",
],
@@ -11,7 +12,7 @@ extras = {
"jinja2",
"pytest>=6",
"pytest-timeout",
"pytest-xdist; sys_platform == 'linux'",
"pytest-xdist",
],
"bin": [
"click",
@@ -32,7 +33,6 @@ extras = {
"types-pyyaml",
"types-click",
"types-requests",
"types-toml",
],
}
+1 -1
View File
@@ -119,7 +119,7 @@ def test_dependency_constraints_file(tmp_path, build_frontend_env):
"pip": "20.0.2",
"setuptools": "53.0.0",
"wheel": "0.34.2",
"virtualenv": "20.0.35",
"virtualenv": "20.11.2",
}
constraints_file = tmp_path / "constraints file.txt"
+6
View File
@@ -71,6 +71,9 @@ def test(manylinux_image, tmp_path):
if manylinux_image in {"manylinux1"}:
# We don't have a manylinux1 image for PyPy & CPython 3.10 and above
add_env["CIBW_SKIP"] = "pp* cp31*"
if manylinux_image in {"manylinux2010"}:
# We don't have a manylinux2010 image for PyPy 3.9
add_env["CIBW_SKIP"] = "pp39*"
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env)
@@ -88,4 +91,7 @@ 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
expected_wheels = [w for w in expected_wheels if "-pp39" not in w]
assert set(actual_wheels) == set(expected_wheels)
+1 -1
View File
@@ -135,7 +135,7 @@ def expected_wheels(
python_abi_tags = ["cp36-cp36m", "cp37-cp37m", "cp38-cp38", "cp39-cp39", "cp310-cp310"]
if machine_arch in ["x86_64", "AMD64", "x86", "aarch64"]:
python_abi_tags += ["pp37-pypy37_pp73", "pp38-pypy38_pp73"]
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
+3 -2
View File
@@ -11,7 +11,7 @@ import pytest
from cibuildwheel import linux, util
from cibuildwheel.__main__ import main
ALL_IDS = {"cp36", "cp37", "cp38", "cp39", "cp310", "pp37", "pp38"}
ALL_IDS = {"cp36", "cp37", "cp38", "cp39", "cp310", "pp37", "pp38", "pp39"}
@pytest.fixture
@@ -133,7 +133,7 @@ before-all = "true"
identifiers = {x.identifier for x in kwargs["platform_configs"]}
assert identifiers == {
f"{x}-manylinux_x86_64" for x in ALL_IDS - {"cp36", "cp310", "pp37", "pp38"}
f"{x}-manylinux_x86_64" for x in ALL_IDS - {"cp36", "cp310", "pp37", "pp38", "pp39"}
}
assert kwargs["options"].build_options("cp37-manylinux_x86_64").before_all == ""
@@ -146,6 +146,7 @@ before-all = "true"
"cp310-manylinux_x86_64",
"pp37-manylinux_x86_64",
"pp38-manylinux_x86_64",
"pp39-manylinux_x86_64",
}
kwargs = build_on_docker.call_args_list[3][1]
+5 -2
View File
@@ -25,7 +25,7 @@ def test_read_setup_py_simple(tmp_path):
def test_read_setup_py_full(tmp_path):
with open(tmp_path / "setup.py", "w") as f:
with open(tmp_path / "setup.py", "w", encoding="utf8") as f:
f.write(
dedent(
"""
@@ -35,6 +35,7 @@ def test_read_setup_py_full(tmp_path):
setuptools.setup(
name = "hello",
description = "≥“”ü",
other = 23,
example = ["item", "other"],
python_requires = "1.24",
@@ -43,7 +44,9 @@ def test_read_setup_py_full(tmp_path):
)
)
assert setup_py_python_requires(tmp_path.joinpath("setup.py").read_text()) == "1.24"
assert (
setup_py_python_requires(tmp_path.joinpath("setup.py").read_text(encoding="utf8")) == "1.24"
)
assert get_requires_python_str(tmp_path) == "1.24"
+5 -5
View File
@@ -6,15 +6,15 @@ from cibuildwheel.util import print_new_wheels
def test_printout_wheels(tmp_path, capsys):
tmp_path.joinpath("example.0").touch()
with print_new_wheels("TEST_MSG: {n}", tmp_path):
tmp_path.joinpath("example.1").touch()
tmp_path.joinpath("example.2").touch()
tmp_path.joinpath("example.1").write_bytes(b"0" * 1023)
tmp_path.joinpath("example.2").write_bytes(b"0" * 1025)
captured = capsys.readouterr()
assert captured.err == ""
assert "example.0" not in captured.out
assert "example.1\n" in captured.out
assert "example.2\n" in captured.out
assert "example.1 1 kB\n" in captured.out
assert "example.2 2 kB\n" in captured.out
assert "TEST_MSG:" in captured.out
assert "TEST_MSG: 2\n" in captured.out
@@ -26,7 +26,7 @@ def test_no_printout_on_error(tmp_path, capsys):
tmp_path.joinpath("example.1").touch()
raise RuntimeError()
captured = capsys.readouterr()
captured = capsys.readouterr() # type: ignore[unreachable]
assert captured.err == ""
assert "example.0" not in captured.out