check-dev-files

check-dev-files#

This hook is responsible for standardizing and synchronizing the developer environment of repositories by the ComPWA organization. Coding conventions are enforced through automated checks instead of through a contribution guide. These conventions have to be regularly updated across all repositories as developer tools introduce new features and deprecate old ones.

The check-dev-files hook can also be used as a cookie cutter for new repositories by adding the following to your .pre-commit-config.yaml file:

repos:
  - repo: https://github.com/ComPWA/policy
    rev: ""
    hooks:
      - id: check-dev-files
        args:
          - --repo-name="short name for your repository"

and running

pre-commit autoupdate --repo=https://github.com/ComPWA/policy
pre-commit run check-dev-files -a

For more implementation details of this hook, check the check_dev_files module.

Hook arguments#

The check-dev-files hook can be configured with by adding any of the following flags to the args key in your .pre-commit-config.yaml file.

usage: check-dev-files [-h] [--allow-deprecated-workflows]
                       [--allowed-cell-metadata ALLOWED_CELL_METADATA]
                       [--ci-skipped-tests CI_SKIPPED_TESTS]
                       [--ci-test-extras CI_TEST_EXTRAS]
                       [--dependabot {keep,update}]
                       [--doc-apt-packages DOC_APT_PACKAGES]
                       [--environment-variables ENVIRONMENT_VARIABLES]
                       [--excluded-python-versions EXCLUDED_PYTHON_VERSIONS]
                       [--github-pages] [--gitpod] [--keep-issue-templates]
                       [--keep-pr-linting] [--imports-on-top]
                       [--outsource-pixi-to-tox] [--no-binder] [--no-cd]
                       [--no-cspell-update] [--no-github-actions]
                       [--no-milestones] [--no-python] [--allow-labels]
                       [--dev-python-version DEV_PYTHON_VERSION] [--no-macos]
                       [--no-pypi] [--no-ruff] [--no-version-branches]
                       [--package-manager {conda,none,pixi,pixi+uv,uv,venv}]
                       [--update-lock-files {no,biweekly,monthly,bimonthly,quarterly,biannually,outsource}]
                       [--pytest-single-threaded] [--repo-name REPO_NAME]
                       [--repo-organization REPO_ORGANIZATION]
                       [--repo-title REPO_TITLE]

Named Arguments#

--allow-deprecated-workflows

Allow deprecated CI workflows, such as ci-docs.yml.

Default: False

--allowed-cell-metadata

Comma-separated list of allowed metadata in Jupyter notebook cells, e.g. editable,slideshow.

Default: ''

--ci-skipped-tests

Avoid running CI test on the following Python versions

Default: ''

--ci-test-extras

Comma-separated list of extras that are required for running tests on CI

Default: ''

--dependabot

Possible choices: keep, update

Leave dependabot.yml untouched (‘keep’) or sync with ComPWA/policy

--doc-apt-packages

Comma- or space-separated list of APT packages that are required to build documentation

Default: ''

--environment-variables

Comma- or space-separated list of environment variables, e.g. PYTHONHASHSEED=0,SKIP=pyright

Default: ''

--excluded-python-versions

Comma- or space-separated list of Python versions you do NOT want to support

Default: ''

--github-pages

Host documentation on GitHub Pages

Default: False

--gitpod

Create a GitPod config file

Default: False

--keep-issue-templates

Do not remove the .github/ISSUE_TEMPLATE directory

Default: False

--keep-pr-linting

Do not overwrite the PR linting workflow

Default: False

--imports-on-top

Sort notebook imports on the top

Default: False

--outsource-pixi-to-tox

Run tox command through pixi

Default: False

--no-binder

Do not update the Binder configuration

Default: False

--no-cd

Do not add any GitHub workflows for continuous deployment

Default: False

--no-cspell-update

Do not enforce same cSpell configuration as other ComPWA repositories. This can be useful if you have a more advanced configuration, like using different dictionaries for different file types.

Default: False

--no-github-actions

Do not add standard GitHub Actions workflows that are used across ComPWA repositories. This can be useful if you already have your own CI workflows that do the same as the workflows enforced by the check-dev-files hook.

Default: False

--no-milestones

This repository does not use milestones and therefore no close workflow.

Default: False

--no-python

Skip check that concern config files for Python projects.

Default: False

--allow-labels

Do not perform the check on labels.toml

Default: False

--dev-python-version

Specify the Python version for your developer environment

Default: '3.12'

--no-macos

Do not run test job on macOS

Default: False

--no-pypi

Do not publish package to PyPI

Default: False

--no-ruff

Do not enforce Ruff as a linter

Default: False

--no-version-branches

Do not push to matching major/minor version branches upon tagging

Default: False

--package-manager

Possible choices: conda, none, pixi, pixi+uv, uv, venv

Specify which package manager to use for the project

Default: 'uv'

--update-lock-files

Possible choices: no, biweekly, monthly, bimonthly, quarterly, biannually, outsource

Add a workflow to update lock files, like uv.lock, .pre-commit-config.yml, and pip .constraints/ files. The argument is the frequency of the cron job

Default: 'outsource'

--pytest-single-threaded

Run pytest without the -n argument

Default: False

--repo-name

Name of the repository. This can usually be found in the URL of the repository on GitHub or GitLab

Default: ''

--repo-organization

Name of the organization under which the repository lives.

Default: 'ComPWA'

--repo-title

Title or full name of the repository. If not provided, this falls back to the repo-name.

Default: ''