Conversation
PEP 440 describes a scheme for identifying versions of Python software distributions, and declaring dependencies on particular versions. As such, parsing and comparing are done in different parts of the codebase, leading to (potentially) diverging implementations and duplicated code. Introduces classes \PEP440Version\, \VersionConstraint\, \VersionSpecifier\ classes for parsing, representing and comparing versions to have a centralized way of handling those behaviors.
PEP440Version class and methods
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.
This pull request refactors how Python version strings are handled and compared throughout the codebase, replacing custom logic with the PEP 440-compliant
@renovatebot/pep440library. This ensures more accurate version validation, comparison, and display, and improves reliability across Python environment management features. Additionally, it updates dependencies and cleans up related code.Python version handling improvements:
shortVersion,isGreater,compareVersions) with PEP 440-compliant functions (pep440Valid,pep440Compare, etc.) from the@renovatebot/pep440library insrc/managers/common/utils.tsand throughout the codebase. This affects environment sorting, latest version selection, and version string shortening. [1] [2] [3] [4] [5]shortVersionfunction to use the newshortenVersionString, which leverages PEP 440 parsing for more accurate and consistent version display. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]Validation and compatibility checks:
pyproject.tomlvalidation withpep440Validfor more robust version checking. [1] [2]Dependency and configuration updates:
@renovatebot/pep440as a dependency inpackage.jsonand reformatted some configuration for clarity. [1] [2]These changes collectively improve the accuracy, maintainability, and standards compliance of Python version handling across the extension.
For reference https://peps.python.org/pep-0440/