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

A more convenient pdm run #856

Closed
warsaw opened this issue Jan 18, 2022 · 7 comments
Closed

A more convenient pdm run #856

warsaw opened this issue Jan 18, 2022 · 7 comments
Labels
⭐ enhancement Improvements for existing features

Comments

@warsaw
Copy link

warsaw commented Jan 18, 2022

Is your feature request related to a problem? Please describe.

I often find myself wanting to just fire up a Python interactive prompt using pdm's __pypackages__ in sys.path. I believe the way to do that is with pdm run python (at least, that works for me. But maybe we can be a little more convenient or discoverable. I admit this is a pretty minor convenience, so I don't mind if you close as Won't Fix.

Describe the solution you'd like

What if pdm run with no command were equivalent to running interactively the Python specified by pdm use? If you wanted to do anything more clever (e.g. pdm run python -c "whatever") you'd have to do that explicitly of course.

@warsaw warsaw added the ⭐ enhancement Improvements for existing features label Jan 18, 2022
@pawamoy
Copy link
Sponsor Contributor

pawamoy commented Jan 18, 2022

If you enabled PEP 582 in your shell, you can just run python -m some_package_installed_in_pypackages some args. Or python -c "import some_package; etc". Your interpreter will find the packages 🙂

You won't be able to directly call the scripts installed in __pypackages__/*/bin though. For this you still need to do pdm run some_package_script.

@warsaw
Copy link
Author

warsaw commented Jan 18, 2022

Yep. I just don't generally enable this in my shell.

@pawamoy
Copy link
Sponsor Contributor

pawamoy commented Jan 18, 2022

Oh, OK 😊 Out of complete curiosity, why is that?

@warsaw
Copy link
Author

warsaw commented Jan 18, 2022

A couple of reasons. My shell configs are a bit weird, having accumulated a lot of cruft over the decades. I also like to keep my shell environment tightly controlled. While I like the idea of PEP 582, I'm still a bit leery as to the security implications of it, especially with bin enabled. For now, I prefer to explicitly opt in when necessary.

@pawamoy
Copy link
Sponsor Contributor

pawamoy commented Jan 18, 2022

I see, thanks!

@quique
Copy link

quique commented Feb 7, 2024

I often find myself wanting to just fire up a Python interactive prompt using pdm's pypackages in sys.path.

How about source .venv/bin/activate?

@pawamoy
Copy link
Sponsor Contributor

pawamoy commented Feb 7, 2024

The question was about __pypackages__, not venvs 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ enhancement Improvements for existing features
Projects
None yet
Development

No branches or pull requests

3 participants