argdantic
Typed command line interfaces with argparse and pydantic
What it is and what it does
argdantic is a thin wrapper around argparse that uses pydantic models to define and validate command-line arguments. Instead of manually wiring up argument parsing and validation, you decorate functions with type hints and pydantic models, and argdantic automatically generates a CLI with help text, type checking, and field validation. It supports nested pydantic models for complex argument structures and nested commands for building hierarchical CLIs.
The package integrates with pydantic's settings system to pull arguments from multiple sources—environment variables, .env files, JSON, YAML, and TOML—without additional boilerplate. It targets developers who want modern, type-safe CLIs without the verbosity of manual argparse setup, and works across Python 3.8 through 3.12.
Use it for:
- Build a typed CLI tool where arguments are validated as pydantic models before your function runs
- Create nested command hierarchies (subcommands) with shared argument validation logic
- Load CLI arguments from environment variables or config files alongside command-line flags
- Enforce argument types and constraints at parse time, catching errors before your code runs
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Builds typed command-line interfaces by combining argparse with pydantic models, enabling automatic validation and nested command hierarchies from Python type hints.
Yes, if you are building a CLI and want pydantic's validation without manual argparse wiring. The low install friction and permissive license make it a safe choice. However, the 581-day dormancy means you should verify compatibility with your target pydantic version and Python release before committing to a production tool; consider pinning the version if you adopt it.
Install
argdantic on PyPI
pip
pip install argdanticuv
uv add argdanticpoetry
poetry add argdanticInstalling argdantic
Before you install
Low friction install with only pydantic and pydantic-settings as runtime dependencies. Package is dormant (581 days since last release) but was actively maintained through early 2025.
License in practice
MIT license (permissive) means you can use, modify, and distribute this package freely in both open-source and commercial projects with minimal restrictions.
Quickstart
pip install argdantic
from argdantic import ArgParser
parser = ArgParser()
@parser.command()
def greet(name: str, count: int = 1):
for _ in range(count):
print(f"Hello {name}")
if __name__ == "__main__":
parser()
Verify before relying
- Whether the 581-day dormancy affects compatibility with recent pydantic versions or Python releases
- Availability and completeness of documentation at the project homepage
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — pydantic, pydantic-settings |
| Maintenance | dormant — 581 days since the last release |
| First released | |
| Downloads | 120,288/month — #12,036 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: argdantic-1.3.3-py2.py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
pydantic-argparseGenerates command-line argument parsers from…
permissive · top 5,000 on PyPI
prime-pydantic-configBuilds a command-line interface from Pydantic…
unclear · top 15,000 on PyPI
arguablyConverts Python functions and their docstrings…
unclear · top 15,000 on PyPI
arghArgh turns plain Python functions into…
copyleft · top 5,000 on PyPI
simple-parsingTransforms argparse scripts into structured,…
permissive · top 5,000 on PyPI
typed-argument-parserA typed, modern replacement for Python's…
permissive · top 15,000 on PyPI
faceFace is a command-line application framework…
unclear · top 1,000 on PyPI
decliDecli wraps argparse to let you define…
permissive · top 5,000 on PyPI
targGenerates a command-line interface from…
permissive · top 15,000 on PyPI
logmuseAdds standard CLI logging options…
permissive · top 15,000 on PyPI