skillfed

argdantic

Typed command line interfaces with argparse and pydantic

argdantic v1.3.3 120.3K downloads/30d#12,036 on PyPI
Permissive license DORMANT released

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 argdantic

uv

uv add argdantic

poetry

poetry add argdantic

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software DevelopmentTyping :: Typed

Tags

typed CLI with pydanticargparse type validationcommand line interface buildernested CLI commandspydantic CLI parser
cli-buildertype-safe

More Software Development packages