argparse vs Click vs Typer: Python CLI Libraries Compared
argparse vs Click vs Typer compared with the same example in each: setup, subcommands, type handling and help output, and which to choose for your CLI.
Use argparse for small scripts, Click for larger command-line tools, and Typer if you want type hints to define the interface. All three generate --help output and handle parsing, and Typer grew out of Click, so the real choice is between standard-library simplicity and less boilerplate.
The same CLI three ways
A tool that greets someone a number of times:
argparse
import argparse
parser = argparse.ArgumentParser(description="Greet someone")
parser.add_argument("name")
parser.add_argument("--count", type=int, default=1)
args = parser.parse_args()
for _ in range(args.count):
print(f"Hello {args.name}")Click
import click
@click.command()
@click.argument("name")
@click.option("--count", default=1, help="Number of greetings")
def hello(name, count):
for _ in range(count):
click.echo(f"Hello {name}")
if __name__ == "__main__":
hello()Typer
import typer
def hello(name: str, count: int = 1):
for _ in range(count):
print(f"Hello {name}")
if __name__ == "__main__":
typer.run(hello)In Typer the function signature is the interface: name is a required argument, count is an option with a default, and the types drive validation. The three examples were run as written on Python 3.14 with Click 8.5.1 and Typer 0.29.1 (17 November 2026): each prints Hello Ada twice for Ada --count 2, and each rejects --count x, with argparse saying invalid int value: 'x', Click 'x' is not a valid integer and Typer Input should be a valid integer. Typer’s error and --help output are drawn with rich, which installs with Typer.
At a glance
| argparse | Click | Typer | |
|---|---|---|---|
| Install | Built in | pip install click |
pip install typer |
| Style | Imperative parser calls | Decorators | Type hints |
| Subcommands | Subparsers | @group.command() |
app.command() |
| Boilerplate | Most | Moderate | Least |
| Built on | Standard library | Standalone | Began on Click; bundles a copy since 0.26.0 |
When each fits
- argparse: one-off scripts, tools that must have no dependencies, or code in the standard library itself.
- Click: applications with several subcommands, plugins or lots of options, where explicit decorators read well.
- Typer: new tools where you already use type annotations, and you want shell completion and rich help with little code.
Subcommands
With argparse, subcommands use add_subparsers. In Click you create a @click.group() and attach commands. In Typer you create an app = typer.Typer() and register functions with @app.command(). Both of the latter read closer to the structure of the program than argparse’s setup calls.
Related reading
For a detailed head-to-head of the two third-party options, see Click vs Typer; the library pages are Click and Typer. To show rich output in a CLI, see what Rich is, and to ship it as an installable command, see pipx vs uv tool.
Frequently Asked Questions
Should I use argparse, Click or Typer?
Use argparse for small scripts or when you cannot add a dependency, Click for larger command-line apps with many subcommands, and Typer if you like type hints driving your interface. Typer began as a layer over Click and now bundles its own copy of Click’s source.
Is Typer built on Click?
It began as a layer over Click, but since version 0.26.0 (26 May 2026) Typer bundles its own copy of Click’s source instead of depending on Click. You still get a Click-style command-line interface driven by Python type hints.
Is argparse good enough?
Yes for many tools. It is in the standard library, so there is nothing to install, and it handles arguments, options, subcommands and generated help. It becomes verbose as the interface grows.
Which is best for subcommands like git commit?
Click and Typer make nested subcommands easy with decorators or app.command. argparse supports them through subparsers, with more boilerplate.
How do I choose between Click and Typer?
See the dedicated Click vs Typer comparison. In short, Typer needs less code if you already use type hints, and Click gives more explicit control.