Validate TOML syntax, run lint checks, compare files, and inspect structure. Supports pyproject.toml, Cargo.toml, and any TOML config.
bash
# Basic syntax check
python3 scripts/toml_lint.py validate config.toml
# With lint checks (empty values, mixed arrays, etc.)
python3 scripts/toml_lint.py validate --lint pyproject.toml Cargo.toml
bash
python3 scripts/toml_lint.py diff config-prod.toml config-staging.toml
bash
# Pretty-print entire file
python3 scripts/toml_lint.py show pyproject.toml
# Extract specific key
python3 scripts/toml_lint.py show pyproject.toml --key tool.poetry.version
bash
python3 scripts/toml_lint.py types Cargo.toml
bash
python3 scripts/toml_lint.py -f json validate config.toml
python3 scripts/toml_lint.py -f markdown diff a.toml b.toml
CheckLevelDescriptionEmpty stringsWarningString values that are blankEmpty tablesWarningTables with no keysMixed-type arraysWarningArrays containing different typesEmpty arraysInfoArrays with no elementsSpaced keysInfoKeys containing spaces (valid but unusual)Long stringsInfoString values exceeding 1000 chars
tomllib in stdlib)pip install tomli for Python 3.10 and below