* Add the ability to declare safe tools in a cross-build environment.
* Add an xfail if cmake isn't available on the test machine.
* Placate linter regarding positional args.
* Rework test to provide more robust confirmation of safe tools.
* Remove a test skip condition that is no longer needed.
Co-authored-by: Joe Rickerby <joerick@mac.com>
* Rename the setting to xbuild-tools.
* Add docs to clarify that xbuild-tools is transitive.
* Raise a warning if xbuild-tools isn't defined.
* Correct a bad copy-paste in the schema generator.
* .. and now fix the indentation.
* Move sentinel handling earlier into the parsing process.
* Remove serialization from tests that won't start a test suite.
---------
Co-authored-by: Joe Rickerby <joerick@mac.com>
* feat: stricter selector parsing, refactor to `platforms` module
- Use a different method to build nothing
- Make the check aware of enable groups
* optimise unit tests - a specific platform module API for all configs
Unit test time: 26.2s -> 13.1s
* Remove unnecessary get_platform_module function
* drop EOL manylinux images
* chore: use multi-arch manylinux images as a source for image tag
Using multi-arch images directly messes with parallel tests for now.
Using them as a source for image tag ensures that all architecture specific tags are pointing to the same tag for a given manylinux / musllinux policy.
* Apply review suggestion
Co-authored-by: Joe Rickerby <joerick@mac.com>
---------
Co-authored-by: Joe Rickerby <joerick@mac.com>
* Write docs for inline dependency-versions
* Change the `inline` keyword to `packages` for better readability
* Implement inline package constraints
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add schema for TOML properties
* Change the parsing of the option to parse filenames as-is
* Add a unit test for table-parsing of the option
* Remove unneeded shlex.quote on the dependency-version test
* Tidy-ups, comments, docs fixes
* Add test for empty packages option value
* Fix empty packages scenario
And, remove some optionals to reduce the problem space
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* optimise unit tests - Cache loading the config TOML
Unit test time: 13.1s -> 10.5s
* optimise unit tests - use the same pyproject validator across the tests
Unit test time: 10.5s -> 5.7s
* optimise unit tests - selector optimisation
Unit test time: 5.7s -> 5.1s
* optimise unit tests - build options computation cache
Unit test time: 5.1s -> 3.2s
* Use functools.cache rather than functools.lru_cache
* Don't overwrite build_options when applying functools.cache
* feat: Print FatalError messages using Logger
This makes them appear GHA annotations in CI logs, which makes them easier to spot. I've also added the "cibuildwheel: " prefix to those errors, I think it helps when viewing a log to know which tool is talking to you - it can be difficult to understand with build tools.
* Nicer error message on invalid architecture
* Fix some message formatting and test expectations
* feat: add armv7l in auto_archs when running on aarch64
This depends on aarch32 EL0 support and thus is done conditionally.
* ci(travis): move to Ubuntu 22.04 / cp312
* Update dependencies
* ci(fix): use tonistiigi/binfmt:qemu-v8.1.5 image for qemu
* fix(test): implement retry for test_container_removed
The test is flaky on some platforms. Implement retry rather than just skip.
---------
Co-authored-by: cibuildwheel-bot[bot] <83877280+cibuildwheel-bot[bot]@users.noreply.github.com>
Co-authored-by: mayeut <mayeut@users.noreply.github.com>
* chore: use SPEC 0 schedule for cibuildwheel
* remove support for {python} and {pip} in commands
* Remove specific Python versions from the update-dependencies job
The requirements pinning is done by uv now, so we don't need to
run the versions of Python to do the pinning anymore.
---------
Co-authored-by: Joe Rickerby <joerick@mac.com>
* Add test_sources configuration option.
* Add pyodide implementation.
* Modify default test behavior to run in the project directory.
* Update the test for running in the project directory.
* Apply suggestions from code review
Co-authored-by: Joe Rickerby <joerick@mac.com>
* Add shlex quoting to test-sources.
* Restructure ctypes example to avoid issues running from the project folder.
---------
Co-authored-by: Joe Rickerby <joerick@mac.com>
* fix: parse version strings that include dashes
It's possible for some container engines to report their versions with a dash (e.g., "4.9.4-rhel"), which breaks packaging.version.Version's ability to parse the string. This commit introduces a version_from_string method which santizies the version string and returns an instance of Version.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* cleanup: pacify ruff
* cleanup: further pacify ruff
* fix: properly define _version_from_string method
Also, lift the method up and prefix with a "_" to better match the existing conventions
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* refactor: more robust podman ver check
Use the "podman --version" command instead of "podman version -f {{json .}}" for better reliability across distributions.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix: oci engine version check
Lower Docker API check to 1.41
Podman versions are not PEP440 compliant, remove distro specific suffixes before parsing.
Add tests with real-world outputs and some made up ones.
* fix: UX on OCIEngineTooOldError
* Add FlexibleVersion
per review comment
---------
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>
* fix: enforce minimum version of docker/podman
This allows to always pass `--platform` to the OCI engine
thus fixing issues with multiarch images.
* Allow older versions with warnings
* Upgrade docker on Travis CI
* fix: use `docker cp` instead of `tar`
* Enforce docker>=24.0
* move log to include container.copy_into
* fix: travis-ci, only update docker on aarch64
* skip test_multiarch_image on s390x / ppc64le
* skip flaky test
* chore: only install test deps on Travis CI
* fix: do not try to pull images tagged `cibw_local`
* use "--pull=never" for local images
* Use docker image inspect to check if an image needs to be pulled
Fix for #1803, where the method used for merging the config-settings option - string concatenation - was of little use.
I broke out the TableFmt object into a protocol-like object called OptionFormat, where the formatting and merge rules can be customised more deeply. This is more explicit, and lets us be a bit more precise with how TOML object get converted into the options.
I intend to use the flexibility of the OptionsFormat structure to tackle the remaining abiguity around environment variable quoting, as seen in the xfails in the options_test.py unit test and discussed in #1271.
Co-authored-by: Matthieu Darbois <mayeut@users.noreply.github.com>
* Build CPython 3.13 by default
Enable building with CPython 3.13 by default, no longer requiring prerelease_pythons flag to be set true.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* README.md: Add note about free-threaded support
* build_selector_test.py: cp313t still behind flag
Even with 3.13 being enabled by default, cp313t is still behind a flag for now.
This commit updates the test accordingly.
* fix unit tests
---------
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>
* set VSCMD_ARG_TGT_ARCH based on targetted architecture
* only set VSCMD_ARG_TGT_ARCH if not already set
* add unit tests to check setuptools correctly identifies windows arch
* only run tests on windows
* arm64 fails on azure pipelines (only)
* Update windows.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Apply suggestions from code review
Co-authored-by: Joe Rickerby <joerick@mac.com>
* update test_env_set to validate FatalError is raised on env collision
* remove noqa ARG001 (no longer needed)
---------
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Joe Rickerby <joerick@mac.com>
* Refactor error handling to use exceptions
cibuildwheel has up until now handled most errors by printing an error message to sys.stderr and calling sys.exit. Others were handled using Logger.error, depending on the context. We also had return codes, but these weren't explicitly defined anywhere.
This makes that convention more explicit and codified. Now to halt the program, the correct thing to do is to throw a cibuildwheel.errors.FatalError exception - that is caught in main() and printed before exiting. The existing behaviour was kept - if an error occurs within a build step (probably something to do with the build itself), the Logger.error() method is used. Outside of a build step (e.g. a misconfiguration), the behaviour is still to print 'cibuildwheel: <message>'
I also took the opportunity to add a debugging option `--debug-traceback` (and `CIBW_DEBUG_TRACEBACK`), which you can enable to see a full traceback on errors.
(I've deactivated the flake8-errmsg lint rule, as it was throwing loads of errors and these error messages aren't generally seen in a traceback context)
* add noqa rule
* Apply suggestions from code review
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
* Return to flake8-errmsg conformance
* Code review suggestions
* Subclass Exception rather than SystemExit
* apply error handling to new code and fix merge issues
* Apply review suggestion
* fix: merge issue
* Update cibuildwheel/errors.py
---------
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: mayeut <mayeut@users.noreply.github.com>
* feat: add Pyodide support
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
Co-authored-by: Matthieu Darbois <mayeut@users.noreply.github.com>
tests: fix two merge issues
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
fix: include schema
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* Try to fix xbuildenv path
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Try to install pyodide-build from main branch
Try again
Try again
Update constraints file
Try again
Remove unused variable
Drop constraints
Remove --download option
Fix xbuildenv install
Try again
Try again
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix: remove pinning on pyodide
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* Update for Pyodide 0.26.0a5
* Install pyodide-build from pypi
* Update docs/options.md
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
* Unxfail things that look like they were just a version mismatch
* refactor: add constraints for pyodide
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* chore: minor cleanup
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* Apply suggestions from code review
* Apply suggestion from code review
* refactor: minor touchup
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* ci: xfail the pyodide test
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* review: use a pinned version of node
* fix tests
* review: error out on Windows
* test: check node & test on macos arm64
* chore: minor cleanup
* Add reference to emscripten libc issue
* Apply suggestion from code review
* review: use a pinned pip in test virtual environment
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* chore: rework test virtual environment seed packages
* chore: workaround direct invocation of pytest
This allows to still test direct invocation of `pytest` on most platforms (including pyodide on Linux) but falls back to `python -m pytest` when running pyodide on macOS.
* Use release version of pyodide
* fix: tests for 0.26.0 & parallel initialization of xbuildenv
* Debug CI
* fix: test/test_build_frontend_args.py
* Revert "Debug CI"
This reverts commit 917646cffc96dbfc619c47d1c03a828f447bcdb7.
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Matthieu Darbois <mayeut@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* feat: add inherit to override
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* refactor: use dict and support prepend
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* Refactor: simplifying by splitting the responsibilities of _dig_first
* Refactor to allow merging of string settings, and preserve table cascades
* docs: add some docs for inherit
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
* Apply suggestions from code review
Co-authored-by: Joe Rickerby <joerick@mac.com>
---------
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Joe Rickerby <joerick@mac.com>
Historically, we required `--platform` when running cibuildwheel outside of CI, because cibuildwheel would attempt to globally install Python interpreters and some packages.
That was fixed in https://github.com/pypa/cibuildwheel/pull/974 a couple of years ago. As a result, there's no reason to require --platform these days, the `auto` behaviour is perfectly fine for dev machines.
It also makes running tests locally simpler, one can just do `pytest test/test_0_basic.py` (or `nox -s tests -- test/test_0_basic.py`) and not have to worry about setting CIBW_PLATFORM most of the time.