Validate TOML syntax, run lint checks, compare files, and inspect structure. Supports pyproject.toml, Cargo.toml, and any TOML config.
# 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
python3 scripts/toml_lint.py diff config-prod.toml config-staging.toml
# 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
python3 scripts/toml_lint.py types Cargo.toml
python3 scripts/toml_lint.py -f json validate config.toml
python3 scripts/toml_lint.py -f markdown diff a.toml b.toml
| Check | Level | Description |
|---|---|---|
| ------- | ------- | ------------- |
| Empty strings | Warning | String values that are blank |
| Empty tables | Warning | Tables with no keys |
| Mixed-type arrays | Warning | Arrays containing different types |
| Empty arrays | Info | Arrays with no elements |
| Spaced keys | Info | Keys containing spaces (valid but unusual) |
| Long strings | Info | String values exceeding 1000 chars |
tomllib in stdlib)pip install tomli for Python 3.10 and below共 1 个版本