My favorite library for this is docopt[0], which parses the docstring at the top of your script. It’s a lot easier for people reading your code to see the usage up front rather than scrolling to the bottom and finding your main() and reading the argparse calls: #!/usr/bin/env python3 “”” Usage: ./myscript.py [ ] “”” from docopt import docopt if __name__ == ‘__main__’: args = docopt(__doc__) print(args[‘ ’], args[‘ ’]…
I do concede that click may be better for CLI apps that grow to tens of thousands of LOC and involve multiple full-time developers. I've never built one that big though.
I also worry a bit that docopt doesn't seem to have gotten much attention in a while. It's basically complete, so shouldn't matter, but still.