Repository navigation
chore(scripts): read tooling configuration with tomllib - #813
Conversation
Parse dependency groups, optional extras, Ruff scope and Python classifiers structurally for #763. Cover exact pins with extras, duplicate and ranged pins, malformed groups and valid TOML formatting.
There was a problem hiding this comment.
🟡 Changes recommended
Exact pins with valid whitespace are rejected, and several tests remain coupled to current pin versions.
2 open findings
What changed in this PR
Replaces regex-based pyproject.toml inspection with structured tomllib parsing for repository tooling checks.
Changes:
- Parses dependency groups, extras, Ruff scope, and classifiers structurally.
- Adds exact-pin validation supporting requirement extras.
- Expands parser and invalid-configuration tests.
| File | Description |
|---|---|
scripts/check_tool_versions.py |
Implements TOML-based tooling validation. |
test/test_tool_versions.py |
Adds parser and pin-validation coverage. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Review status: complete for head Development route: standalone Codex. Copilot submitted a substantive COMMENTED review on Local focused validation: 30 passed, 1 environment-dependent test deselected; Ruff check and format, direct configuration check and diff check passed. Final-head PR CI is green, including repo-tests, integration, matrix-result, lint, typecheck and security checks. The full repository test command and pinned-tool environment check did not run locally because dependencies could not be installed; CI supplied the required repository-test evidence. No blocking findings or unresolved threads remain. |

Summary
Read
pyproject.tomlthrough Python 3.11'stomllibinscripts/check_tool_versions.py. Dependency groups, published extras, Ruff scope and Python classifiers now use parsed TOML data. Exact Ruff/Mypy pin validation accepts requirement extras and still rejects missing, ranged or duplicate declarations. Other tooling checks are unchanged.Scope
Only
scripts/check_tool_versions.pyandtest/test_tool_versions.pychange. The tests cover valid TOML formatting, extras, duplicate and ranged pins, missing or incorrectly typed dependency groups, unbounded Alembic requirements, valid dependency-group includes, and the existing drift checks. Exact pin tests now derive their versions from the current configuration. This PR has no file overlap with open PRs #811 and #812.Validation
pytest --noconftest test/test_tool_versions.py -q -k 'not active_environment_agree': 30 passed, 1 deselected.ruff check scripts/check_tool_versions.py test/test_tool_versions.py: passed.ruff format --check scripts/check_tool_versions.py test/test_tool_versions.py: passed.python3.11 -c 'from pathlib import Path; from scripts.check_tool_versions import check, declared_pins; print(declared_pins(Path.cwd())); print(check(Path.cwd()))': returned the current pins and[].git diff --check: passed.pytest test/ -m repocould not start locally because SQLAlchemy is not installed; creating a fresh environment was blocked by a PyPI connection error. The direct CLI ran and reported the host's existing Ruff/Mypy versions differ from the repository pins. CI must provide the full repo-test and pinned-environment evidence.Docs: not needed - this changes only an internal developer-tool parser and preserves the existing configuration policy and public behavior.
Closes #763