cibuildwheel icon indicating copy to clipboard operation
cibuildwheel copied to clipboard

`pyproject.toml` doesn't support "per-platform" `before-build`

Open thejcannon opened this issue 2 years ago • 4 comments

Description

:wave: Loving using this. Thanks y'all!

One thing I hit:

https://cibuildwheel.readthedocs.io/en/stable/options/#before-build lists "per-platform" env vars (e.g. CIBW_BEFORE_BUILD_MACOS), but trying:

[tool.cibuildwheel]
before-build-macos = "..."

I get

cibuildwheel.options.ConfigOptionError: "Option 'before-build-macos' not supported in a config file. Perhaps you meant 'before-build'?"

Build log

No response

CI config

No response

thejcannon avatar Aug 14 '23 16:08 thejcannon

Either:

[tool.cibuildwheel.macos]
before-build = "..."

Or:

[tool.cibuildwheel]
macos.before-build = "..."

(Just two ways of writing the same thing in TOML).

With the newer overrides system, you could also mimic it:

[[tool.cibuildwheel.overrides]]
select = "*-macosx_*"
before-build = "..."

henryiii avatar Aug 14 '23 16:08 henryiii

FANTASTIC!

Feel free to edit this issue (or close and I'll open a new one) to make this more obvious on the docs site.

thejcannon avatar Aug 14 '23 16:08 thejcannon

Okay, we already have some mention of https://cibuildwheel.readthedocs.io/en/stable/options/#configuration-file. Do you have something in mind?

henryiii avatar Aug 14 '23 16:08 henryiii

https://cibuildwheel.readthedocs.io/en/stable/options/#examples_10 the pyproject.toml tab doesn't match the "environment variables" tab (the latter having an example of "CIBW_BEFORE_BUILD_LINUX")

thejcannon avatar Aug 14 '23 16:08 thejcannon