Configuration

Configuration#

Instead of repeating the same flags under args: in every .pre-commit-config.yaml, a repository can declare its options once in a [tool.compwa.policy] table in pyproject.toml. Each option is resolved with the following precedence (first match wins):

  1. the option explicitly passed on the command line (for example, under args:);

  2. the [tool.compwa.policy] table in pyproject.toml;

  3. the built-in default.

The table mirrors the subcommand tree. Shared options live at the top level, while subcommand-specific options live in nested tables. The following copyable example is generated from the settings schema and shows every built-in default. Hover over an option to see what it does:

pyproject.toml#
[tool.compwa.policy]
dev-python-version = "3.13"
doc-apt-packages = ""
no-ruff = false
package-manager = "uv"
pytest-single-threaded = false
repo-name = ""
repo-organization = "ComPWA"
repo-title = ""

[tool.compwa.policy.format]
no-cspell-update = false
tombi-errors-on-warnings = true
toml-formatter = "tombi"

[tool.compwa.policy.github]
allow-deprecated-workflows = false
allow-labels = false
ci-skipped-tests = ""
github-pages = false
keep-pr-linting = false
keep-workflow = []
macos-python-version = "3.10"
no-cd = false
no-github-actions = false
no-milestones = false
no-pypi = false
no-version-branches = false
upgrade-frequency = "quarterly"

[tool.compwa.policy.nb]
allowed-cell-metadata = ""
excluded-dependencies = []
no-binder = false

[tool.compwa.policy.python]
allow-vscode-coverage-gutters = false
branch-coverage = true
excluded-python-versions = ""
imports-on-top = false
type-checker = []

[tool.compwa.policy.repo]
gitpod = false
keep-issue-templates = false

[tool.compwa.policy.setup]
keep-contributing-md = false

The env subcommand maps to the setup table. Environment variables can be added as key-value pairs under [tool.compwa.policy.setup.env].

Both the native TOML form (arrays, tables, booleans) and the legacy command-line string form ("mypy,pyright", "A=1,B=2") are accepted, so an existing args: list can be moved into pyproject.toml verbatim.