-
-
Notifications
You must be signed in to change notification settings - Fork 421
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
have a pdm shell command #2249
Comments
Workaround in the meantime, if you install dependencies in # pyproject.toml
[tool.pdm.scripts]
shell = {shell = "PATH=$(echo $(pdm info | grep __pypackages__)/bin):$PATH zsh"} % type ruff
ruff not found
% pdm run shell
% type ruff
ruff is /media/data/dev/griffe/__pypackages__/3.11/bin/ruff |
That looks like a good workaround, thank you. I don't use |
You're welcome! The following seems to work for venvs: # pyproject.toml
[tool.pdm.scripts]
shell = {shell = "zsh -c \"eval $(pdm venv activate 3.11); export PATH; export VIRTUAL_ENV; exec zsh\""} |
Why not just |
Oh my. Right. |
hmmm it's not really handy, plus the venv is not activated (it's just put in the path) and it's significant user experience disconcert since all other tools have the |
activating a venv is basically setting env vars, mainly VIRTUAL_ENV and PATH, plus some corner case handling. |
OK. Are you against a (but I think in few weeks someone will open another issue asking for a |
Coming from Poetry, |
Same story why I abandoned pdm shell |
I'd suggest that if someone wants it, it's a great plugin candidate. |
There's already one pdm-shell |
For reference: https://github.com/abersheeran/pdm-shell |
I ran into it. No install instructions on the readme, last commit in Nov 2022, 1 man project, it would look the same if it was abandoned. It cannot be considered in a enterprise-grade environment. |
Okay, it seems the plugin doesn't spawn a new shell either. However, the conclusion remains the same, we are not going to add this command, as it can be achieved in many ways:
The docs will be updated accordingly |
For reference, this is a bash/zsh function that you can copy and paste it into your rc file: pdm() {
local command=$1
if [[ "$command" == "shell" ]]; then
eval $(pdm venv activate)
else
command pdm $@
fi
} After restarting your shell you are able to run |
Ah, I did not know it was something willingly removed. I thought it was just never implemented. OK then, I can understand. Thank you for the suggested alternatives. |
Is your feature request related to a problem? Please describe.
No
Describe the solution you'd like
A
pdm shell
command, like Pipenv, Poetry and Hatch have. I have seenpdm venv activate
but it isn't really the same (plus it does not seem to work).The text was updated successfully, but these errors were encountered: