Skip to content

feat: type the bindings input with a single-source-of-truth enum - #3273

Merged
messense merged 1 commit into
PyO3:mainfrom
messense:refactor/a4-typed-bindings
Jul 22, 2026
Merged

messense merged 1 commit into
PyO3:mainfrom
messense:refactor/a4-typed-bindings

Conversation

@messense

Copy link
Copy Markdown
Member

Replace the raw Option<String> bindings input on the CLI (--bindings), maturin develop, and [tool.maturin] bindings with a dedicated Bindings enum (pyo3, pyo3-ffi, cffi, uniffi, bin). Every accepted spelling lives in one place (Bindings::as_str); FromStr, Display, serde, clap ValueEnum and schemars all delegate to it, so the accepted spellings can never drift apart.

find_bridge/find_bridge_with_deps now take Option<Bindings> and convert to BridgeModel at the point the string used to be consumed. BridgeModel is deliberately not reused as the input type: auto-detection and resolved PyO3 metadata are semantic states, not input spellings.

Behavior is backward compatible: the serialized values and CLI possible-values diagnostic are byte-identical to before, and TOML now rejects unknown values with serde's variant-naming error instead of the old downstream "unknown binding type". Auto-detection (bindings omitted) is unchanged.

Regenerated maturin.schema.json: ToolMaturin.bindings becomes a $ref to a new Bindings string-enum def, documented in the house style (a oneOf of per-variant const values, each with a one-line description).

Replace the raw `Option<String>` bindings input on the CLI (`--bindings`),
`maturin develop`, and `[tool.maturin] bindings` with a dedicated `Bindings`
enum (pyo3, pyo3-ffi, cffi, uniffi, bin). Every accepted spelling lives in one
place (`Bindings::as_str`); `FromStr`, `Display`, serde, clap `ValueEnum` and
schemars all delegate to it, so the accepted spellings can never drift apart.

`find_bridge`/`find_bridge_with_deps` now take `Option<Bindings>` and convert
to `BridgeModel` at the point the string used to be consumed. `BridgeModel` is
deliberately not reused as the input type: auto-detection and resolved PyO3
metadata are semantic states, not input spellings.

Behavior is backward compatible: the serialized values and CLI possible-values
diagnostic are byte-identical to before, and TOML now rejects unknown values
with serde's variant-naming error instead of the old downstream
"unknown binding type". Auto-detection (bindings omitted) is unchanged.

Regenerated maturin.schema.json: ToolMaturin.bindings becomes a `$ref` to a new
`Bindings` string-enum def, documented in the house style (a `oneOf` of
per-variant `const` values, each with a one-line description).
@messense
messense force-pushed the refactor/a4-typed-bindings branch from 563fbff to 7d6cabc Compare July 22, 2026 10:56
@messense
messense merged commit 8410a9b into PyO3:main Jul 22, 2026
45 checks passed
@messense
messense deleted the refactor/a4-typed-bindings branch July 22, 2026 12:55
halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Aug 26, 2026
Changelog:

