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

calling CLIs globally #10997

Closed
zachvalenta opened this issue Jan 27, 2025 · 2 comments
Closed

calling CLIs globally #10997

zachvalenta opened this issue Jan 27, 2025 · 2 comments
Labels
duplicate This issue or pull request already exists question Asking for clarification or support

Comments

@zachvalenta
Copy link

Question

If I have CLI scripts that depended on third-party packages, I will:

  • add necessary deps to global user env (python -m pip install $PKG --user)
  • put the script on $PATH

With that, I can call the scripts globally.

I'm trying to move one of these scripts to uv:

uv add --script qing 'send2trash'
#!/usr/bin/env python
# /// script
# requires-python = ">=3.13"
# dependencies = [
#     "send2trash",
# ]
# ///
import sys
from send2trash import send2trash
for i in sys.argv[1:]:
    try:
        send2trash(i)
    except OSError:
        print("could not find file/dir to remove")

I can run it with uv if it's in the same directory

$ uv run qing

But it seems like there's no way to run it globally without adding an alias to my .zprofile like alias qing="uv run path/to/qing"

Any way to avoid adding this alias?

Platform

No response

Version

No response

@zachvalenta zachvalenta added the question Asking for clarification or support label Jan 27, 2025
@zanieb
Copy link
Member

zanieb commented Jan 27, 2025

I think this is roughly a duplicate of #7242

@zanieb zanieb added the duplicate This issue or pull request already exists label Jan 27, 2025
@zachvalenta
Copy link
Author

Dang it, searched through tickets before opening but didn't spot that one. That ticket is indeed more or less what I'm looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

2 participants