--- id: pydantic-argparse version: "0.10.0" license: MIT license_treatment: permissive maintenance: active --- # pydantic-argparse — Typed Argument Parsing with Pydantic License: permissive · Maintenance: active · Downloads: 1.2M/mo ## 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 above — 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 pip install pydantic-argparse uv add pydantic-argparse poetry add pydantic-argparse ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 1.2M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags pydantic argparse integration, typed command line arguments, cli parser from pydantic model, argument parsing with validation, pydantic-based cli tool, automatic help text generation, typed argument validation, cli-builder, pydantic-integration [View on SkillFed](https://skillfed.io/packages/pydantic-argparse) · [View on PyPI](https://pypi.org/project/pydantic-argparse/)