skillfed

typed-argument-parser

Typed Argument Parser

typed-argument-parser v1.12.0 313.9K downloads/30d#7,709 on PyPI629
Permissive license MIT Active released

What it is and what it does

typed-argument-parser replaces Python's built-in argparse with a class-based, type-hinted approach where you define command-line arguments as typed class attributes instead of calling add_argument repeatedly. It automatically generates help text from inline comments, validates types at parse time, and integrates with IDEs for code completion and type checking. The package also includes tapify, a decorator that automatically parses command-line arguments to call functions or initialize classes.

Under the hood, typed-argument-parser is a wrapper around argparse that translates your class definition into the equivalent argparse configuration. It supports standard argument types (str, int, float, bool, Optional, List, Set, Tuple, Literal, Union), positional arguments, subparsers, and argument post-processing via a configure method. The single runtime dependency is docstring-parser, which extracts help text from your comments.

Use it for:

  • Build a CLI tool where type hints serve as both documentation and runtime validation without repeating type declarations.
  • Migrate from argparse to gain IDE autocomplete and static type checking on parsed arguments.
  • Use tapify to quickly expose a Python function as a command-line tool with automatic argument parsing.
  • Define reusable argument templates by subclassing and inheriting argument definitions across multiple CLI tools.
  • Save and load argument configurations to/from files or dictionaries for reproducible runs and experiment tracking.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A typed, modern replacement for Python's argparse that uses class attributes and type hints to define command-line arguments with static type checking and IDE code completion support.

Yes. typed-argument-parser is worth installing if you write CLI tools in Python and want type safety, IDE support, and cleaner code than argparse. It has low install friction, active maintenance, no known vulnerabilities, a permissive MIT license, and requires only one runtime dependency. The main constraint is Python 3.10+, which is reasonable for new projects.

Install

typed-argument-parser on PyPI

pip

pip install typed-argument-parser

uv

uv add typed-argument-parser

poetry

poetry add typed-argument-parser

Installing typed-argument-parser

Before you install

Low friction install with a single runtime dependency (docstring-parser). The package is actively maintained with a recent release (139 days ago) and requires Python 3.10 or later.

License in practice

MIT license is permissive, allowing use in commercial and private projects with minimal restrictions—you only need to include the license text in distributions.

Quickstart

pip install typed-argument-parser

from typed_argument_parser import Tap

class MyArgs(Tap):
    name: str
    count: int = 1

args = MyArgs().parse_args()
print(f'{args.name} x {args.count}')

Requires Python 3.10 or later.

Verify before relying

  • Whether tapify works with all standard Python callables or has edge cases.
  • Performance characteristics compared to argparse for large argument sets.
  • Whether subparser and advanced argparse features are fully supported or have limitations.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 1 — docstring-parser
Maintenance actively maintained — 139 days since the last release
Last repo commit
First released
Downloads 313,913/month — #7,709 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: typed_argument_parser-1.12.0-py3-none-any.whl

Keywords: typing, argument parser, python

Operating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Typing :: Typed

Tags

typed command line argument parserargparse with type hintspython cli argument parsingstatic type checking climodern argument parser pythondataclass-style argument parserIDE autocomplete command line
cli-frameworktype-hintsargparse-alternative

More Software Development packages