Screwtape

Screwtape at

For a Python script parsing command-line arguments, it seems there's only a few candidates:
  • "optparse" in the standard library, which is quite limited, and besides which was removed in Python 3
  • "argparse" in the standard library, which is pretty flexible, but which produces weird, un-intuitive "--help" output if you have subcommands.
  • "docopt", which generates a parser from "--help" output, but traditional "--help" output glosses over a lot of details that I want to specify, like which options are valid with which commands.
  • "click", which seems to support all the features I need and produce the pretty output I want, but it's a framework that takes over your program rather than a library you call into, and I find that kind of API endlessly frustrating.
This makes me a sad panda.
Argparse is definitely not great with subcommands, but that's the one I've settled on. I would like to try click sometime, but the framework thing is a barrier. I also would like to try Google's "fire" at some point to see where it might be appropriate to use: https://github.com/google/python-fire

Charles Stanhope at 2017-05-26T17:19:48Z

Oooh, I think I'd heard about Fire, but I'd forgotten. Thanks for reminding me!

Screwtape at 2017-05-27T01:26:49Z