3 ms·
I've recently been using Python3 + argparse for small single file utilities. Used to use bash but have probably converted now with how easy calling external pro
by verdverm 6y ago
I've recently been using Python3 + argparse for small single file utilities. Used to use bash but have probably converted now with how easy calling external programs is (compared to something like Go)
I'd have a hard time selecting LISP for anything others would use (which is almost all the software I write) unless I worked in a company that was using LISP regularly.
- CraigJPerry 6y agoI read this entire thread thinking - this is neat and all but it’s a handful of lines of almost english language in a .py file. Click is a neat upgrade from argparse if you’re ever tempted (assuming something like “pip install —-user” is viable in your situation which isn’t true for everyone). I’ve seen, but haven’t used https://typer.tiangolo.com/ https://typer.tiangolo.com/ - i have used his FastAPI and thought that was nicely done (even if python async is a bit annoying to test). Talking of python cli libs I haven’t tried but will do one day - rich: https://github.com/willmcgugan/rich https://github.com/willmcgugan/rich
- verdverm 6y agoI try to avoid pip and dependencies for these python scripts. This goal has it's limits. Click is nice if you want a command with multiple sub commands. I use Go + Cobra at that point via https://github.com/hofstadter-io/hofmod-cli https://github.com/hofstadter-io/hofmod-cli The human understanding is a big reason why python has gained my favor over bash
- p_l 6y agoWell, but then you'd be writing python. (and having to maintain python runtime environment, which tends to be much less stable than CL)
- barbazoo 6y agoI recently switched to Click from argparse and like it better so far.
- verdverm 6y agoA lot of these are multi use local run, in CI, and at onsite w/o internet, so we try hard to avoid dependencies and keep them small and pointed. Once we need deps we need a more complicated setup, so Docker or Go usually prevail
- nonameiguess 6y agoYou can always use something like PyInstaller or freeze to produce a single-file executable that bundles all of its dependencies, though at that point you may as well just use Go which does this more naturally. Single-file Python executables tend to be huge and slow to start up, not a big deal for non-interactive server processes, but miserable for CLIs.
- bitwize 6y agoConsider trying a Lisp-like scripting language such as Guile. Back in the late 90s I found Perl reprehensible and avoided it unless I had to use it. Guile became my Perl. I managed entire web sites with it.