From 54a29862aeaac8d962cd540234bd4c26f025028c Mon Sep 17 00:00:00 2001 From: mhucka Date: Mon, 27 Apr 2026 19:48:06 +0000 Subject: [PATCH 01/36] Add `.pre-commit-config.yaml` --- .pre-commit-config.yaml | 237 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 237 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..6abe74e57 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,237 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Summary: optional configuration for using pre-commit with the OpenFermion +# project. It is not run by default by the check scripts; to use it, you need +# to install pre-commit (https://pre-commit.com/). + +default_language_version: + python: 'python3.11' + +default_stages: + - pre-commit + +exclude: | + (?x)^( + \.([^/]*cache/.*) | + __pycache__/.* | + .*\.pytest_cache/ | + .*\.h5 | + \.coverage(\..*)? | + .*\.cover | + .*\.log | + \.env | + \.venv | + env/ | + venv/ | + ENV/ | + \.ipynb_checkpoints | + docs/_build/ | + .*\.egg-info/ | + .*\.out + )$ + +fail_fast: true + +# yamllint disable rule:line-length +repos: +# ~~~~ Pre-commit hooks ~~~~ + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0 + hooks: + # Note: don't use check-yaml bc it doesn't read the yamllint config. + # Use separate yamllint hook later in this file. + + - id: no-commit-to-branch + name: 'Check that the commit is not made to the main branch' + args: [--branch, main, --branch, master] + + - id: check-merge-conflict + name: "Check files are free of merge git conflict strings" + + - id: check-added-large-files + name: 'Check files are not excessively large' + + - id: check-illegal-windows-names + name: "Check file names can be used on Windows" + + - id: check-case-conflict + name: "Check file names won't conflict on case-insensitive systems" + + - id: name-tests-test + name: 'Verify test files are named correctly' + + - id: destroyed-symlinks + name: 'Check symlinks were not turned into regular files' + + - id: detect-private-key + name: 'Check there are no private keys' + + - id: check-shebang-scripts-are-executable + name: 'Check shell script files are executable' + + - id: debug-statements + name: 'Check Python files are free of debug/breakpoint statements' + + - id: check-toml + name: 'Check TOML files for valid syntax' + + - id: check-xml + name: 'Check XML files for valid syntax' + + - id: mixed-line-ending + name: "Check files don't contain mixed line endings" + + - repo: https://github.com/adrienverge/yamllint + rev: cba56bcde1fdd01c1deb3f945e69764c291a6530 # frozen: v1.38.0 + hooks: + - id: yamllint + name: 'Run YAML linter' + files: \.(yaml|yml|cff)$ + args: [--format=colored] + + # Note this is used for YAML files, despite that it's named "jsonschema". + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 'ed81924a8b1cecdaa570b072528fa80c9c4d6ccd' # frozen: 0.37.1 + hooks: + - id: check-dependabot + name: 'Chek Dependabot config file' + - id: check-github-actions + - id: check-github-workflows + - id: check-github-issue-config + - id: check-github-issue-forms + + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 'ed81924a8b1cecdaa570b072528fa80c9c4d6ccd' # frozen: 0.37.1 + hooks: + - id: check-jsonschema + name: 'Check that Jupyter notebooks are valid JSON' + types: [jupyter] + files: '.*\.ipynb$' + # Note: pre-commit will download & cache this file automatically. + args: ["--schemafile", "https://raw.githubusercontent.com/jupyter/nbformat/refs/heads/main/nbformat/v4/nbformat.v4.0.schema.json"] + + - repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: '3.0.0' + hooks: + - id: shellcheck + name: 'Check shell scripts' + files: '(\.sh$|^check/[^.]+$)' + + - repo: https://github.com/abravalheri/validate-pyproject + rev: 4b2e70d08cb2ccd26d1fba73588de41c7a5d50b7 # frozen: v0.25 + hooks: + - id: validate-pyproject + name: 'Check pyproject.toml file' + stages: [pre-push] + files: pyproject.toml + additional_dependencies: ["validate-pyproject-schema-store[all]"] + +# ~~~~ Commit message hooks ~~~~ + + - repo: https://github.com/crate-ci/typos + rev: c96c46fae465ab9e3607401d9ce93d75e7998023 # frozen: v1 + hooks: + - id: typos + name: 'Check commit message for typos' + stages: [commit-msg] + # Important: add "args: []" to prevent typos from autofixing your files. + # C.f. https://github.com/crate-ci/typos/blob/master/docs/pre-commit.md + args: [] + +# ~~~~ Pre-push hooks ~~~~ + + - repo: local + hooks: + - id: format-incremental + name: 'Run check/format-incremental' + entry: check/format-incremental + language: script + files: \\.(cc|h|cu|py)$ + stages: [pre-push] + + - repo: https://github.com/PyCQA/isort.git + rev: dac090ce4d9ee313d086e2e89ab1acb8c2664fa1 # frozen: 9.0.0a3 + hooks: + - id: isort + name: 'Check that Python file imports are sorted' + args: [--check-only, --honor-noqa, --profile=black] + stages: [pre-push] + + - repo: https://github.com/Pierre-Sassoulas/copyright_notice_precommit + rev: 'd9215b6b2a028d1614c92cf43a9fcff3b1dd889e' # frozen: 0.1.2 + hooks: + - id: copyright-notice + name: 'Check that files have a copyright notice' + types: [python] + stages: [pre-push] + args: + - '--notice=$HOME/system/share/templates/apache-copyright.txt' + - '--enforce-all' + exclude: &formatignore | + (?x)( + \.pyi| + _pb2\.pyi?| + _pb2_grpc\.pyi?| + _pb2_client\.pyi?| + _pb2_server\.pyi?| + \.expected\.py| + src/pyle/third_party/| + tools/bazel/rbe/config/cc/ + )$ + + - repo: https://github.com/codespell-project/codespell + rev: 2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a # frozen: v2.4.2 + hooks: + - id: codespell + name: 'Spell-check code files' + stages: [pre-push] + exclude: *formatignore + additional_dependencies: + # Support pyproject.toml + - tomli + + - repo: https://github.com/tcort/markdown-link-check + rev: ffc61540dea52bad1c41cfeedcf26c53ad9447ba # frozen: v3.14.2 + hooks: + - id: markdown-link-check + name: 'Check Markdown file lint' + types: [markdown] + stages: [pre-push] + + - repo: https://github.com/editorconfig-checker/editorconfig-checker.python + rev: 'bebfac867564fbd992e5b45379b4b0568d5cb85b' # frozen: 3.6.1 + hooks: + - id: editorconfig-checker + name: 'Check that files are consistent with .editorconfig settings' + stages: [pre-push] + + - repo: https://github.com/pre-commit/pygrep-hooks + rev: 3a6eb0fadf60b3cccfd80bad9dbb6fae7e47b316 # frozen: v1.10.0 + hooks: + - id: python-check-blanket-noqa + stages: [pre-push] + + - id: python-check-blanket-type-ignore + stages: [pre-push] + + - id: python-check-mock-methods + stages: [pre-push] + + - id: python-no-eval + stages: [pre-push] + + - id: python-no-log-warn + stages: [pre-push] From 245cc9054ddeef57a76e4266f9d09e78a7bef94e Mon Sep 17 00:00:00 2001 From: mhucka Date: Mon, 27 Apr 2026 19:57:40 +0000 Subject: [PATCH 02/36] Make small corrections to the `exclude:` list --- .pre-commit-config.yaml | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6abe74e57..f415ab764 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,24 +22,22 @@ default_language_version: default_stages: - pre-commit +# Note: these are Python regular expressions matched with re.search. exclude: | (?x)^( - \.([^/]*cache/.*) | - __pycache__/.* | - .*\.pytest_cache/ | + .*\.egg-info/.* | .*\.h5 | - \.coverage(\..*)? | - .*\.cover | + .*\.ipynb_checkpoints(/.*)? | .*\.log | - \.env | - \.venv | - env/ | - venv/ | - ENV/ | - \.ipynb_checkpoints | - docs/_build/ | - .*\.egg-info/ | - .*\.out + .*\.out | + .*\.pytest_cache/.* | + .*__pycache__/.* | + .env/.* | + .venv/.* | + \.([^/]*cache/.*) | + \.coverage(\..*)? | + docs/_build/.* | + venv/.* )$ fail_fast: true From 1686821ccfc52c1ffd89175fa281a89fe4571721 Mon Sep 17 00:00:00 2001 From: mhucka Date: Mon, 27 Apr 2026 20:46:54 +0000 Subject: [PATCH 03/36] Remove mixed-line-ending hook I suspect it may modify files. --- .pre-commit-config.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f415ab764..9bdb72c40 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -89,9 +89,6 @@ repos: - id: check-xml name: 'Check XML files for valid syntax' - - id: mixed-line-ending - name: "Check files don't contain mixed line endings" - - repo: https://github.com/adrienverge/yamllint rev: cba56bcde1fdd01c1deb3f945e69764c291a6530 # frozen: v1.38.0 hooks: From 06d2195e4be2f1fdf1e169f4327584d62b18883a Mon Sep 17 00:00:00 2001 From: mhucka Date: Mon, 27 Apr 2026 20:47:24 +0000 Subject: [PATCH 04/36] Add info about pre-commit to `CONTRIBUTING.md` --- CONTRIBUTING.md | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9ac22d4ca..ba8256f3d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,15 +40,15 @@ Hamiltonians. ### Main subdirectories -**check/**: contains scripts for testing +* `check/`: contains scripts for testing -**docker/**: contains a Docker configuration +* `docker/`: contains a Docker configuration -**docs/**: contains OpenFermion documentation +* `docs/`: contains OpenFermion documentation -**src/**: contains the main code +* `src/`: contains the main code -**dev_tools/**: contains programs and configuration files used during development +* `dev_tools/`: contains programs and configuration files used during development The legacy subdirectories `cloud_library/` and `rtd_docs/` should be ignored. @@ -188,6 +188,27 @@ The following command will set up large refactoring revisions to be ignored by ` git config blame.ignoreRevsFile .git-blame-ignore-revs ``` +### Pre-commit git hooks (optional) + +The project includes a `.pre-commit-config.yaml` file for [pre-commit](https://pre-commit.com), an +open-source utility that runs various static analysis tools when triggered by certain git operations +such as `git commit`. This can help you meet project conventions, at the cost of introducing small +delays in `git commit` and `git push` operations. If you want to use `pre-commit`, you can install +and configure it like this: + +```shell +pip install pre-commit +pre-commit install -t pre-commit -t pre-push -t commit-msg +``` + +Next, run it once after installation to initialize it: + +```shell +pre-commit run +``` + +After that, `pre-commit` will run automatically when triggered by git operations. + ### Python setup 1. Create a Python virtual environment. To use Python's built-in `venv` package, run: @@ -220,7 +241,8 @@ check/mypy ### Linting and formatting Code should meet common style standards for Python and be free of error-prone constructs. We use -[Pylint](https://www.pylint.org/) to check for code lint and [Black](https://github.com/psf/black) for formatting code. +[Pylint](https://www.pylint.org/) to check for code lint and [Black](https://github.com/psf/black) +for formatting code. * To check that code is formatted properly after editing Python files: From 829850d6289dfad456ba8b2d4206ae1237a561f5 Mon Sep 17 00:00:00 2001 From: mhucka Date: Mon, 27 Apr 2026 20:59:29 +0000 Subject: [PATCH 05/36] Remove `--enforce-all` It's not clear if it can modify files, but let's not risk it. --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9bdb72c40..465b68eb6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -174,7 +174,6 @@ repos: stages: [pre-push] args: - '--notice=$HOME/system/share/templates/apache-copyright.txt' - - '--enforce-all' exclude: &formatignore | (?x)( \.pyi| From 34fe9945aeffcf327f39166eae5314584bb23e91 Mon Sep 17 00:00:00 2001 From: mhucka Date: Mon, 27 Apr 2026 21:02:01 +0000 Subject: [PATCH 06/36] Move yamllint pragma to where the line is too long --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 465b68eb6..cf6152a3e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,7 +42,6 @@ exclude: | fail_fast: true -# yamllint disable rule:line-length repos: # ~~~~ Pre-commit hooks ~~~~ @@ -116,6 +115,7 @@ repos: types: [jupyter] files: '.*\.ipynb$' # Note: pre-commit will download & cache this file automatically. + # yamllint disable rule:line-length args: ["--schemafile", "https://raw.githubusercontent.com/jupyter/nbformat/refs/heads/main/nbformat/v4/nbformat.v4.0.schema.json"] - repo: https://github.com/jumanjihouse/pre-commit-hooks From 4bc5c7302efdbcb52fb980e5496fcbab4751a729 Mon Sep 17 00:00:00 2001 From: mhucka Date: Mon, 27 Apr 2026 21:03:44 +0000 Subject: [PATCH 07/36] Take out editorconfig checker It duplicates other checks but doesn't use the same config files. --- .pre-commit-config.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cf6152a3e..8fe286fa3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -205,13 +205,6 @@ repos: types: [markdown] stages: [pre-push] - - repo: https://github.com/editorconfig-checker/editorconfig-checker.python - rev: 'bebfac867564fbd992e5b45379b4b0568d5cb85b' # frozen: 3.6.1 - hooks: - - id: editorconfig-checker - name: 'Check that files are consistent with .editorconfig settings' - stages: [pre-push] - - repo: https://github.com/pre-commit/pygrep-hooks rev: 3a6eb0fadf60b3cccfd80bad9dbb6fae7e47b316 # frozen: v1.10.0 hooks: From aa46ae444e7a8736cd2a975758e4e5ad617c7171 Mon Sep 17 00:00:00 2001 From: mhucka Date: Mon, 27 Apr 2026 21:04:25 +0000 Subject: [PATCH 08/36] Update copyright year --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8fe286fa3..216b48418 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,4 @@ -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From bf440929b3b49815e66db2e0f87f68f2e0104ac3 Mon Sep 17 00:00:00 2001 From: mhucka Date: Mon, 27 Apr 2026 21:05:09 +0000 Subject: [PATCH 09/36] Fix double backslashh --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 216b48418..37c498580 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -154,7 +154,7 @@ repos: name: 'Run check/format-incremental' entry: check/format-incremental language: script - files: \\.(cc|h|cu|py)$ + files: \.(cc|h|cu|py)$ stages: [pre-push] - repo: https://github.com/PyCQA/isort.git From 89df2c9c25820528148a33c99ae121195e886552 Mon Sep 17 00:00:00 2001 From: mhucka Date: Mon, 27 Apr 2026 21:09:55 +0000 Subject: [PATCH 10/36] Update versions of a couple of hooks --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 37c498580..8fa24ec97 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -119,7 +119,7 @@ repos: args: ["--schemafile", "https://raw.githubusercontent.com/jupyter/nbformat/refs/heads/main/nbformat/v4/nbformat.v4.0.schema.json"] - repo: https://github.com/jumanjihouse/pre-commit-hooks - rev: '3.0.0' + rev: '38980559e3a605691d6579f96222c30778e5a69e' # frozen: 3.0.0 hooks: - id: shellcheck name: 'Check shell scripts' @@ -157,8 +157,8 @@ repos: files: \.(cc|h|cu|py)$ stages: [pre-push] - - repo: https://github.com/PyCQA/isort.git - rev: dac090ce4d9ee313d086e2e89ab1acb8c2664fa1 # frozen: 9.0.0a3 + - repo: https://github.com/PyCQA/isort + rev: 'dac090ce4d9ee313d086e2e89ab1acb8c2664fa1' # frozen: 9.0.0a3 hooks: - id: isort name: 'Check that Python file imports are sorted' From 138b39aed7fd78fdeaec610583c9dc1463940eab Mon Sep 17 00:00:00 2001 From: mhucka Date: Mon, 27 Apr 2026 21:13:14 +0000 Subject: [PATCH 11/36] Remove patterns for files that don't exist in this repo --- .pre-commit-config.yaml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8fa24ec97..2a0ee99c6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -174,17 +174,6 @@ repos: stages: [pre-push] args: - '--notice=$HOME/system/share/templates/apache-copyright.txt' - exclude: &formatignore | - (?x)( - \.pyi| - _pb2\.pyi?| - _pb2_grpc\.pyi?| - _pb2_client\.pyi?| - _pb2_server\.pyi?| - \.expected\.py| - src/pyle/third_party/| - tools/bazel/rbe/config/cc/ - )$ - repo: https://github.com/codespell-project/codespell rev: 2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a # frozen: v2.4.2 @@ -192,7 +181,6 @@ repos: - id: codespell name: 'Spell-check code files' stages: [pre-push] - exclude: *formatignore additional_dependencies: # Support pyproject.toml - tomli From 27e59b053a78ede5df83d74222976d5ce62f8003 Mon Sep 17 00:00:00 2001 From: mhucka Date: Mon, 27 Apr 2026 21:17:40 +0000 Subject: [PATCH 12/36] Fix file path to be something actually in the repo --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2a0ee99c6..b310e8153 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -173,7 +173,7 @@ repos: types: [python] stages: [pre-push] args: - - '--notice=$HOME/system/share/templates/apache-copyright.txt' + - '--notice=dev_tools/apache-license-header.txt' - repo: https://github.com/codespell-project/codespell rev: 2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a # frozen: v2.4.2 From 97b1f38dbf377732d58399ec43e9ad53d3c91b3f Mon Sep 17 00:00:00 2001 From: mhucka Date: Mon, 27 Apr 2026 21:17:49 +0000 Subject: [PATCH 13/36] Add template Apache 2.0 license header text file This is for use in `.pre-commit-config.yaml`, although it may be useful for other purposes too. --- dev_tools/apache-license-header.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 dev_tools/apache-license-header.txt diff --git a/dev_tools/apache-license-header.txt b/dev_tools/apache-license-header.txt new file mode 100644 index 000000000..660908365 --- /dev/null +++ b/dev_tools/apache-license-header.txt @@ -0,0 +1,11 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. From f707be7b75d79935f12a1c7128e99b1ca2f76162 Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 03:07:46 +0000 Subject: [PATCH 14/36] Don't pass filenames to check/format-incremental --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b310e8153..d035fc62f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -154,6 +154,7 @@ repos: name: 'Run check/format-incremental' entry: check/format-incremental language: script + pass_filenames: false files: \.(cc|h|cu|py)$ stages: [pre-push] From 6aefe3d2429255a7b929591b964e74f528b0ddc1 Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 03:08:02 +0000 Subject: [PATCH 15/36] Don't run isort We currently don't use isort in this project. --- .pre-commit-config.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d035fc62f..eb2a09dbb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -158,14 +158,6 @@ repos: files: \.(cc|h|cu|py)$ stages: [pre-push] - - repo: https://github.com/PyCQA/isort - rev: 'dac090ce4d9ee313d086e2e89ab1acb8c2664fa1' # frozen: 9.0.0a3 - hooks: - - id: isort - name: 'Check that Python file imports are sorted' - args: [--check-only, --honor-noqa, --profile=black] - stages: [pre-push] - - repo: https://github.com/Pierre-Sassoulas/copyright_notice_precommit rev: 'd9215b6b2a028d1614c92cf43a9fcff3b1dd889e' # frozen: 0.1.2 hooks: From 319271d4975f3f71603cf428ce469d65442e4fcd Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 03:22:59 +0000 Subject: [PATCH 16/36] Don't run codespell after all The problem is that it flags typos in parts of a file that you didn't touch. If you fix those, you pollute your PR with unrelated changes. --- .pre-commit-config.yaml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eb2a09dbb..c5fa318d5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -168,16 +168,6 @@ repos: args: - '--notice=dev_tools/apache-license-header.txt' - - repo: https://github.com/codespell-project/codespell - rev: 2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a # frozen: v2.4.2 - hooks: - - id: codespell - name: 'Spell-check code files' - stages: [pre-push] - additional_dependencies: - # Support pyproject.toml - - tomli - - repo: https://github.com/tcort/markdown-link-check rev: ffc61540dea52bad1c41cfeedcf26c53ad9447ba # frozen: v3.14.2 hooks: From 7d4521ff3797b22e9e799a1d875963a0ddff5f6d Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 03:28:58 +0000 Subject: [PATCH 17/36] Add a config value for `minimum_pre_commit_version` --- .pre-commit-config.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c5fa318d5..066a0e871 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,6 +42,8 @@ exclude: | fail_fast: true +minimum_pre_commit_version: '4.4.0' + repos: # ~~~~ Pre-commit hooks ~~~~ From c95bf4413d2898dad9420e7575545e4710f3929d Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 03:39:33 +0000 Subject: [PATCH 18/36] Add verbose flag to yamllint --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 066a0e871..0da0f361f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -95,6 +95,7 @@ repos: hooks: - id: yamllint name: 'Run YAML linter' + verbose: true files: \.(yaml|yml|cff)$ args: [--format=colored] From 329a96cd6c5cabfd07acc62889526c8447b4f963 Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 04:48:49 +0000 Subject: [PATCH 19/36] Remove validate-pyproject because it's too slow --- .pre-commit-config.yaml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0da0f361f..92160a72b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -128,15 +128,6 @@ repos: name: 'Check shell scripts' files: '(\.sh$|^check/[^.]+$)' - - repo: https://github.com/abravalheri/validate-pyproject - rev: 4b2e70d08cb2ccd26d1fba73588de41c7a5d50b7 # frozen: v0.25 - hooks: - - id: validate-pyproject - name: 'Check pyproject.toml file' - stages: [pre-push] - files: pyproject.toml - additional_dependencies: ["validate-pyproject-schema-store[all]"] - # ~~~~ Commit message hooks ~~~~ - repo: https://github.com/crate-ci/typos From 4d7c79d60192186fb0a7ba1f5e8396e963573f71 Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 04:53:23 +0000 Subject: [PATCH 20/36] Regularize the style of `args:` values Don't need to quote the strings, plus use array notation for all of them --- .pre-commit-config.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 92160a72b..45ac3cca5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -119,7 +119,7 @@ repos: files: '.*\.ipynb$' # Note: pre-commit will download & cache this file automatically. # yamllint disable rule:line-length - args: ["--schemafile", "https://raw.githubusercontent.com/jupyter/nbformat/refs/heads/main/nbformat/v4/nbformat.v4.0.schema.json"] + args: [--schemafile, https://raw.githubusercontent.com/jupyter/nbformat/refs/heads/main/nbformat/v4/nbformat.v4.0.schema.json] - repo: https://github.com/jumanjihouse/pre-commit-hooks rev: '38980559e3a605691d6579f96222c30778e5a69e' # frozen: 3.0.0 @@ -159,8 +159,7 @@ repos: name: 'Check that files have a copyright notice' types: [python] stages: [pre-push] - args: - - '--notice=dev_tools/apache-license-header.txt' + args: [--notice=dev_tools/apache-license-header.txt] - repo: https://github.com/tcort/markdown-link-check rev: ffc61540dea52bad1c41cfeedcf26c53ad9447ba # frozen: v3.14.2 From 2322d3a76f567dd5140145baef03049f05ead159 Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 04:55:30 +0000 Subject: [PATCH 21/36] Use --no-warnings with yamllint --- .pre-commit-config.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 45ac3cca5..59047c4fc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -95,9 +95,8 @@ repos: hooks: - id: yamllint name: 'Run YAML linter' - verbose: true files: \.(yaml|yml|cff)$ - args: [--format=colored] + args: [--format=colored, --no-warnings] # Note this is used for YAML files, despite that it's named "jsonschema". - repo: https://github.com/python-jsonschema/check-jsonschema From 4488504ad3a5d5ac67e034a04094742e0826566e Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 04:57:27 +0000 Subject: [PATCH 22/36] Fix typo --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 59047c4fc..3c56f892e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -103,7 +103,7 @@ repos: rev: 'ed81924a8b1cecdaa570b072528fa80c9c4d6ccd' # frozen: 0.37.1 hooks: - id: check-dependabot - name: 'Chek Dependabot config file' + name: 'Check Dependabot config file' - id: check-github-actions - id: check-github-workflows - id: check-github-issue-config From 09dfabb66737ec963c8b888e63a6531ed5ce4ad5 Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 21:47:19 +0000 Subject: [PATCH 23/36] Reword messages for better clarity --- .pre-commit-config.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3c56f892e..a67384680 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -58,31 +58,31 @@ repos: args: [--branch, main, --branch, master] - id: check-merge-conflict - name: "Check files are free of merge git conflict strings" + name: "Check that files are free of merge git conflict strings" - id: check-added-large-files - name: 'Check files are not excessively large' + name: 'Check that files are not excessively large' - id: check-illegal-windows-names - name: "Check file names can be used on Windows" + name: "Check that file names can be used on Windows" - id: check-case-conflict - name: "Check file names won't conflict on case-insensitive systems" + name: "Check that file names won't conflict on case-insensitive systems" - id: name-tests-test name: 'Verify test files are named correctly' - id: destroyed-symlinks - name: 'Check symlinks were not turned into regular files' + name: 'Check that symlinks are not turned into regular files' - id: detect-private-key name: 'Check there are no private keys' - id: check-shebang-scripts-are-executable - name: 'Check shell script files are executable' + name: 'Check that shell script files are executable' - id: debug-statements - name: 'Check Python files are free of debug/breakpoint statements' + name: 'Check that Python files are free of debug statements' - id: check-toml name: 'Check TOML files for valid syntax' From 10ba68236da8f59fa733e99c4550b16f484a28c5 Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 21:47:38 +0000 Subject: [PATCH 24/36] Add check-symlinks check --- .pre-commit-config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a67384680..cfdcca518 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -72,6 +72,9 @@ repos: - id: name-tests-test name: 'Verify test files are named correctly' + - id: check-symlinks + name: 'Check for symlinks that do not point to anything' + - id: destroyed-symlinks name: 'Check that symlinks are not turned into regular files' From 8ed08338f99e0b870a9b48befffa5b7c318369cd Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 21:59:12 +0000 Subject: [PATCH 25/36] Remove a couple of needless checks - id: check-github-issue-config - id: check-github-issue-forms --- .pre-commit-config.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cfdcca518..dcff747b8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -109,8 +109,6 @@ repos: name: 'Check Dependabot config file' - id: check-github-actions - id: check-github-workflows - - id: check-github-issue-config - - id: check-github-issue-forms - repo: https://github.com/python-jsonschema/check-jsonschema rev: 'ed81924a8b1cecdaa570b072528fa80c9c4d6ccd' # frozen: 0.37.1 From 54e5490f1745273fceeab8105c32dd0f84c9846c Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 22:00:44 +0000 Subject: [PATCH 26/36] Take out check-github-actions too --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dcff747b8..1ecc57bf5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -107,7 +107,6 @@ repos: hooks: - id: check-dependabot name: 'Check Dependabot config file' - - id: check-github-actions - id: check-github-workflows - repo: https://github.com/python-jsonschema/check-jsonschema From dad499b3d2c394864aceaf56e8c21dd1fbbeee3f Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 22:02:05 +0000 Subject: [PATCH 27/36] Take out Dependabot check too Rarely relevant because the config file changes so infrequently, plus it's extremely unlikely that a non-core contributor would edit those files. --- .pre-commit-config.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1ecc57bf5..25613bf8c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -105,9 +105,8 @@ repos: - repo: https://github.com/python-jsonschema/check-jsonschema rev: 'ed81924a8b1cecdaa570b072528fa80c9c4d6ccd' # frozen: 0.37.1 hooks: - - id: check-dependabot - name: 'Check Dependabot config file' - id: check-github-workflows + name: 'Check GitHub workflow files' - repo: https://github.com/python-jsonschema/check-jsonschema rev: 'ed81924a8b1cecdaa570b072528fa80c9c4d6ccd' # frozen: 0.37.1 From 0998a56ff467fd486427927a6ab2ed6e64d29928 Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 22:04:03 +0000 Subject: [PATCH 28/36] Take out check for large files I'm not even sure what the threshold is. --- .pre-commit-config.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 25613bf8c..5f4538d4c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -60,9 +60,6 @@ repos: - id: check-merge-conflict name: "Check that files are free of merge git conflict strings" - - id: check-added-large-files - name: 'Check that files are not excessively large' - - id: check-illegal-windows-names name: "Check that file names can be used on Windows" From 721414abe0ffadc0b5d92244567d53bf8c14b50b Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 22:04:51 +0000 Subject: [PATCH 29/36] Take out private key check We have other tools on GitHub that look for those things. --- .pre-commit-config.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5f4538d4c..0c04af720 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -75,9 +75,6 @@ repos: - id: destroyed-symlinks name: 'Check that symlinks are not turned into regular files' - - id: detect-private-key - name: 'Check there are no private keys' - - id: check-shebang-scripts-are-executable name: 'Check that shell script files are executable' From de80e8c83fd2763a253cc0fb3d9bd8f6c0cc4d21 Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 22:14:41 +0000 Subject: [PATCH 30/36] More cleanup and adjustments --- .pre-commit-config.yaml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0c04af720..aeede9dea 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -95,13 +95,6 @@ repos: files: \.(yaml|yml|cff)$ args: [--format=colored, --no-warnings] - # Note this is used for YAML files, despite that it's named "jsonschema". - - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 'ed81924a8b1cecdaa570b072528fa80c9c4d6ccd' # frozen: 0.37.1 - hooks: - - id: check-github-workflows - name: 'Check GitHub workflow files' - - repo: https://github.com/python-jsonschema/check-jsonschema rev: 'ed81924a8b1cecdaa570b072528fa80c9c4d6ccd' # frozen: 0.37.1 hooks: @@ -120,6 +113,13 @@ repos: name: 'Check shell scripts' files: '(\.sh$|^check/[^.]+$)' + # Note this is used for YAML files, despite that it's named "jsonschema". + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 'ed81924a8b1cecdaa570b072528fa80c9c4d6ccd' # frozen: 0.37.1 + hooks: + - id: check-github-workflows + name: 'Check GitHub workflow files' + # ~~~~ Commit message hooks ~~~~ - repo: https://github.com/crate-ci/typos @@ -165,16 +165,17 @@ repos: rev: 3a6eb0fadf60b3cccfd80bad9dbb6fae7e47b316 # frozen: v1.10.0 hooks: - id: python-check-blanket-noqa + name: 'Check that "# noqa" annotations include error codes' stages: [pre-push] - id: python-check-blanket-type-ignore + name: 'Check that "# type: ignore" comments include error codes' stages: [pre-push] - id: python-check-mock-methods - stages: [pre-push] - - - id: python-no-eval + name: 'Check for common mistakes when using unittest.mock' stages: [pre-push] - id: python-no-log-warn + name: 'Check for uses of the deprecated Python logger .warn() method' stages: [pre-push] From fd64d38f980278537e766f99037a1389197a41be Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 22:21:50 +0000 Subject: [PATCH 31/36] Add check for docker files --- .pre-commit-config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aeede9dea..8a7a7def6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -113,6 +113,14 @@ repos: name: 'Check shell scripts' files: '(\.sh$|^check/[^.]+$)' + - repo: https://github.com/hadolint/hadolint + rev: v2.14.0 + hooks: + - id: hadolint + name: 'Check Docker files' + files: (?i)dockerfile$ + args: [--failure-threshold, error] + # Note this is used for YAML files, despite that it's named "jsonschema". - repo: https://github.com/python-jsonschema/check-jsonschema rev: 'ed81924a8b1cecdaa570b072528fa80c9c4d6ccd' # frozen: 0.37.1 From d9936c54c76f0f4f42e16082dcfb5f7a983e2c6f Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 22:34:15 +0000 Subject: [PATCH 32/36] Add info about installation approach --- .pre-commit-config.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8a7a7def6..f9def8a50 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,9 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Summary: optional configuration for using pre-commit with the OpenFermion -# project. It is not run by default by the check scripts; to use it, you need -# to install pre-commit (https://pre-commit.com/). +# Summary: config for setting up git hooks using the pre-commit framework. This +# is optional and NOT set up by default nor used by the scripts in check/. Here +# is a suggested installation approach; after doing this, the pre-commit hooks +# will be called automatically by git at the appropriate times: +# +# pip install pre-commit +# pre-commit install -t pre-commit -t commit-msg -t pre-push +# pre-commit run default_language_version: python: 'python3.11' From 193ce43eb37dcaabb7b32cade17ad7b320bc604c Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 22:37:41 +0000 Subject: [PATCH 33/36] Take out the default_language_version This causes more problems than it's worth. --- .pre-commit-config.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f9def8a50..a2160a0c7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,9 +21,6 @@ # pre-commit install -t pre-commit -t commit-msg -t pre-push # pre-commit run -default_language_version: - python: 'python3.11' - default_stages: - pre-commit From 273f27ee562fe21a82641f43d588be1ff10dacdb Mon Sep 17 00:00:00 2001 From: mhucka Date: Tue, 28 Apr 2026 22:47:23 +0000 Subject: [PATCH 34/36] Clarify text about pre-commit --- CONTRIBUTING.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ba8256f3d..5c6cc24d0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -191,10 +191,10 @@ git config blame.ignoreRevsFile .git-blame-ignore-revs ### Pre-commit git hooks (optional) The project includes a `.pre-commit-config.yaml` file for [pre-commit](https://pre-commit.com), an -open-source utility that runs various static analysis tools when triggered by certain git operations -such as `git commit`. This can help you meet project conventions, at the cost of introducing small -delays in `git commit` and `git push` operations. If you want to use `pre-commit`, you can install -and configure it like this: +open-source utility that configures functions to run when triggered by certain git operations such +as `git commit`. This can help you meet project conventions, at the cost of introducing small delays +in `git commit` and `git push` operations. If you want to use `pre-commit`, you can install and +configure it like this: ```shell pip install pre-commit @@ -207,7 +207,7 @@ Next, run it once after installation to initialize it: pre-commit run ``` -After that, `pre-commit` will run automatically when triggered by git operations. +After that, `pre-commit` will run automatically when triggered by specific git operations. ### Python setup From 81823751f593c1b883aa9c32587c29ecb062ec00 Mon Sep 17 00:00:00 2001 From: mhucka Date: Wed, 29 Apr 2026 01:17:18 +0000 Subject: [PATCH 35/36] Take out python-no-log-warn This doesn't seem to appear in the code base anyway. Let's save a bit of time time by skipping it. --- .pre-commit-config.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a2160a0c7..3079413fc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -185,7 +185,3 @@ repos: - id: python-check-mock-methods name: 'Check for common mistakes when using unittest.mock' stages: [pre-push] - - - id: python-no-log-warn - name: 'Check for uses of the deprecated Python logger .warn() method' - stages: [pre-push] From 5c676d383e1b990afbe19532cbae5d179c7c74c2 Mon Sep 17 00:00:00 2001 From: mhucka Date: Wed, 29 Apr 2026 01:30:24 +0000 Subject: [PATCH 36/36] Edit the pre-commit explanations With a little help from my friend, Gemini. --- CONTRIBUTING.md | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5c6cc24d0..1289297a2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -180,7 +180,7 @@ ready, create a pull request from your branch to the main project repository. where `YOUR_BRANCH_NAME` is the name of your new branch. -### `git` configuration +### Git configuration The following command will set up large refactoring revisions to be ignored by `git blame`: @@ -188,26 +188,37 @@ The following command will set up large refactoring revisions to be ignored by ` git config blame.ignoreRevsFile .git-blame-ignore-revs ``` -### Pre-commit git hooks (optional) +### Git hooks configuration (optional) -The project includes a `.pre-commit-config.yaml` file for [pre-commit](https://pre-commit.com), an -open-source utility that configures functions to run when triggered by certain git operations such -as `git commit`. This can help you meet project conventions, at the cost of introducing small delays -in `git commit` and `git push` operations. If you want to use `pre-commit`, you can install and -configure it like this: +This project includes a `.pre-commit-config.yaml` file for [pre-commit](https://pre-commit.com), an +open-source utility that configures git hook functions to run when triggered by git operations such +as committing changes, pushing changes, or writing commit messages. These hooks perform various +checks that can help you meet project conventions automatically, at the cost of introducing small +delays in those git operations. If you want to use `pre-commit`, you can install and configure it +like this: ```shell pip install pre-commit pre-commit install -t pre-commit -t pre-push -t commit-msg ``` -Next, run it once after installation to initialize it: +Next, run it once after installation to download the hook environments and verify your setup: ```shell -pre-commit run +pre-commit run --all-files ``` -After that, `pre-commit` will run automatically when triggered by specific git operations. +After that, the hooks will run automatically when triggered by the corresponding git operations. + +### Type annotation conventions + +Code should have [type annotations](https://www.python.org/dev/peps/pep-0484/). We use +[mypy](http://mypy-lang.org/) to check that type annotations are correct, and the following script +to run it: + +```shell +check/mypy +``` ### Python setup @@ -228,16 +239,6 @@ After that, `pre-commit` will run automatically when triggered by specific git o Please refer to the section _Developer install_ of the [installation instructions](docs/install.md) for information about how to set up a local copy of the software for development. -### Type annotation conventions - -Code should have [type annotations](https://www.python.org/dev/peps/pep-0484/). We use -[mypy](http://mypy-lang.org/) to check that type annotations are correct, and the following script -to run it: - -```shell -check/mypy -``` - ### Linting and formatting Code should meet common style standards for Python and be free of error-prone constructs. We use