Python's many command-line utilities
pythonmorsels.com
pythonmorsels.com
Sorry. Shameless plug.
This is really handy when you're moving around environments and you want to get the path or location for a module:
>>> python3 -c "import httpx; print(httpx.__path__)"
or
>>> python3 -c "import httpx; print(httpx.__file__)"
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("")])' >>> python3 -c "print(__import__('httpx').__path__)"Pythonmorsels is a great subscribe.
open "http://example.com"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.
I wouldn't be surprised the GNOME people try to break this standard tool too.
[WIN]+R -> https://google.com
else: argparse is more than enough https://docs.python.org/3/library/argparse.html
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.
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.
Similar to what the `git` suite provides.
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.> Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.