-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix indeterministic markers #10667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
radoering
merged 1 commit into
python-poetry:main
from
radoering:fix-indeterministic-marker
Dec 22, 2025
Merged
fix indeterministic markers #10667
radoering
merged 1 commit into
python-poetry:main
from
radoering:fix-indeterministic-marker
Dec 22, 2025
+16
−10
Conversation
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
Reviewer's guide (collapsed on small PRs)Reviewer's GuideMakes environment marker derivation and serialization deterministic by consistently sorting groups (prioritizing 'main') and aligning tests with set-based group collections. Sequence diagram for deterministic marker derivation and serializationsequenceDiagram
participant Locker
participant TransitivePackageInfo
participant group_sort_key
participant Marker as BaseMarker
Locker->>TransitivePackageInfo: get_marker(groups)
activate TransitivePackageInfo
TransitivePackageInfo->>group_sort_key: sort(groups, key=group_sort_key)
group_sort_key-->>TransitivePackageInfo: (group != main, group) for each group
TransitivePackageInfo->>Marker: union markers in sorted group order
TransitivePackageInfo-->>Locker: combined BaseMarker
deactivate TransitivePackageInfo
Note over Locker,TransitivePackageInfo: In _dump_package
Locker->>group_sort_key: sort(transitive_info.groups, key=group_sort_key)
group_sort_key-->>Locker: (group != main, group) for each group
Locker->>group_sort_key: sort(transitive_info.markers.items(), key=lambda x: group_sort_key(x[0]))
group_sort_key-->>Locker: (group != main, group) for each marker group
Locker->>Locker: serialize deterministic groups and markers
Class diagram for deterministic marker grouping and sortingclassDiagram
class TransitivePackageInfo {
int depth
set~NormalizedName~ groups
dict~NormalizedName, BaseMarker~ markers
get_marker(groups Iterable_NormalizedName_) BaseMarker
}
class group_sort_key {
<<function>>
group_sort_key(group NormalizedName) tuple_bool_NormalizedName_
}
class BaseMarker {
}
class EmptyMarker {
}
TransitivePackageInfo ..> BaseMarker : uses
TransitivePackageInfo ..> EmptyMarker : uses
TransitivePackageInfo ..> group_sort_key : uses for sorting groups
class Locker {
_dump_package(package, transitive_info TransitivePackageInfo, data) void
}
Locker ..> TransitivePackageInfo : reads groups, markers
Locker ..> group_sort_key : sorts groups and marker items
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
branchv
previously approved these changes
Dec 20, 2025
Currently, this is only relevant for poetry-plugin-export because in poetry itself, we only evaluate the marker.
4c4c5ea to
3a9b20d
Compare
branchv
approved these changes
Dec 21, 2025
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.
Currently, this is only relevant for poetry-plugin-export because in poetry itself, we only evaluate the marker.
See python-poetry/poetry-plugin-export#334 (comment) ff.
Pull Request Check List
Summary by Sourcery
Ensure deterministic ordering of dependency groups and their markers when generating transitive package metadata.
Bug Fixes:
Enhancements:
Tests: