Python CLI libraries

Updated Nov 2026

Python CLI (command-line interface) libraries turn the arguments typed after a command into values and function calls inside a program. These libraries give scripts and developer tools the flags, subcommands, and help text that people and coding agents read to learn a command.

Popularity

Click has the most monthly downloads among the registry packages in this comparison, at 1.1B.

LibraryMonthly downloadsStarsLast releaseLicense
Click
1.1B
17.8KNov 2026BSD-3-Clause
Typer
305.5M
20.4KNov 2026MIT
Abseil
50.3M
2.5KOct 2026Apache-2.0
Cleo
44.6M
1.4KOct 2023MIT
docopt
25.1M
8.0KJun 2014MIT
Python Fire
23.9M
28.2KAug 2025Apache-2.0
ConfigArgParse
21.6M
761Nov 2026MIT
Hydra
17.7M
10.8KOct 2026MIT
Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Libraries and code examples

Click builds command-line interfaces from decorated functions. @click.command turns a function into a command, and each @click.option adds a flag with its default and help text, which Click collects into a generated help page. Commands nest inside groups to any depth, and subcommands can load lazily at runtime. An option marked with prompt asks for its value when the flag is missing.

Downloads / mo
1.1B
Stars
17.8K
Last release
8.5.1
License
BSD-3-Clause

Strengths

  • Shares context across subcommands. Let subcommands use data from their parent command.
  • Prompts for missing options. Accept supplied options or ask interactively for missing values.

Limitations

  • Fixed help layout. Click limits how far help pages can be customized, so that separately written Click commands still work together.
  • Completion needs an entry point. Shell completion works only for a script installed through an entry point, not one started with the python command.

Quickstart

From index.md
$ pip install click
import click

@click.command()
@click.option('--count', default=1, help='Number of greetings.')
@click.option('--name', prompt='Your name',
              help='The person to greet.')
def hello(count, name):
    """Simple program that greets NAME for a total of COUNT times."""
    for x in range(count):
        click.echo(f"Hello {name}!")

if __name__ == '__main__':
    hello()

Click examples

From open-source projects on GitHub
@mypyc_attr(patchable=True)
def _out(message: Optional[str] = None, nl: bool = True, **styles: Any) -> None:
    if message is not None:
        if "bold" not in styles:
            styles["bold"] = True
        message = style(message, **styles)
    echo(message, nl=nl, err=True)

Typer builds command-line interfaces from ordinary Python functions, reading each parameter's name, type, and default from the function signature. typer.run(main) turns one function into a command, and a typer.Typer() app registers several with @app.command(). Help text and shell completion come from the same declarations. The package also installs a typer command that runs a plain script as a CLI, even one that never imports Typer.

Downloads / mo
305.5M
Stars
20.4K
Last release
0.29.2
License
MIT

Strengths

  • Uses Python type hints. Declare parameter types once and receive converted command-line values.
  • Builds nested command trees. Group related commands and subcommands within the same application.

Limitations

  • Single command drops its name. An app with one command runs it without a subcommand name. Adding a callback keeps the name.
  • Bundled copy of Click. Typer includes Click's source instead of installing Click, and the maintainers plan to drop some Click features from that copy.

Quickstart

From README.md
$ uv add typer
import typer

def main(name: str):
    print(f"Hello {name}")

if __name__ == "__main__":
    typer.run(main)

Typer examples

From open-source projects on GitHub

Abseil Python (absl-py) collects Python code from Google's own code base for application startup, command-line flags, logging, and testing. app.run(main) parses the command line and then calls main. Flags are defined with functions such as flags.DEFINE_string in any module, and each one joins the command line of every program that imports that module.

Downloads / mo
50.3M
Stars
2.5K
Last release
2.5.1
License
Apache-2.0

Strengths

  • Flags across modules. A module defines its own flags, and any program that imports it accepts them.

Limitations

  • No command tree. Flags apply to the whole program. Subcommands go through the argparse_flags bridge to argparse subparsers.

Quickstart

From flags.md
$ pip install absl-py
from absl import app
from absl import flags

FLAGS = flags.FLAGS
flags.DEFINE_string('name', 'Jane Random', 'Your name.')

def main(argv):
    print('Happy Birthday', FLAGS.name)

if __name__ == '__main__':
    app.run(main)

Abseil examples

From open-source projects on GitHub
@tf_export(v1=['app.run'])
def run(main=None, argv=None):
  """Runs the program with an optional 'main' function and 'argv' list."""

  main = main or _sys.modules['__main__'].main

  _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)

Cleo builds command-line applications from command classes. Each command subclasses Command, sets its name, lists its arguments and options with the argument and option helpers, and does its work in handle. An Application holds the registered commands and runs the one named on the command line. The Poetry project maintains Cleo.

Downloads / mo
44.6M
Stars
1.4K
Last release
2.1.0
License
MIT

Strengths

  • Completion scripts included. A built-in completions command writes shell completion scripts for bash, zsh, and fish.

Limitations

  • Rewrite under way. The maintainers are rewriting Cleo for version three and ask contributors to read the plan first.

Quickstart

From README.md
$ pip install cleo
from cleo.application import Application
from cleo.commands.command import Command

