CLIs with Argparse or Click#

You can generate command line interfaces based on your settings classes.

Typed Settings generates a CLI argument for each option of your settings and passes an instances of these settings to your CLI function. This lets the users of your application override settings loaded from other sources (like config files).

Argparse or Click?#

Argparse is a standard library module. It is easy to get started with it, but you also notice the age of the API. More modern libraries like Click make it easier to handle complex data types and create command line apps with sub commands.

You can use argparse if you just want to create a simple CLI without adding extra dependencies.

"--help" output of an "argparse" based Typed Settings CLI "--help" output of an "argparse" based Typed Settings CLI

If you want to build a larger, more complex application, Click maybe more appropriate.

"--help" output of a "Click" based Typed Settings CLI "--help" output of a "Click" based Typed Settings CLI

Wich rich-click you can also make Click CLIs quite fancy.

"--help" output of a "Click" based Typed Settings CLI with "rich-click" styling "--help" output of a "Click" based Typed Settings CLI with "rich-click" styling

But the most important thing is: choose the framework you feel most comfortable with.