skillfed

prime-pydantic-config

Pydantic-driven CLI with TOML/YAML config file support for ML

prime-pydantic-config v0.4.2 344.2K downloads/30d#7,377 on PyPI3
License unclear Active released

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-config

uv

uv add prime-pydantic-config

poetry

poetry add prime-pydantic-config

Installing 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

pydantic cli config parsertoml yaml json config loadercommand line argument pydanticconfig file cli mergenested config groups clipydantic basemodel cli
cli-builderconfig-managementml-training

More Application Frameworks packages