Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,7 @@ jobs:
pip install cirq-core==${{matrix.cirq-version}}

- name: Run pytest
run: |
echo '::add-matcher::.github/problem-matchers/pytest.json'
check/pytest -m "not slow"
run: check/pytest -n auto -m "not slow"

pytest-extra:
if: needs.changes.outputs.python == 'true'
Expand Down Expand Up @@ -252,9 +250,7 @@ jobs:
pip install cirq-core==${{matrix.cirq-version}}

- name: Run pytest
run: |
echo '::add-matcher::.github/problem-matchers/pytest.json'
check/pytest -m "not slow" src/openfermion/resource_estimates
run: check/pytest -n auto -m "not slow" src/openfermion/resource_estimates

pytest-compat:
if: needs.changes.outputs.python == 'true'
Expand All @@ -281,9 +277,7 @@ jobs:
run: pip install -r dev_tools/requirements/max_compat/pytest-max-compat.env.txt

- name: Run pytest
run: |
echo '::add-matcher::.github/problem-matchers/pytest.json'
check/pytest -m "not slow"
run: check/pytest -n auto -m "not slow"

coverage:
if: needs.changes.outputs.python == 'true'
Expand Down
12 changes: 9 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ to run it:
check/mypy
```

If your computer has multiple processor cores, you can add the option `-j 0` to the command above to
make Mypy run in parallel for a substantial speed increase.


### Linting and formatting

Code should meet common style standards for Python and be free of error-prone constructs. We use
Expand Down Expand Up @@ -259,7 +263,9 @@ We use [pytest](https://docs.pytest.org) to run our tests and
* While developing, periodically check that changes do not break anything. For fast checks, use
`pytest -c dev_tools/conf/pytest.ini PATH`, where `PATH` is a directory or pytest file to test.

* After finishing a task, run `check/pytest` to test all of the OpenFermion code.
* After finishing a task, run `check/pytest` to test all of the OpenFermion code. If your system
has multiple processor cores, you can add the option `-n auto` to make it run in parallel for a
substantial speed increase. (Beware, though, that this is resource-intensive.)

We don't require 100% coverage, but coverage should be very high, and any uncovered code must be
annotated with `# pragma: no cover`. To ignore coverage of a single line, place `# pragma: no cover`
Expand All @@ -271,9 +277,9 @@ cover` comment on its own line. Note, however, that these annotations should be
After a task is finished, run each of the following to make sure everything passes all the tests:

* `check/format-incremental`
* `check/pylint`
* `check/pylint -j 0`
* `check/mypy`
* `check/pytest`
* `check/pytest -n auto`
* `check/pytest-and-incremental-coverage`

### Pull requests and code reviews
Expand Down
1 change: 1 addition & 0 deletions check/pytest-and-incremental-coverage
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ fi

# Run tests while producing coverage files.
check/pytest . \
-n auto \
--actually-quiet \
--cov \
--cov-report=annotate
Expand Down
1 change: 1 addition & 0 deletions dev_tools/requirements/deps/pytest.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pytest
pytest-asyncio
pytest-cov
pytest-randomly
pytest-retry
pytest-xdist

Expand Down
39 changes: 21 additions & 18 deletions dev_tools/requirements/envs/dev.env.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ backports-asyncio-runner==1.2.0 ; python_full_version < "3.11"
# pytest-asyncio
black==26.3.1
# via -r deps/format.txt
build==1.4.2
build==1.4.4
# via pip-tools
certifi==2026.2.25
certifi==2026.4.22
# via requests
charset-normalizer==3.4.7
# via requests
cirq-core==1.5.0
# via -r deps/runtime.txt
click==8.3.1
click==8.3.3
# via
# black
# pip-tools
Expand Down Expand Up @@ -57,7 +57,7 @@ h5py==3.16.0
# via
# -r deps/runtime.txt
# pyscf
idna==3.11
idna==3.13
# via requests
iniconfig==2.3.0
# via pytest
Expand All @@ -77,9 +77,9 @@ jupyter-core==5.9.1
# via nbformat
kiwisolver==1.5.0
# via matplotlib
librt==0.8.1
librt==0.9.0
# via mypy
matplotlib==3.10.8
matplotlib==3.10.9
# via
# ase
# cirq-core
Expand All @@ -91,7 +91,7 @@ ml-dtypes==0.5.4
# jaxlib
mpmath==1.3.0
# via sympy
mypy==1.20.0
mypy==1.20.2
# via -r deps/mypy.txt
mypy-extensions==1.1.0
# via
Expand Down Expand Up @@ -121,7 +121,7 @@ numpy==2.2.6
# types-networkx
opt-einsum==3.4.0
# via jax
packaging==26.0
packaging==26.2
# via
# black
# build
Expand All @@ -133,15 +133,15 @@ pandas==2.3.3
# via cirq-core
pandas-stubs==2.3.3.260113
# via -r deps/mypy.txt
pathspec==1.0.4
pathspec==1.1.1
# via
# black
# mypy
pillow==12.2.0
# via matplotlib
pip-tools==7.5.3
# via -r deps/pip-tools.txt
platformdirs==4.9.4
platformdirs==4.9.6
# via
# black
# jupyter-core
Expand All @@ -162,19 +162,22 @@ pyproject-hooks==1.2.0
# via
# build
# pip-tools
pyscf==2.12.1
pyscf==2.13.0
# via -r deps/resource_estimates_runtime.txt
pytest==9.0.2
pytest==9.0.3
# via
# -r deps/pytest.txt
# pytest-asyncio
# pytest-cov
# pytest-randomly
# pytest-retry
# pytest-xdist
pytest-asyncio==1.3.0
# via -r deps/pytest.txt
pytest-cov==7.1.0
# via -r deps/pytest.txt
pytest-randomly==4.1.0
# via -r deps/pytest.txt
pytest-retry==1.7.0
# via -r deps/pytest.txt
pytest-xdist==3.8.0
Expand Down Expand Up @@ -230,13 +233,13 @@ traitlets==5.14.3
# via
# jupyter-core
# nbformat
types-networkx==3.6.1.20260402
types-networkx==3.6.1.20260408
# via -r deps/mypy.txt
types-pytz==2026.1.1.20260402
types-pytz==2026.1.1.20260408
# via pandas-stubs
types-requests==2.33.0.20260402
types-requests==2.33.0.20260408
# via -r deps/mypy.txt
types-setuptools==82.0.0.20260402
types-setuptools==82.0.0.20260408
# via -r deps/mypy.txt
typing-extensions==4.15.0
# via
Expand All @@ -247,13 +250,13 @@ typing-extensions==4.15.0
# mypy
# pytest-asyncio
# referencing
tzdata==2025.3
tzdata==2026.2
# via pandas
urllib3==2.6.3
# via
# requests
# types-requests
wheel==0.46.3
wheel==0.47.0
# via pip-tools

# The following packages are considered to be unsafe in a requirements file:
Expand Down
16 changes: 8 additions & 8 deletions dev_tools/requirements/envs/format.env.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ black==26.3.1
# via
# -c envs/dev.env.txt
# -r deps/format.txt
certifi==2026.2.25
certifi==2026.4.22
# via
# -c envs/dev.env.txt
# requests
Expand All @@ -28,7 +28,7 @@ cirq-core==1.5.0
# via
# -c envs/dev.env.txt
# -r deps/runtime.txt
click==8.3.1
click==8.3.3
# via
# -c envs/dev.env.txt
# black
Expand Down Expand Up @@ -57,15 +57,15 @@ h5py==3.16.0
# via
# -c envs/dev.env.txt
# -r deps/runtime.txt
idna==3.11
idna==3.13
# via
# -c envs/dev.env.txt
# requests
kiwisolver==1.5.0
# via
# -c envs/dev.env.txt
# matplotlib
matplotlib==3.10.8
matplotlib==3.10.9
# via
# -c envs/dev.env.txt
# cirq-core
Expand All @@ -92,7 +92,7 @@ numpy==2.2.6
# matplotlib
# pandas
# scipy
packaging==26.0
packaging==26.2
# via
# -c envs/dev.env.txt
# black
Expand All @@ -102,15 +102,15 @@ pandas==2.3.3
# via
# -c envs/dev.env.txt
# cirq-core
pathspec==1.0.4
pathspec==1.1.1
# via
# -c envs/dev.env.txt
# black
pillow==12.2.0
# via
# -c envs/dev.env.txt
# matplotlib
platformdirs==4.9.4
platformdirs==4.9.6
# via
# -c envs/dev.env.txt
# black
Expand Down Expand Up @@ -170,7 +170,7 @@ typing-extensions==4.15.0
# -c envs/dev.env.txt
# black
# cirq-core
tzdata==2025.3
tzdata==2026.2
# via
# -c envs/dev.env.txt
# pandas
Expand Down
24 changes: 12 additions & 12 deletions dev_tools/requirements/envs/mypy.env.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ backports-asyncio-runner==1.2.0 ; python_full_version < "3.11"
# via
# -c envs/dev.env.txt
# -r deps/runtime.txt
certifi==2026.2.25
certifi==2026.4.22
# via
# -c envs/dev.env.txt
# requests
Expand Down Expand Up @@ -49,27 +49,27 @@ h5py==3.16.0
# via
# -c envs/dev.env.txt
# -r deps/runtime.txt
idna==3.11
idna==3.13
# via
# -c envs/dev.env.txt
# requests
kiwisolver==1.5.0
# via
# -c envs/dev.env.txt
# matplotlib
librt==0.8.1
librt==0.9.0
# via
# -c envs/dev.env.txt
# mypy
matplotlib==3.10.8
matplotlib==3.10.9
# via
# -c envs/dev.env.txt
# cirq-core
mpmath==1.3.0
# via
# -c envs/dev.env.txt
# sympy
mypy==1.20.0
mypy==1.20.2
# via
# -c envs/dev.env.txt
# -r deps/mypy.txt
Expand All @@ -94,7 +94,7 @@ numpy==2.2.6
# pandas-stubs
# scipy
# types-networkx
packaging==26.0
packaging==26.2
# via
# -c envs/dev.env.txt
# deprecation
Expand All @@ -107,7 +107,7 @@ pandas-stubs==2.3.3.260113
# via
# -c envs/dev.env.txt
# -r deps/mypy.txt
pathspec==1.0.4
pathspec==1.1.1
# via
# -c envs/dev.env.txt
# mypy
Expand Down Expand Up @@ -162,19 +162,19 @@ tqdm==4.67.3
# via
# -c envs/dev.env.txt
# cirq-core
types-networkx==3.6.1.20260402
types-networkx==3.6.1.20260408
# via
# -c envs/dev.env.txt
# -r deps/mypy.txt
types-pytz==2026.1.1.20260402
types-pytz==2026.1.1.20260408
# via
# -c envs/dev.env.txt
# pandas-stubs
types-requests==2.33.0.20260402
types-requests==2.33.0.20260408
# via
# -c envs/dev.env.txt
# -r deps/mypy.txt
types-setuptools==82.0.0.20260402
types-setuptools==82.0.0.20260408
# via
# -c envs/dev.env.txt
# -r deps/mypy.txt
Expand All @@ -183,7 +183,7 @@ typing-extensions==4.15.0
# -c envs/dev.env.txt
# cirq-core
# mypy
tzdata==2025.3
tzdata==2026.2
# via
# -c envs/dev.env.txt
# pandas
Expand Down
Loading
Loading