Skip to content

dev: format pyproject.toml with taplo - #4215

Open
oresttokovenko wants to merge 12 commits into
apache:mainfrom
oresttokovenko:taplo-pyproject-schema
Open

oresttokovenko wants to merge 12 commits into
apache:mainfrom
oresttokovenko:taplo-pyproject-schema

Conversation

@oresttokovenko

@oresttokovenko oresttokovenko commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What

Add a pyproject nox session that checks pyproject.toml formatting with taplo, and reformat the file once with the tool's defaults: two-space indentation, and one entry per line in multi-line arrays

Why

Formatting pyproject.toml it keeps future diffs small and puts the file under the same gate as the code

Tests

There is no change to the logic

this PR is Stacked on #4208

@oresttokovenko oresttokovenko changed the title dev: validate pyproject.toml against its schema dev: format pyproject.toml with taplo Oct 30, 2026
@rambleraptor

Copy link
Copy Markdown
Collaborator

The CI failures will be fixed by #4216

The Makefile, the pre-commit config, and the CI workflows each described
the same checks in their own way, and tool versions were pinned in two of
them. One noxfile now holds the sessions, the justfile names them, and CI
runs the same sessions a developer runs locally.
The sdist carries no .gitignore, and release verification loads the
noxfile from an unpacked sdist, so the read must tolerate its absence.
The justfile is a convenience for local runs. CI has no reason to install
a task runner to reach the sessions it already names.
`uv run` syncs the project environment on demand, and the test and
coverage sessions build their own environments from uv.lock, so the
explicit install only synced the extras a second time.
The wrapper named every member after the string it held, and only two of
the six reached a call site, so it added a lookup without removing a
literal.
Those files are not new: the Makefile ran coverage with --parallel-mode
as well, and noxfile's clean session still removes them.
coverage already reads [tool.coverage.run] source from pyproject.toml, so
the session stops repeating --source, and the 85 default moves next to it
as [tool.coverage.report] fail_under. COVERAGE_FAIL_UNDER still overrides
it, because the integration job accepts lower coverage than the unit suite.
mypy finds the config file on its own, so --config-file was redundant, and --scripts-are-modules is a setting rather than an invocation choice.
pyproject.toml configures every tool here, and a wrong type only surfaces when a tool fails to read it. taplo checks it against the SchemaStore schema, driven by .taplo.toml because taplo does not read its settings from pyproject.toml.
taplo has no support for [tool.taplo] yet (tamasfe/taplo#603), so a .taplo.toml existed only to hold one URL. --schema does the same job and leaves no extra file.
The file is edited often and had drifted between two and four space indentation. taplo's defaults are two spaces and one entry per line, so the session needs no configuration of its own.
The session is a gate, so it should say whether the file is formatted. Rewriting is left to whoever is editing, which is how the other checks in this repository behave under --check.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants