pydantic-argparse
Typed Argument Parsing with Pydantic
What it is and what it does
Pydantic Argparse bridges Pydantic models and command-line argument parsing by automatically generating argument parsers from your model definitions. Instead of manually writing argparse code with separate type hints and validation, you define a Pydantic BaseModel with fields and their descriptions, and the package generates a fully-featured CLI parser that enforces types, provides help text, and handles aliases—all derived from your model schema.
The package is useful when you want CLI tools to have the same validation and type safety as your application code. It reduces boilerplate by eliminating the need to duplicate type information between your Pydantic models and argparse setup, and it automatically generates help output that matches your field descriptions.
Use it for:
- Build CLI tools where argument types and validation rules are already defined in Pydantic models
- Generate help text and argument documentation automatically from model field descriptions
- Enforce type validation on command-line inputs without manual argparse configuration
- Create tools with required and optional arguments, flags, and aliases all specified in a single model
- Reduce boilerplate when multiple CLI scripts share the same argument structure
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates command-line argument parsers from Pydantic models, automatically handling type validation, help text, and argument aliases based on your model definition.
Yes. The package has low install friction, active maintenance, no known vulnerabilities, and a permissive MIT license. It solves a genuine problem—eliminating duplication between Pydantic models and argparse setup—and is well-suited for projects already using Pydantic. Verify Pydantic v2 compatibility if your project uses v2.
Install
pydantic-argparse on PyPI
pip
pip install pydantic-argparseuv
uv add pydantic-argparsepoetry
poetry add pydantic-argparseInstalling pydantic-argparse
Before you install
Low install friction with a single runtime dependency on pydantic. The package is actively maintained with recent commits and has been in development since 2021, supporting current Python versions from 3.8 onwards.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal obligations.
Quickstart
pip install pydantic-argparse
import pydantic.v1 as pydantic
import pydantic_argparse
class Arguments(pydantic.BaseModel):
name: str = pydantic.Field(description="Your name")
parser = pydantic_argparse.ArgumentParser(model=Arguments)
args = parser.parse_typed_args()
print(args)
Requires Python 3.8+ and is compatible with the Pydantic v1 API.
Verify before relying
- Compatibility with Pydantic v2 (description mentions v1 API compatibility but v2 support status unclear)
- Performance characteristics with large or deeply nested model hierarchies
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pydantic |
| Maintenance | actively maintained — 551 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,153,548/month — #4,292 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pydantic_argparse-0.10.0-py3-none-any.whl
Keywords: argparse, pydantic, python, typed, validation
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
argdanticBuilds typed command-line interfaces by…
permissive · top 15,000 on PyPI
argparseProvides command-line argument parsing for…
permissive · top 1,000 on PyPI
argparse-addonsProvides additional type validators and action…
permissive · top 5,000 on PyPI
placPlac generates command-line interfaces from…
permissive · top 5,000 on PyPI
autocommandAutocommand converts a Python function into a…
copyleft · top 5,000 on PyPI
prime-pydantic-configBuilds a command-line interface from Pydantic…
unclear · top 15,000 on PyPI
rich-argparseFormats argparse and optparse help output with…
permissive · top 1,000 on PyPI
pylint-pydanticA Pylint plugin that extends Pylint's…
copyleft · top 5,000 on PyPI
decliDecli wraps argparse to let you define…
permissive · top 5,000 on PyPI
mandomando wraps argparse to let you build…
permissive · top 5,000 on PyPI