Post

How to create a Python CLI that's globally available in your system in 5 easy steps. 1. Install uv 2. Init project with `uv init --app --package mycli` 3. Write code 4. Install with `uv tool install . -e` 5. Use `mycli` anywhere in your computer

The reason I added -e is so that changes in the code you make to mycli are immediately visible by your system. If you want to version your CLI properly, I'd omit the `-e` from the installation command. Disclaimer: I'm not a packaging expert. Nor a uv expert.

0 reposts2 likes

Super nice trick. I've never used it, I just have scripts with inline deps and a uv shebang in a dir added to my PATH. But the advantage of your method is that nobody has to know about the PATH and it works cross platform.