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

Set VIRTUAL_ENV in pdm run #1652

Merged
merged 3 commits into from
Jan 30, 2023
Merged

Set VIRTUAL_ENV in pdm run #1652

merged 3 commits into from
Jan 30, 2023

Conversation

pfmoore
Copy link
Contributor

@pfmoore pfmoore commented Jan 29, 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.

If the environment is a virtualenv, pdm run will set the VIRTUAL_ENV environment variable, which lets tools know that a virtualenv is in use. This means that (for example) the py launcher on Windows correctly locates the environment's Python rather than using the system Python.

Fixes #1650

@pfmoore
Copy link
Contributor Author

pfmoore commented Jan 29, 2023

I'll look into adding some tests, but I need to work out how to get a test to choose "virtualenv" mode, global mode or pypackages mode when running pdm run first!

@codecov-commenter
Copy link

codecov-commenter commented Jan 29, 2023

Codecov Report

Base: 85.20% // Head: 85.21% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (62c6028) compared to base (d4eb11f).
Patch coverage: 42.85% 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    #1652      +/-   ##
==========================================
+ Coverage   85.20%   85.21%   +0.01%     
==========================================
  Files          92       92              
  Lines        8555     8562       +7     
  Branches     1848     1851       +3     
==========================================
+ Hits         7289     7296       +7     
+ Misses        852      850       -2     
- Partials      414      416       +2     
Flag Coverage Δ
unittests 85.03% <42.85%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
src/pdm/cli/commands/run.py 90.98% <0.00%> (-0.76%) ⬇️
src/pdm/models/environment.py 66.66% <60.00%> (-0.19%) ⬇️
src/pdm/project/core.py 88.60% <0.00%> (+1.03%) ⬆️

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 4774cf4 into pdm-project:main Jan 30, 2023
@frostming
Copy link
Collaborator

global mode or pypackages mode when running pdm run first!

nvm, i will take care of it

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

pdm run does not activate the project's environment when running the command
3 participants