prime-pydantic-config
Pydantic-driven CLI with TOML/YAML config file support for ML
What it is and what it does
prime-pydantic-config wraps Pydantic models to generate a CLI that accepts configuration from files (TOML, YAML, JSON) and command-line arguments, with file values as defaults and CLI args taking precedence. It handles nested config groups via dotted paths, boolean flags with negation, lists, dicts, optional sub-configs, discriminated unions, and validation aliases—all with auto-generated help text sourced from field descriptions and docstrings.
The package is designed for ML training scripts and similar applications where configuration needs to be flexible, composable, and human-readable. It depends only on pydantic and offers optional extras for TOML and YAML parsing. The CLI is built directly from your Pydantic model definition, so no separate schema or argument parser code is needed.
Use it for:
- Configure ML training scripts with nested groups (model, data, optimizer) via CLI, TOML, or YAML files.
- Load a base config from a file and override specific fields from the command line without re-specifying unchanged values.
- Support multiple config variants (e.g., different optimizers) using discriminated unions, switchable by a CLI flag.
- Migrate legacy config keys to new paths transparently using Pydantic validators, keeping old CLI flags working.
- Generate self-documenting help text from Pydantic field descriptions and model docstrings without manual flag definitions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Builds a command-line interface from Pydantic models, loading and merging configuration from TOML, YAML, or JSON files with CLI argument overrides.
Yes, with caution. The package solves a real problem—bridging Pydantic models and CLI/file-based config—with a clean API and low install friction. However, it is very new, has minimal adoption, and lacks a declared license. Use it for internal or experimental projects; verify the license and test thoroughly before production deployment.
Install
prime-pydantic-config on PyPI
pip
pip install prime-pydantic-configuv
uv add prime-pydantic-configpoetry
poetry add prime-pydantic-configInstalling prime-pydantic-config
Before you install
Low friction; pure Python wheel with only pydantic as a runtime dependency. Active maintenance with recent releases.
License in practice
License status is unclear—no SPDX identifier or raw license text is available. Verify the repository's license before adopting in proprietary or restricted contexts.
Quickstart
pip install prime-pydantic-config
from prime_pydantic_config import cli, BaseConfig
class Config(BaseConfig):
lr: float = 1e-4
batch_size: int = 32
config = cli(Config)
Requires Python >=3.10. Optional TOML and YAML support requires extras installation.
Verify before relying
- Whether the package is production-ready given its recent first release and low repository star count.
- Exact scope of TOML and YAML support and whether they require external dependencies when installed via extras.
- Whether discriminated unions and validation aliases work as documented with all Pydantic versions.
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pydantic |
| Maintenance | actively maintained — 25 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 344,221/month — #7,377 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: prime_pydantic_config-0.4.2-py3-none-any.whl
Tags
More Application Frameworks packages
FastAPI 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
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
pylint-pydanticA Pylint plugin that extends Pylint's…
copyleft · top 5,000 on PyPI
config-parserMerges configuration from YAML/JSON files,…
agpl · top 5,000 on PyPI
pydantic-compatProvides compatibility mixins and adapters to…
permissive · top 15,000 on PyPI
argdanticBuilds typed command-line interfaces by…
permissive · top 15,000 on PyPI
pydantic-argparseGenerates command-line argument parsers from…
permissive · top 5,000 on PyPI
bump-pydanticA CLI tool that automatically refactors…
permissive · top 15,000 on PyPI
pydantic_yamlPydantic-YAML adds YAML serialization and…
permissive · top 5,000 on PyPI
pydantic_corepydantic-core provides the high-performance…
permissive · top 100 on PyPI
pyaml-envParses YAML configuration files and resolves…
permissive · top 15,000 on PyPI
datacontract-specificationReads and writes YAML files conforming to the…
permissive · top 5,000 on PyPI