fix parsing Windows server platform_release#911
Merged
radoering merged 1 commit intopython-poetry:mainfrom Feb 1, 2026
Merged
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts version parsing patterns and tests so that Windows Server-like platform_release strings (e.g. '2022Server') are rejected by default as invalid marker constraints but can be parsed when non‑PEP 440 parsing is explicitly requested, aligning behavior with existing non-standard versions like '4.9.253-tegra'. Flow diagram for version parsing with updated release patternflowchart LR
VersionString["Input version string"] --> ModeCheck{PEP440 parsing?}
ModeCheck -- Yes --> Pep440Parser["PEP440Parser"]
Pep440Parser --> Pep440Match{Matches PEP440?}
Pep440Match -- Yes --> Pep440Valid["Accept version as valid PEP440"]
Pep440Match -- No --> Pep440Invalid["Reject as invalid marker constraint (e.g. 2022Server)"]
ModeCheck -- No (non PEP440) --> NonStandardParser["NonStandardVersionParser"]
NonStandardParser --> ApplyPattern["Apply RELEASE_PATTERN with optional sign before build"]
ApplyPattern --> ReleaseGroup["Match release group: [0-9]+(.[0-9]+)*"]
ReleaseGroup --> OptionalBuild{Build part present?}
OptionalBuild -- No --> NonPep440ValidRelease["Accept plain numeric releases"]
OptionalBuild -- Yes --> BuildGroup["Match build group: [0-9a-zA-Z-]+(.[0-9a-zA-Z-]+)*"]
BuildGroup --> SignOptional["Optional + or - before build (e.g. 4.9.253-tegra)"]
SignOptional --> NonPep440Valid["Accept as valid non PEP440 version"]
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
platform_releasesplatform_release
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Making the '+'/'-' separator optional in
RELEASE_PATTERNbroadens what will be parsed as a build segment (e.g.1.0abc), so it would be good to double‑check that this still matches the intended grammar and doesn’t unexpectedly change behavior for other version shapes. - In
test_parse_marker_constraint_does_allow_invalid_version_if_requested, theexpectedtuple plus*expected[:-1]andtype: ignore[misc]is a bit opaque; consider constructing theVersionexplicitly per case or using a small helper to avoid the ignore and make the mapping from input to expectedVersionclearer.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Making the '+'/'-' separator optional in `RELEASE_PATTERN` broadens what will be parsed as a build segment (e.g. `1.0abc`), so it would be good to double‑check that this still matches the intended grammar and doesn’t unexpectedly change behavior for other version shapes.
- In `test_parse_marker_constraint_does_allow_invalid_version_if_requested`, the `expected` tuple plus `*expected[:-1]` and `type: ignore[misc]` is a bit opaque; consider constructing the `Version` explicitly per case or using a small helper to avoid the ignore and make the mapping from input to expected `Version` clearer.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
9632fab to
0f8dcb3
Compare
0f8dcb3 to
5417878
Compare
This was referenced Feb 1, 2026
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.
Resolves: python-poetry/poetry#10710
Summary by Sourcery
Relax version parsing to support additional non-PEP 440 platform release formats while preserving strict validation by default.
Bug Fixes:
Tests: