-
Notifications
You must be signed in to change notification settings - Fork 293
Description
Description
Would it be possible to enable the CLI flag --allow-empty via an environment variable (e.g., CIBW_ALLOW_EMPTY)?
Here's our use case:
- We are running a matrix of build jobs in GitHub Actions.
- One of these jobs is
cp313-manylinux_x86_64. - Nightly builds will set
CIBW_PRERELEASE_PYTHONS=1but otherwise this job will not match any wheels. - We'd like to set the
--allow-emptyflag, but it currently doesn't seem possible through the cibuildwheel GitHub Action. - (More details: FR: support dynamic
CIBW_PRERELEASE_PYTHONandCIBW_FREETHREADED_SUPPORTinpublish.ymlOpenAstronomy/github-actions-workflows#212)
I'm thinking we could compute its value similarly to how CIBW_PRERELEASE_PYTHONS is handled:
cibuildwheel/cibuildwheel/options.py
Lines 523 to 525 in a4d2405
| prerelease_pythons = args.prerelease_pythons or strtobool( | |
| self.env.get("CIBW_PRERELEASE_PYTHONS", "0") | |
| ) |
This could be integrated within options.compute_options and added to options.GlobalOptions:
cibuildwheel/cibuildwheel/options.py
Lines 71 to 77 in a4d2405
| @dataclasses.dataclass(frozen=True) | |
| class GlobalOptions: | |
| package_dir: Path | |
| output_dir: Path | |
| build_selector: BuildSelector | |
| test_selector: TestSelector | |
| architectures: set[Architecture] |
Alternatively, CIBW_ALLOW_EMPTY could be checked directly within __main__.py:
cibuildwheel/cibuildwheel/__main__.py
Lines 337 to 338 in a4d2405
| if args.allow_empty: | |
| print(f"cibuildwheel: {message}", file=sys.stderr) |
I'm happy to open a PR if you think a new environment variable would be appropriate for this option. Thanks!
Build log
No response
CI config
No response