Skip to content
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

Support prereleases in python requires #932

Merged
merged 3 commits into from
Feb 23, 2022
Merged

Support prereleases in python requires #932

merged 3 commits into from
Feb 23, 2022

Conversation

frostming
Copy link
Collaborator

Pull Request Check List

  • A news fragment is added in news/ describing what is new.
  • Test cases added for changed code.

Describe what you have changed in this PR.

@codecov-commenter
Copy link

codecov-commenter commented Feb 23, 2022

Codecov Report

Merging #932 (442bcaf) into main (4b1507d) will increase coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #932      +/-   ##
==========================================
+ Coverage   83.87%   83.99%   +0.11%     
==========================================
  Files          74       74              
  Lines        6461     6471      +10     
  Branches     1341     1342       +1     
==========================================
+ Hits         5419     5435      +16     
+ Misses        715      711       -4     
+ Partials      327      325       -2     
Flag Coverage Δ
unittests 83.72% <90.90%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pdm/models/specifiers.py 80.27% <100.00%> (+0.70%) ⬆️
pdm/project/core.py 89.91% <100.00%> (ø)
pdm/installers/installers.py 83.92% <0.00%> (+1.19%) ⬆️
pdm/models/environment.py 65.87% <0.00%> (+1.58%) ⬆️
pdm/models/python.py 96.22% <0.00%> (+3.77%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2447a5e...442bcaf. Read the comment docs.

@frostming frostming merged commit 5acad0c into main Feb 23, 2022
@frostming frostming deleted the ci/fix-py311 branch February 23, 2022 10:40
Hnasar pushed a commit to Hnasar/pdm that referenced this pull request Jun 3, 2022
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 pushed a commit that referenced this pull request Jun 3, 2022
…1112)

* Fix crash if dependencies have prerelease requires-python versions

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 #1111

* Remove workaround for pre-release python in global environment

Since prereleases are now supported in python specifiers (in the
previous commit), we can remove the workaround (from commit 8e72609
for #932) that converted a python prerelease version to a specifier
range.

Co-authored-by: Hashem Nasarat <hnasarat@beta.team>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants