Skip to content

FEAT: add Tombi as default TOML formatter - #654

Merged
redeboer merged 36 commits into
mainfrom
ENH/tombi
Jul 15, 2026
Merged

FEAT: add Tombi as default TOML formatter#654
redeboer merged 36 commits into
mainfrom
ENH/tombi

Conversation

@redeboer

@redeboer redeboer commented Jul 14, 2026

Copy link
Copy Markdown
Member

✨ New features

  • Add Tombi as the default TOML formatter and linter, replacing Taplo and toml-sort. The check-dev-files format command now installs the tombi-format and tombi-lint pre-commit hooks, writes a [tool.tombi] configuration to pyproject.toml, and recommends the tombi-toml.tombi VS Code extension.
  • Add a --toml-formatter option (taplo or tombi, default tombi) so a repository can opt back into the previous Taplo + toml-sort setup.
  • Generate a JSON Schema (compwa-policy.schema.json) for the public [tool.compwa.policy] configuration table and associate it through Tombi's [[tool.tombi.schemas]], so the policy config is validated and documented in the editor. The schema is regenerated by self-check.
  • Embed the Settings field docstrings into the generated schema (via use_attribute_docstrings), so each policy option carries an inline description.
  • Add a --tombi-errors-on-warnings option (default on) that runs tombi-lint with --error-on-warnings.

⚙️ Enhancements

  • Run check-dev-files (and self-check) before the formatter hooks in the sorted .pre-commit-config.yaml, so generated files are formatted in the same pass.
  • Split the Poe upgrade task into upgrade-precommit, upgrade-uv, and upgrade-pixi helper tasks referenced from the parallel task.
  • Define CLI option types through typing.Literal instead of Enum.
  • Drop the more-itertools dependency and use itertools.pairwise (Python 3.10 is the minimum version).
  • Standardize TOML array formatting through to_toml_array() and stop enforcing single-line arrays.

⚠️ Interface changes

The Literal type aliases for policy options were consolidated into compwa_policy.config:

Old name New name
compwa_policy.github.upgrade_lock.Frequency compwa_policy.config.UpgradeFrequency
compwa_policy.env.conda.PackageManagerChoice compwa_policy.config.PackageManagerChoice
compwa_policy.python.ty.TypeChecker compwa_policy.config.TypeChecker

❗ Behavioral changes

  • New repositories are configured with Tombi instead of Taplo + toml-sort by default; running the policy migrates existing repositories (removing taplo/toml-sort hooks, .taplo.toml, and [tool.tomlsort]).
  • tombi-lint treats warnings as errors by default.
  • Lock files (uv.lock) and other manifest files (Cargo.toml, Manifest.toml, Project.toml, labels*.toml) are excluded from Tombi formatting.
  • The Ruff flake8-builtins setting is written under the renamed ignorelist key instead of builtins-ignorelist.

Squash commit messages

* BEHAVIOR: treat Tombi warnings as errors by default
* BREAK: remove `Frequency` type alias
* DOC: embed docstrings in JSON schema
* ENH: define options through `Literal` instead of `Enum`
* ENH: do not enforce non-multiline array
* ENH: exclude lock files from being formatted with Tombi
* ENH: run `check-dev-files` before formatters
* ENH: standardize formatting with `to_toml_array()`
* FEAT: generate JSON schema for `[tool.compwa.policy]`
* FEAT: implement `--toml-formatter` argument
* FEAT: implement `tombi-lint` pre-commit hook
* FEAT: implement warnings as errors for Tombi
* FIX: remove outdated Sphinx target remappings
* FIX: run `tombi-format` on GitHub CI
* MAINT: remove `more_itertools`
* MAINT: remove `PackageManagerChoice` from `conda` module
* MAINT: rename `builtins-ignorelist` to `ignorelist`

@redeboer redeboer added this to the 0.9.0 milestone Jul 14, 2026
@redeboer redeboer self-assigned this Jul 14, 2026
@redeboer redeboer added the ⚙️ Enhancement Improvements and optimizations of existing features label Jul 14, 2026
@redeboer redeboer changed the title ENH: switch to Tombi as TOML formatter FEAT: add Tombi as default TOML formatter Jul 14, 2026
@redeboer redeboer added 📝 Docs Improvements or additions to documentation ⚠️ Interface Breaking changes to the API ✨ Feature New feature added to the package 🔨 Maintenance Maintenance and upkeep improvements 🖱️ DX Improvements to the Developer Experience ❗ Behavior Changes that may affect the framework output and removed 🔨 Maintenance Maintenance and upkeep improvements 🖱️ DX Improvements to the Developer Experience ⚠️ Interface Breaking changes to the API labels Jul 14, 2026
@redeboer
redeboer marked this pull request as ready for review July 15, 2026 12:23
@redeboer
redeboer merged commit 04c19ad into main Jul 15, 2026
32 checks passed
@redeboer
redeboer deleted the ENH/tombi branch July 15, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

❗ Behavior Changes that may affect the framework output 📝 Docs Improvements or additions to documentation ⚙️ Enhancement Improvements and optimizations of existing features ✨ Feature New feature added to the package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Switch to Tombi as TOML formatter and linter Merge developer configurations into pyproject.toml

1 participant