class GreetCommand(Command):
    name = "greet"
    def handle(self):
        self.line("Hello")

application = Application()
application.add(GreetCommand())
application.run()

Cleo examples

From open-source projects on GitHub

docopt builds a parser from a program's help message. The usage patterns and options written in the module docstring define which commands and flags are valid, and docopt(__doc__) returns a dictionary of the values found on the command line. The program reads that dictionary and calls the matching code itself.

Downloads / mo
25.1M
Stars
8.0K
Last release
0.6.2
License
MIT

Strengths

  • Help text is the spec. Editing the usage message changes the parser.

Limitations

  • Completion is separate. Shell completion comes from the separate infi.docopt_completion project, which reads the help output.

Quickstart

From naval_fate.py
$ pip install docopt
"""Naval Fate.

Usage:
  naval_fate.py ship new <name>...
"""
from docopt import docopt

if __name__ == '__main__':
    arguments = docopt(__doc__)
    print(arguments)

docopt examples

From open-source projects on GitHub

Python Fire generates a command-line interface from any Python object. One call, fire.Fire(hello), exposes a function, and passing a class, module, or dictionary exposes its methods or entries as commands. Fire parses each argument as a Python value, such as a number, a list, or a dictionary. The same call turns existing code, including other people's, into a CLI.

Downloads / mo
23.9M
Stars
28.2K
Last release
0.7.1
License
Apache-2.0

Strengths

  • Exposes selected functions directly. Pass a command dictionary to expose only selected functions.
  • Accepts structured command-line values. Pass lists, tuples, and dictionaries as Python literals.

Limitations

  • Types come from values. Fire ignores type hints in the function signature and parses each argument from the value typed.
  • Boolean flags take the next token. A token right after a boolean flag becomes that flag's value. A separator after the last flag, or an explicit value, prevents it.

Quickstart

From README.md
$ pip install fire
import fire

def hello(name):
  return f'Hello {name}!'

if __name__ == '__main__':
  fire.Fire(hello)

Python Fire examples

From open-source projects on GitHub

ConfigArgParse extends argparse so that each option can also come from a config file or an environment variable. When a value is set in more than one place, the command line wins over environment variables, which win over config files, which win over defaults. Config files use INI or YAML style syntax, and print_values reports where each value was set. Every argparse feature carries over.

Downloads / mo
21.6M
Stars
761
Last release
1.10.1
License
MIT

Strengths

  • Help lists every source. The help message documents the environment variables and config file keys next to the flags.

Quickstart

From README.md
$ pip install ConfigArgParse
import configargparse

p = configargparse.ArgParser(default_config_files=['/etc/app/conf.d/*.conf', '~/.my_settings'])
p.add('-c', '--my-config', required=True, is_config_file=True, help='config file path')
p.add('--genome', required=True, help='path to genome file')  # this option can be set in a config file because it starts with '--'
p.add('-v', help='verbose', action='store_true')
p.add('-d', '--dbsnp', help='known variants .vcf', env_var='DBSNP_PATH')  # this option can be set in a config file because it starts with '--'
p.add('vcf', nargs='+', help='variant file(s)')

options = p.parse_args()

print(options)

ConfigArgParse examples

From open-source projects on GitHub

Hydra configures applications from YAML files combined into one configuration object. A function decorated with @hydra.main receives that object, and any value in it can be overridden from the command line with key=value. Tab completion covers configuration keys and overrides. OmegaConf, a separate library, holds the configuration.

Downloads / mo
17.7M
Stars
10.8K
Last release
1.3.8
License
MIT

Strengths

  • Composed configuration. A configuration combines files from several sources into one hierarchy.
  • Many runs in one command. Multirun launches several jobs with different arguments from a single command.

Limitations

  • One task function. @hydra.main wraps a single function. A tool with several subcommands needs another CLI library for them.

Quickstart

From simple_cli.md
$ pip install --upgrade "hydra-core>=1.3,<1.4"
from omegaconf import DictConfig, OmegaConf
import hydra

@hydra.main(version_base=None)
def my_app(cfg: DictConfig) -> None:
    print(OmegaConf.to_yaml(cfg))

if __name__ == "__main__":
    my_app()

Hydra examples

From open-source projects on GitHub

FAQ

Click and Typer cover most command-line tools: Click declares options with decorators, and Typer derives them from type hints. For a script with a few options, Python's built-in argparse needs no install. Hydra builds the command line from configuration files and lets any value be overridden with key=value.

Python Fire generates a command-line interface from any Python object with one call to fire.Fire. Passing a function makes one command, and passing a class, module, or dictionary exposes its members as commands.

Hydra is a framework for configuring applications from YAML files. A function decorated with @hydra.main receives the combined configuration, and any value in it can be overridden from the command line.

argparse ships with Python and returns the parsed values for the program to act on. Click also calls the function behind each command, nests commands inside groups, and generates help pages.

Typer reads parameter names, types, and defaults from function signatures, while Click declares each option in a decorator. Typer includes its own copy of Click's source.

docopt builds a parser from a program's help message. The usage patterns written in the module docstring define the valid commands and options, and docopt(__doc__) returns the values as a dictionary.

For coding agents

Found your CLI library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official