Question

What is the python alternative to Thor for building self-documenting command line utilities?

UPDATE: The click is the closest equivalent of Thor for python, see http://click.pocoo.org/

Was it helpful?

Solution

Python offers natively (via standard library) two packages to create auto-documenting interfaces for command line tools: optparse and argparse.

The docs says that optparse is deprecated and argparse replaces it, maintaining some backward compatibility where possible. Though, argparse is not so easy to use and 3rd-party libraries have been created.

Have a look at docopt and the video about it. cliff is another possibility.

To write line-oriented command interpreters you can find useful the Python cmd module.

I finally want to point out that docopt and cliff are not the Python alternative/s as you asked, but just the couple I found.

OTHER TIPS

Not sure that this is exactly what you want, but imho it is Sphinx + python docstring + argparse.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top