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

fix: in project conda venv activate without argument #1735

Merged
merged 5 commits into from
Mar 2, 2023
Merged

fix: in project conda venv activate without argument #1735

merged 5 commits into from
Mar 2, 2023

Conversation

ProgramRipper
Copy link
Contributor

@ProgramRipper ProgramRipper commented Feb 23, 2023

Pull Request Checklist

  • A news fragment is added in news/ describing what is new.
    - [ ] Test cases added for changed code. (current tests do not cover venv activate without env)

Describe what you have changed in this PR.

For in project venv created by conda, using pdm venv activate without specifying env_name would be a failure:

(base) programripper:~/conda-test$ echo $CONDA_PREFIX  # Actually it is quite common for conda that isn't installed normally (e.g. via pyenv) that not to have CONDA_PREFIX properly set, which will make pdm fail faster.
/home/programripper/.pyenv/shims/conda
(base) programripper:~/conda-test$ pdm venv list
Virtualenvs created with this project:

*  in-project: /home/programripper/conda-test/.venv
(base) programripper:~/conda-test$ cat .pdm.toml
[venv]
backend = "conda"

[python]
path = "/home/programripper/conda-test/.venv/bin/python"
(base) programripper:~/conda-test$ pdm venv activate
Can't activate a non-venv Python /home/programripper/conda-test/.venv/bin/python, you can specify one with pdm venv activate <env_name>

By this PR, user can activate in project venv created by conda using pdm venv activate as venv created by venv or virtualvenv.

src/pdm/utils.py Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Feb 27, 2023

Codecov Report

Base: 85.20% // Head: 85.11% // Decreases project coverage by -0.09% ⚠️

Coverage data is based on head (ce3a74b) compared to base (4751b40).
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    #1735      +/-   ##
==========================================
- Coverage   85.20%   85.11%   -0.09%     
==========================================
  Files          92       92              
  Lines        8638     8661      +23     
  Branches     1865     1871       +6     
==========================================
+ Hits         7360     7372      +12     
- Misses        858      867       +9     
- Partials      420      422       +2     
Flag Coverage Δ
unittests 84.93% <60.00%> (-0.09%) ⬇️

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

Impacted Files Coverage Δ
src/pdm/utils.py 85.82% <60.00%> (-0.65%) ⬇️
src/pdm/installers/manager.py 86.66% <0.00%> (-13.34%) ⬇️
src/pdm/models/project_info.py 92.85% <0.00%> (-1.43%) ⬇️
src/pdm/installers/synchronizers.py 83.33% <0.00%> (-1.20%) ⬇️
src/pdm/cli/commands/show.py 85.10% <0.00%> (-0.32%) ⬇️

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 91d9a1e into pdm-project:main Mar 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