fix(metadata): combine same-field dynamic_wheel reports with OR#1437
Merged
Conversation
dynamic_wheel_fields merged provider reports with dict.update, so when
two [[tool.dynamic-metadata]] entries reported the same field the last
one won -- a later {"dependencies": False} could retract an earlier
{"dependencies": True}. Since a list/table field's merged value can
change if any contributing provider's part may, reports must combine
with OR (any True wins); over-marking Dynamic is allowed, under-marking
violates PEP 643. Validation now runs on each fragment as it is
collected, so a masked {"version": True} raises instead of being
silently dropped. Aligns with scikit-build/dynamic-metadata#78.
Closes #1436
Assisted-by: ClaudeCode:claude-opus-4.8
henryiii
marked this pull request as ready for review
July 2, 2026 05:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Fixes #1436.
Problem
dynamic_wheel_fieldsinbuilder/_load_provider.pymerged provider reports withdict.update, making same-field reports last-wins: a later[[tool.dynamic-metadata]]entry returning{"dependencies": False}could retract an earlier entry's{"dependencies": True}. Because contributions to a list/table field merge across entries, if any provider's part may change between the SDist and a wheel, the final value may change and PEP 643 requires it be markedDynamic. Over-marking is allowed; under-marking is a spec violation.A second consequence: validation ran over the merged dict after the loop, so a
{"version": True}from one provider was silently masked by a later{"version": False}instead of raising.Fix
Accumulate into a
setand validate each fragment as it is collected:Truewins) — aTruecan't be retracted.versionand unknown-field checks run per-fragment, so a masked{"version": True}still raises.Aligns with the reference implementation in scikit-build/dynamic-metadata#78.
Tests
Added
test_dynamic_wheel_same_field_combines_with_or, exercising both orderings of aTrue/Falsepair. Confirmed it fails against the old last-wins code (frozenset()instead of{"dependencies"}) and passes with the fix. All existingdynamic_wheeltests still pass.