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

- try a second source for the packaging version in case importlib metadata failed #1656

Merged
merged 6 commits into from
Feb 2, 2023

Conversation

franzhaas
Copy link
Contributor

@franzhaas franzhaas commented Jan 31, 2023

Pull Request Checklist

  • 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.

This is not a clean ready to merge pull request. This is a proof of concept to.:

1.) deal with wheel versions which include a source control version, like a git hash.
2.) to always deal with unsoported version selectors, regardless of weather this is a necessity or not.

please give it a look. In order to make this mergeable at least.:

a proper way to inform the user about the modification of the specifier is needed.
some tests need to be added/removed/changed

@@ -26,7 +26,6 @@
from pdm.compat import Distribution, importlib_metadata

_egg_fragment_re = re.compile(r"(.*)[#&]egg=[^&]*")
PACKAGING_22 = Version(importlib_metadata.version("packaging")) >= Version("22")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable is also used by tests

@frostming
Copy link
Collaborator

1.) deal with wheel versions which include a source control version, like a git hash.

IMO this isn't a problem, local versions are not acceptable only in comparing operaters: >=1.0.0+g12134, but OK otherwise.

@franzhaas
Copy link
Contributor Author

franzhaas commented Feb 1, 2023

The changes I initially presented here were overkill.

The problem which initially triggered me was that pdm does not work in a zipapp since the PACKAGING_22 variable gets constructed, due to a problem getting the version of "packaging".

So my initial aproach was to get this variable out -> which works for me.

So this is a less invasive suggestion, if importlib metadata fails, lets try a different method. This is similar to the way pdm learns about its own version...

Best regards,
Franz

.

@franzhaas franzhaas changed the title - check requirement format all the time - try a second source for the packaging version in case importlib metadata failed Feb 1, 2023
@codecov-commenter
Copy link

Codecov Report

Base: 85.21% // Head: 85.19% // Decreases project coverage by -0.02% ⚠️

Coverage data is based on head (90b27c9) compared to base (c81bd98).
Patch coverage: 60.00% of modified lines in pull request are covered.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1656      +/-   ##
==========================================
- Coverage   85.21%   85.19%   -0.02%     
==========================================
  Files          92       92              
  Lines        8562     8566       +4     
  Branches     1851     1851              
==========================================
+ Hits         7296     7298       +2     
- Misses        850      852       +2     
  Partials      416      416              
Flag Coverage Δ
unittests 85.02% <60.00%> (-0.02%) ⬇️

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

Impacted Files Coverage Δ
src/pdm/utils.py 86.47% <60.00%> (-0.61%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@frostming frostming merged commit f1b6b50 into pdm-project:main Feb 2, 2023
@j178 j178 mentioned this pull request Apr 3, 2024
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.

3 participants