-
-
Notifications
You must be signed in to change notification settings - Fork 356
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
Fix crash if dependencies have prerelease requires-python versions #1112
Conversation
3bbac16
to
b20434b
Compare
Recently, coverage 6.4.1 listed its requirements with an alpha version of python and this broke PDM's version parsing: extras_require={ 'toml': ['tomli; python_full_version<="3.11.0a6"'], }, Prerelease `requires-python` versions *are* valid, per these specifications: * https://peps.python.org/pep-0440/ * https://peps.python.org/pep-0621/#requires-python * https://packaging.python.org/en/latest/specifications/core-metadata/#requires-python Therefore this commit adds missing parsing support for `{a|b|rc}[N]` pre-release specifiers which are used by python language releases: * https://docs.python.org/3/faq/general.html#how-does-the-python-version-numbering-scheme-work This bug meant that projects that directly or indirectly depended on coverage were unable to update pdm.lock using commands like `update` `add` `lock` and `install` because `pdm.models.versions.Version` would raise: pdm.exceptions.InvalidPyVersion: 3.11.0a6: Prereleases or postreleases are not supported for python version specifers. Until this is fixed, projects can workaround this by depending on: "coverage<6.4", "coverage[toml]<6.4", Fixes pdm-project#1111
b20434b
to
74988c6
Compare
Thanks for doing this, mostly LGTM. Can you remove the workaround here since prereleases are now supported in the python specifier. |
Since prereleases are now supported in python specifiers (in the previous commit), we can remove the workaround (from commit 8e72609 for pdm-project#932) that converted a python prerelease version to a specifier range.
@frostming Thank you for PDM! I removed the workaround entirely since the function is only used in a single place. |
Codecov Report
@@ Coverage Diff @@
## main #1112 +/- ##
==========================================
+ Coverage 84.30% 84.33% +0.03%
==========================================
Files 74 74
Lines 6532 6577 +45
Branches 1355 1543 +188
==========================================
+ Hits 5507 5547 +40
- Misses 696 701 +5
Partials 329 329
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
Neat!
Recently, coverage 6.4.1 listed its requirements with an alpha version of
python and this broke PDM's version parsing:
Prerelease
requires-python
versions are valid, per these specifications:Therefore this commit adds missing parsing support for
{a|b|rc}[N]
pre-release specifiers which are used by python language releases:
This bug meant that projects that directly or indirectly depended on coverage
were unable to update pdm.lock using commands like
update
add
lock
andinstall
becausepdm.models.versions.Version
would raise:Until this is fixed, projects can workaround this by depending on:
Fixes #1111