* Set `UV_PYTHON` when running `maturin develop` with uv ([#3236](PyO3/maturin#3236))
* Set UID and GID headers in pax ([#3241](PyO3/maturin#3241))
* Replace unguarded panics with explicit errors on fallible input ([#3242](PyO3/maturin#3242))
* Harden PEP 517 build-wheel and fix unreachable OIDC 404 fallback ([#3244](PyO3/maturin#3244))
* Fix abi3t PyModExport entrypoint check ([#3246](PyO3/maturin#3246))
* Fix `maturin build --pgo -i <version>` with `uv` install ([#3237](PyO3/maturin#3237))
* Refactor: apply some mechanical cleanups ([#3250](PyO3/maturin#3250))
* Refactor: BuildOrchestrator pipeline deduplication ([#3251](PyO3/maturin#3251))
* Refactor: improve context and environment hygiene ([#3252](PyO3/maturin#3252))
* Fix(ci): honor ~= and ==X.* in requires-python for generate-ci ([#3249](PyO3/maturin#3249))
* Refactor: type cleanup for options, tags, and wheel metadata ([#3253](PyO3/maturin#3253))
* Refactor: InstallDest, single BridgeModel, and ui output facade ([#3254](PyO3/maturin#3254))
* Don’t specify generate-import-lib for PyO3 0.29 ([#3258](PyO3/maturin#3258))
* Refactor build so that pgo is part of normal pathway ([#3257](PyO3/maturin#3257))
* Fix: verify bindings detection with cargo tree in workspaces ([#3264](PyO3/maturin#3264))
* Fix: harden cargo tree verification of bindings detection ([#3266](PyO3/maturin#3266))
* Feat: support --pgo for maturin develop ([#3270](PyO3/maturin#3270))
* Feat: support `MATURIN_PGO` env var to activate --pgo ([#3271](PyO3/maturin#3271))
* Docs: correct crate feature documentation; remove stale clippy allow
* Fix: deduplicate SBOM includes across full merged list, preserving first-seen order
* Feat: type the bindings input with a single-source-of-truth enum ([#3273](PyO3/maturin#3273))
* Don't force export of the `PyInit_{module_name}` in UniFfi mode ([#3275](PyO3/maturin#3275))
* Switch musllinux images to `musllinux_1_2` as `musllinux_1_1` is EOL ([#3280](PyO3/maturin#3280))
* Fix(generate-stubs): write stubs into the module's package directory ([#3282](PyO3/maturin#3282))
* Fix group not cwd ([#3284](PyO3/maturin#3284))
* Docs: document missing [tool.maturin] config fields ([#3287](PyO3/maturin#3287))
* Update cargo-zigbuild & cargo-xwin to 0.23.1

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Aug 26, 2026
Changelog:

* Set `UV_PYTHON` when running `maturin develop` with uv ([#3236](PyO3/maturin#3236))
* Set UID and GID headers in pax ([#3241](PyO3/maturin#3241))
* Replace unguarded panics with explicit errors on fallible input ([#3242](PyO3/maturin#3242))
* Harden PEP 517 build-wheel and fix unreachable OIDC 404 fallback ([#3244](PyO3/maturin#3244))
* Fix abi3t PyModExport entrypoint check ([#3246](PyO3/maturin#3246))
* Fix `maturin build --pgo -i <version>` with `uv` install ([#3237](PyO3/maturin#3237))
* Refactor: apply some mechanical cleanups ([#3250](PyO3/maturin#3250))
* Refactor: BuildOrchestrator pipeline deduplication ([#3251](PyO3/maturin#3251))
* Refactor: improve context and environment hygiene ([#3252](PyO3/maturin#3252))
* Fix(ci): honor ~= and ==X.* in requires-python for generate-ci ([#3249](PyO3/maturin#3249))
* Refactor: type cleanup for options, tags, and wheel metadata ([#3253](PyO3/maturin#3253))
* Refactor: InstallDest, single BridgeModel, and ui output facade ([#3254](PyO3/maturin#3254))
* Don’t specify generate-import-lib for PyO3 0.29 ([#3258](PyO3/maturin#3258))
* Refactor build so that pgo is part of normal pathway ([#3257](PyO3/maturin#3257))
* Fix: verify bindings detection with cargo tree in workspaces ([#3264](PyO3/maturin#3264))
* Fix: harden cargo tree verification of bindings detection ([#3266](PyO3/maturin#3266))
* Feat: support --pgo for maturin develop ([#3270](PyO3/maturin#3270))
* Feat: support `MATURIN_PGO` env var to activate --pgo ([#3271](PyO3/maturin#3271))
* Docs: correct crate feature documentation; remove stale clippy allow
* Fix: deduplicate SBOM includes across full merged list, preserving first-seen order
* Feat: type the bindings input with a single-source-of-truth enum ([#3273](PyO3/maturin#3273))
* Don't force export of the `PyInit_{module_name}` in UniFfi mode ([#3275](PyO3/maturin#3275))
* Switch musllinux images to `musllinux_1_2` as `musllinux_1_1` is EOL ([#3280](PyO3/maturin#3280))
* Fix(generate-stubs): write stubs into the module's package directory ([#3282](PyO3/maturin#3282))
* Fix group not cwd ([#3284](PyO3/maturin#3284))
* Docs: document missing [tool.maturin] config fields ([#3287](PyO3/maturin#3287))
* Update cargo-zigbuild & cargo-xwin to 0.23.1

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Aug 27, 2026
Changelog:

* Set `UV_PYTHON` when running `maturin develop` with uv ([#3236](PyO3/maturin#3236))
* Set UID and GID headers in pax ([#3241](PyO3/maturin#3241))
* Replace unguarded panics with explicit errors on fallible input ([#3242](PyO3/maturin#3242))
* Harden PEP 517 build-wheel and fix unreachable OIDC 404 fallback ([#3244](PyO3/maturin#3244))
* Fix abi3t PyModExport entrypoint check ([#3246](PyO3/maturin#3246))
* Fix `maturin build --pgo -i <version>` with `uv` install ([#3237](PyO3/maturin#3237))
* Refactor: apply some mechanical cleanups ([#3250](PyO3/maturin#3250))
* Refactor: BuildOrchestrator pipeline deduplication ([#3251](PyO3/maturin#3251))
* Refactor: improve context and environment hygiene ([#3252](PyO3/maturin#3252))
* Fix(ci): honor ~= and ==X.* in requires-python for generate-ci ([#3249](PyO3/maturin#3249))
* Refactor: type cleanup for options, tags, and wheel metadata ([#3253](PyO3/maturin#3253))
* Refactor: InstallDest, single BridgeModel, and ui output facade ([#3254](PyO3/maturin#3254))
* Don’t specify generate-import-lib for PyO3 0.29 ([#3258](PyO3/maturin#3258))
* Refactor build so that pgo is part of normal pathway ([#3257](PyO3/maturin#3257))
* Fix: verify bindings detection with cargo tree in workspaces ([#3264](PyO3/maturin#3264))
* Fix: harden cargo tree verification of bindings detection ([#3266](PyO3/maturin#3266))
* Feat: support --pgo for maturin develop ([#3270](PyO3/maturin#3270))
* Feat: support `MATURIN_PGO` env var to activate --pgo ([#3271](PyO3/maturin#3271))
* Docs: correct crate feature documentation; remove stale clippy allow
* Fix: deduplicate SBOM includes across full merged list, preserving first-seen order
* Feat: type the bindings input with a single-source-of-truth enum ([#3273](PyO3/maturin#3273))
* Don't force export of the `PyInit_{module_name}` in UniFfi mode ([#3275](PyO3/maturin#3275))
* Switch musllinux images to `musllinux_1_2` as `musllinux_1_1` is EOL ([#3280](PyO3/maturin#3280))
* Fix(generate-stubs): write stubs into the module's package directory ([#3282](PyO3/maturin#3282))
* Fix group not cwd ([#3284](PyO3/maturin#3284))
* Docs: document missing [tool.maturin] config fields ([#3287](PyO3/maturin#3287))
* Update cargo-zigbuild & cargo-xwin to 0.23.1

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Aug 27, 2026
Changelog:

* Set `UV_PYTHON` when running `maturin develop` with uv ([#3236](PyO3/maturin#3236))
* Set UID and GID headers in pax ([#3241](PyO3/maturin#3241))
* Replace unguarded panics with explicit errors on fallible input ([#3242](PyO3/maturin#3242))
* Harden PEP 517 build-wheel and fix unreachable OIDC 404 fallback ([#3244](PyO3/maturin#3244))
* Fix abi3t PyModExport entrypoint check ([#3246](PyO3/maturin#3246))
* Fix `maturin build --pgo -i <version>` with `uv` install ([#3237](PyO3/maturin#3237))
* Refactor: apply some mechanical cleanups ([#3250](PyO3/maturin#3250))
* Refactor: BuildOrchestrator pipeline deduplication ([#3251](PyO3/maturin#3251))
* Refactor: improve context and environment hygiene ([#3252](PyO3/maturin#3252))
* Fix(ci): honor ~= and ==X.* in requires-python for generate-ci ([#3249](PyO3/maturin#3249))
* Refactor: type cleanup for options, tags, and wheel metadata ([#3253](PyO3/maturin#3253))
* Refactor: InstallDest, single BridgeModel, and ui output facade ([#3254](PyO3/maturin#3254))
* Don’t specify generate-import-lib for PyO3 0.29 ([#3258](PyO3/maturin#3258))
* Refactor build so that pgo is part of normal pathway ([#3257](PyO3/maturin#3257))
* Fix: verify bindings detection with cargo tree in workspaces ([#3264](PyO3/maturin#3264))
* Fix: harden cargo tree verification of bindings detection ([#3266](PyO3/maturin#3266))
* Feat: support --pgo for maturin develop ([#3270](PyO3/maturin#3270))
* Feat: support `MATURIN_PGO` env var to activate --pgo ([#3271](PyO3/maturin#3271))
* Docs: correct crate feature documentation; remove stale clippy allow
* Fix: deduplicate SBOM includes across full merged list, preserving first-seen order
* Feat: type the bindings input with a single-source-of-truth enum ([#3273](PyO3/maturin#3273))
* Don't force export of the `PyInit_{module_name}` in UniFfi mode ([#3275](PyO3/maturin#3275))
* Switch musllinux images to `musllinux_1_2` as `musllinux_1_1` is EOL ([#3280](PyO3/maturin#3280))
* Fix(generate-stubs): write stubs into the module's package directory ([#3282](PyO3/maturin#3282))
* Fix group not cwd ([#3284](PyO3/maturin#3284))
* Docs: document missing [tool.maturin] config fields ([#3287](PyO3/maturin#3287))
* Update cargo-zigbuild & cargo-xwin to 0.23.1

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Aug 27, 2026
Changelog:

* Set `UV_PYTHON` when running `maturin develop` with uv ([#3236](PyO3/maturin#3236))
* Set UID and GID headers in pax ([#3241](PyO3/maturin#3241))
* Replace unguarded panics with explicit errors on fallible input ([#3242](PyO3/maturin#3242))
* Harden PEP 517 build-wheel and fix unreachable OIDC 404 fallback ([#3244](PyO3/maturin#3244))
* Fix abi3t PyModExport entrypoint check ([#3246](PyO3/maturin#3246))
* Fix `maturin build --pgo -i <version>` with `uv` install ([#3237](PyO3/maturin#3237))
* Refactor: apply some mechanical cleanups ([#3250](PyO3/maturin#3250))
* Refactor: BuildOrchestrator pipeline deduplication ([#3251](PyO3/maturin#3251))
* Refactor: improve context and environment hygiene ([#3252](PyO3/maturin#3252))
* Fix(ci): honor ~= and ==X.* in requires-python for generate-ci ([#3249](PyO3/maturin#3249))
* Refactor: type cleanup for options, tags, and wheel metadata ([#3253](PyO3/maturin#3253))
* Refactor: InstallDest, single BridgeModel, and ui output facade ([#3254](PyO3/maturin#3254))
* Don’t specify generate-import-lib for PyO3 0.29 ([#3258](PyO3/maturin#3258))
* Refactor build so that pgo is part of normal pathway ([#3257](PyO3/maturin#3257))
* Fix: verify bindings detection with cargo tree in workspaces ([#3264](PyO3/maturin#3264))
* Fix: harden cargo tree verification of bindings detection ([#3266](PyO3/maturin#3266))
* Feat: support --pgo for maturin develop ([#3270](PyO3/maturin#3270))
* Feat: support `MATURIN_PGO` env var to activate --pgo ([#3271](PyO3/maturin#3271))
* Docs: correct crate feature documentation; remove stale clippy allow
* Fix: deduplicate SBOM includes across full merged list, preserving first-seen order
* Feat: type the bindings input with a single-source-of-truth enum ([#3273](PyO3/maturin#3273))
* Don't force export of the `PyInit_{module_name}` in UniFfi mode ([#3275](PyO3/maturin#3275))
* Switch musllinux images to `musllinux_1_2` as `musllinux_1_1` is EOL ([#3280](PyO3/maturin#3280))
* Fix(generate-stubs): write stubs into the module's package directory ([#3282](PyO3/maturin#3282))
* Fix group not cwd ([#3284](PyO3/maturin#3284))
* Docs: document missing [tool.maturin] config fields ([#3287](PyO3/maturin#3287))
* Update cargo-zigbuild & cargo-xwin to 0.23.1

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
maturin 1.15.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## What's Changed
* set `UV_PYTHON` when running `maturin develop` with uv by @davidhewitt in PyO3/maturin#3236
* Set UID and GID headers in pax by @konstin in PyO3/maturin#3241
* [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in PyO3/maturin#3238
* Replace unguarded panics with explicit errors on fallible input by @messense in PyO3/maturin#3242
* Harden PEP 517 build-wheel and fix unreachable OIDC 404 fallback by @messense in PyO3/maturin#3244
* docs: add pdfcrate and quebec to examples by @ratazzi in PyO3/maturin#3245
* Fix abi3t PyModExport entrypoint check by @messense in PyO3/maturin#3246
* [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in PyO3/maturin#3247
* fix `maturin build --pgo -i <version>` with `uv` install by @davidhewitt in PyO3/maturin#3237
* refactor: apply some mechanical cleanups by @messense in PyO3/maturin#3250
* refactor: BuildOrchestrator pipeline deduplication by @messense in PyO3/maturin#3251
* refactor: improve context and environment hygiene by @messense in PyO3/maturin#3252
* fix(ci): honor ~= and ==X.* in requires-python for generate-ci by @teddytennant in PyO3/maturin#3249
* refactor: type cleanup for options, tags, and wheel metadata by @messense in PyO3/maturin#3253
* refactor: InstallDest, single BridgeModel, and ui output facade by @messense in PyO3/maturin#3254
* Don’t specify generate-import-lib for PyO3 0.29 by @musicinmybrain in PyO3/maturin#3258
* [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in PyO3/maturin#3259
* ci: fix clippy errors on rust 1.97 by @davidhewitt in PyO3/maturin#3263
* refactor build so that pgo is part of normal pathway by @davidhewitt in PyO3/maturin#3257
* fix: verify bindings detection with cargo tree in workspaces by @messense in PyO3/maturin#3264
* fix: harden cargo tree verification of bindings detection by @messense in PyO3/maturin#3266
* ci: cut test wall time without losing coverage by @messense in PyO3/maturin#3267
* test: share cargo target dirs per fixture family by @messense in PyO3/maturin#3268
* ci: cut fixed setup overhead in test jobs by @messense in PyO3/maturin#3269
* feat: support --pgo for maturin develop by @messense in PyO3/maturin#3270
* feat: support MATURIN_PGO env var to activate --pgo by @messense in PyO3/maturin#3271
* [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in PyO3/maturin#3272
* feat: type the bindings input with a single-source-of-truth enum by @messense in PyO3/maturin#3273
* Don't force export of the PyInit_{module_name} in UniFfi mode by @badboy in PyO3/maturin#3275
* [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in PyO3/maturin#3279
* switch musllinux images to musllinux_1_2 as musllinux_1_1 is EOL by @Joshix-1 in PyO3/maturin#3280
* fix(generate-stubs): write stubs into the module's package directory by @jonasdedden in PyO3/maturin#3282
* [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in PyO3/maturin#3286
* Fix group not cwd by @kraktus in PyO3/maturin#3284
* docs: document missing [tool.maturin] config fields by @teddytennant in PyO3/maturin#3287
* [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in PyO3/maturin#3288
* docs: fix cross compiling heading level by @BD103 in PyO3/maturin#3290
* [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci[bot] in PyO3/maturin#3292
* Release v1.15.0 by @messense in PyO3/maturin#3294

## New Contributors
* @ratazzi made their first contribution in PyO3/maturin#3245
* @teddytennant made their first contribution in PyO3/maturin#3249
* @jonasdedden made their first contribution in PyO3/maturin#3282
* @kraktus made their first contribution in PyO3/maturin#3284
* @BD103 made their first contribution in PyO3/maturin#3290

**Full Changelog**: https://github.com/PyO3/maturin/compare/v1.14.1...v1.15.0</pre>
  <p>View the full release notes at <a href="https://github.com/PyO3/maturin/releases/tag/v1.15.0">https://github.com/PyO3/maturin/releases/tag/v1.15.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!17599
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.

1 participant