Similar projects

Obviously, Argh is not the only CLI helper library in the Python world. It was created when some similar solutions already existed; more appeared later on. There are valid reasons behind maintaining most projects.

The list below is nowhere near exhausting; certain items are yet to be reviewed; the comments should have been more structured. However, it gives a picture of the alternatives.

Ideally, we’d need a table with the following columns: supports argparse; has integrated parser; requires subclassing; supports nested commands; is bound to an unrelated piece of software; involves “magic” (i.e. undermines clarity); depends on outdated libraries; has simple API; has unobtrusive API; supports Python3. Not every “yes” in this table would count as pro.

  • argdeclare requires additional classes and lacks support for nested commands.

  • argparse-cli requires additional classes.

  • django-boss seems to lack support for nested commands and is strictly Django-specific.

  • entrypoint is lightweight but involves a lot of magic and seems to lack support for nested commands.

  • opster and finaloption support nested commands but are based on the outdated optparse library and therefore reimplement some features available in argparse. They also introduce decorators that don’t just decorate functions but change their behaviour, which is a questionable practice.

  • simpleopt has an odd API and is rather a simple replacement for standard libraries than an extension.

  • opterator is based on the outdated optparse and does not support nested commands.

  • clap ships with its own parser and therefore is incompatible with clap-agnostic code.

  • plac is a very powerful alternative to argparse. I’m not sure if it’s worth migrating but it is surely very flexible and easy to use.

  • baker

  • plumbum

  • docopt takes an inverted approach: you write the usage docs, it generates a parser. Then you need to wire the parsing results into you code manually.

  • aaargh

  • cliff

  • cement

  • autocommand

  • click is a rather popular library, a bit younger than Argh. The authors of both libraries even gave lightning talks on a PyCon within a few minutes :) Although I expected it to kill Argh because it comes with Flask, in fact it takes an approach so different from Argh that they can coexist. Like Opster, Click’s decorator replaces the underlying function (a questionable practice); it does not derive the CLI arguments from the function signature but entirely relies on additional decorators, while Argh strives for the opposite.