Exactly. People complain about Python's package management story, but for 99% of use cases a workflow that consists of Python's built-in venv, pip, requirements.txt, and constraints.txt is completely fine.
My work saw a 5x speedup (~2min to ~20s) with a cold cache and like 200-500x (~20s to <0.1s) with a hot cache in our CI pipelines when we switched to uv.
Another handy trick is to use "-c" for executing the string as a command[0]. You can separate the commands by newlines or ";" if you're lazy (like me).
This is really handy when you're moving around environments and you want to get the path or location for a module:
If you have python and curl you can extract tag and its contents out of html file curl -s http://www.google.com/ | python3 -c 'import sys; s=sys.stdin.read(); e=""; print(s[s.find(e)+len(e):s.find("")])'
I subscribed to pythonmorsels, and I must say that Trey Hunner gives great product. Simple, one-page exercises that nevertheless make one think, and a polished user experience. Worth a look for anyone who'd come here.
Trey Hunner has created a ton of useful and interesting Python articles. Although I've been programming in it for 20+ years, I always learn new things. He's a national treasure.
Some Linux distros offer a similar (though far less memorably named) "xdg-open".
It doesn't do any of the other really handy things the MacOS "open" command can do, like "open -f" slurping stdin into a fresh instance of your default text editor.
This is correct. Unfortunately, xdg-tools is a set of almost forgotten scripts that need some more eyes and collaboration to polish. I've seen many problems there. Nobody is actively maintaining it, but a couple developers could get the ball rolling. (I'm interested)
As long as your python program checks for __name__ like this:
if __name__ == "__main__":
# Your code here
Then it should mostly "just work". Use the argparse module to parse command line arguments if necessary. Create a setup.py and use pip to install it, if you want.
If you use Poetry and a pyproject.toml, you can even make your package installable with something like pipx straight from Github. Its a trick I use often for little command line utilities.
I've not personally stumbled on a UI where Click was used to make something nicer than argparse could. I'm not saying those don't exist, just that I haven't seen one.
Every time I've seen someone use Click at work, it was to implement some simple args that argparse could handle identically. "Why are we using Click here?" "Because it's nice!" "In what way?" "It's nice!" "But we're not actually using the nice parts." "Click is nice!"
Click is nice. IMO it's used way too often in cases where argparse would do just as well.
I've reached for click when I need to create a layered command scheme .. ex where `mytool command1 --help` and `mytool command2 --help` would provide two different sets of arguments.