Skip to content

Document platform-specific before-build config - #2834

Merged
henryiii merged 3 commits into
pypa:mainfrom
Herrtian:docs-per-platform-before-build
May 4, 2026
Merged

henryiii merged 3 commits into
pypa:mainfrom
Herrtian:docs-per-platform-before-build

Conversation

@Herrtian

@Herrtian Herrtian commented May 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #1578.

This adds a short note that pyproject.toml uses platform tables for platform-specific options, and includes 锟絜fore-build examples for Linux and macOS.

Checked with:

  • git diff --check
  • python -m cibuildwheel --help

I also tried mkdocs build --strict on Windows, but the docs macro calls the cibuildwheel console script without .exe, and the local Windows subprocess lookup failed before rendering the page.

Comment thread docs/options.md Outdated
Co-authored-by: agriya khetarpal <74401230+agriyakhetarpal@users.noreply.github.com>
Comment thread docs/options.md
Platform-specific environment variables are also available:<br/>
`CIBW_BEFORE_BUILD_MACOS` | `CIBW_BEFORE_BUILD_WINDOWS` | `CIBW_BEFORE_BUILD_LINUX` | `CIBW_BEFORE_BUILD_ANDROID` | `CIBW_BEFORE_BUILD_IOS` | `CIBW_BEFORE_BUILD_PYODIDE`

In configuration files, use platform tables like `[tool.cibuildwheel.macos]`.

@henryiii henryiii May 4, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have this note here but not on every other config option? (Maybe the argument is that this one is more likely to need per-platform config?)

Comment thread docs/options.md
Comment on lines +822 to +827
# Use a different command on a specific platform
[tool.cibuildwheel.linux]
before-build = "python scripts/install-linux-deps.py"

[tool.cibuildwheel.macos]
before-build = "python scripts/install-macos-deps.py"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually keep the config settings and environment settings tabs matching. We should have these examples there too, I think.

@Herrtian

Herrtian commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, pushed ea0cb64 to add the matching env-var examples and kept the shorter config note from the earlier suggestion. Checked git diff --check locally; pre-commit also got through the markdown hooks, but cog hit a Windows encoding issue while reading README/changelog, so I left that as local-only.

@henryiii
henryiii merged commit d593457 into pypa:main May 4, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add examples in docs about setting "per-platform" before-build options in pyproject.toml

3 participants