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

feat: remove usages of __file__ to support pdm in a zipapp #1567

Merged
merged 4 commits into from
Dec 12, 2022

Conversation

frostming
Copy link
Collaborator

@frostming frostming commented Dec 12, 2022

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.

Use importlib.resources to read script or data inside the package, to replace the usages of __file__ variable. This will enable PDM to be used in a zipapp.

TODO

  • Update unearth to support being used in ziapp
  • Provide a way to get the PDM version in zipapp

@codecov-commenter
Copy link

codecov-commenter commented Dec 12, 2022

Codecov Report

Base: 85.36% // Head: 85.37% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (e707d92) compared to base (7f09f24).
Patch coverage: 85.41% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1567      +/-   ##
==========================================
+ Coverage   85.36%   85.37%   +0.01%     
==========================================
  Files          91       91              
  Lines        8068     8081      +13     
  Branches     1911     1920       +9     
==========================================
+ Hits         6887     6899      +12     
- Misses        793      794       +1     
  Partials      388      388              
Flag Coverage Δ
unittests 85.19% <85.41%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
src/pdm/core.py 88.52% <0.00%> (ø)
src/pdm/cli/actions.py 78.07% <20.00%> (-0.44%) ⬇️
src/pdm/__version__.py 71.42% <50.00%> (-1.30%) ⬇️
src/pdm/utils.py 86.91% <66.66%> (ø)
src/pdm/cli/commands/run.py 91.59% <100.00%> (-0.04%) ⬇️
src/pdm/cli/commands/self_cmd.py 71.52% <100.00%> (ø)
src/pdm/cli/utils.py 83.23% <100.00%> (+0.43%) ⬆️
src/pdm/models/in_process/__init__.py 100.00% <100.00%> (ø)
src/pdm/models/specifiers.py 79.29% <100.00%> (+0.14%) ⬆️

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 marked this pull request as ready for review December 12, 2022 05:32
@frostming frostming merged commit 19f6c44 into main Dec 12, 2022
@frostming frostming deleted the read-resource branch December 12, 2022 05:55
@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.

2 participants