Skip to content

Commit 201d58b

Browse files
authored
Merge branch 'main' into fix/issue-1105-low-rank-spin-exchange
2 parents 5753f70 + 5a5e67a commit 201d58b

44 files changed

Lines changed: 267 additions & 200 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ jobs:
219219
- name: Run pytest
220220
run: |
221221
echo '::add-matcher::.github/problem-matchers/pytest.json'
222-
check/pytest -m "not slow"
222+
check/pytest -n auto -m "not slow"
223223
224224
pytest-extra:
225225
if: needs.changes.outputs.python == 'true'
@@ -254,7 +254,7 @@ jobs:
254254
- name: Run pytest
255255
run: |
256256
echo '::add-matcher::.github/problem-matchers/pytest.json'
257-
check/pytest -m "not slow" src/openfermion/resource_estimates
257+
check/pytest -n auto -m "not slow" src/openfermion/resource_estimates
258258
259259
pytest-compat:
260260
if: needs.changes.outputs.python == 'true'
@@ -283,7 +283,7 @@ jobs:
283283
- name: Run pytest
284284
run: |
285285
echo '::add-matcher::.github/problem-matchers/pytest.json'
286-
check/pytest -m "not slow"
286+
check/pytest -n auto -m "not slow"
287287
288288
coverage:
289289
if: needs.changes.outputs.python == 'true'

.github/workflows/scorecard-scanner.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070

7171
- name: Upload results to code-scanning dashboard
7272
# yamllint disable rule:line-length
73-
uses: github/codeql-action/upload-sarif@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.35.2
73+
uses: github/codeql-action/upload-sarif@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
7474
with:
7575
sarif_file: scorecard-results.sarif
7676

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919

2020
[MAIN]
2121

22-
# Analyse import fallback blocks. This can be used to support both Python 2 and
23-
# 3 compatible code, which means that the block might have code that exists
24-
# only in one or another interpreter, leading to false positives when analysed.
22+
# Analyse import fallback blocks.
2523
analyse-fallback-blocks=no
2624

2725
# Clear in-memory caches upon conclusion of linting. Useful if running pylint
@@ -1027,4 +1025,4 @@ init-import=yes
10271025

10281026
# List of qualified module names which can have objects that can redefine
10291027
# builtins.
1030-
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
1028+
redefining-builtins-modules=builtins,io

CONTRIBUTING.md

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ This project follows Google coding conventions, with a few changes that are most
7474
configuration files at the top level of the source tree and in `dev_tools/conf/`. The following
7575
files configure various tools to the project conventions:
7676

77-
* `dev_tools/conf/.pylintrc`: Python code
78-
7977
* `.editorconfig`: basic code editor configuration
8078

8179
* `.hadolint.yaml`: Dockerfiles
@@ -84,6 +82,10 @@ files configure various tools to the project conventions:
8482

8583
* `.markdownlintrc`: Markdown files
8684

85+
* `.pylintrc`: Python file lint
86+
87+
* `.pyproject.toml`: Python tools other than Pylint
88+
8789
* `.yamllint.yaml`: YAML files
8890

8991
#### Code comment conventions
@@ -210,16 +212,6 @@ pre-commit run --all-files
210212

211213
After that, the hooks will run automatically when triggered by the corresponding git operations.
212214

213-
### Type annotation conventions
214-
215-
Code should have [type annotations](https://www.python.org/dev/peps/pep-0484/). We use
216-
[mypy](http://mypy-lang.org/) to check that type annotations are correct, and the following script
217-
to run it:
218-
219-
```shell
220-
check/mypy
221-
```
222-
223215
### Python setup
224216

225217
1. Create a Python virtual environment. To use Python's built-in `venv` package, run:
@@ -239,6 +231,20 @@ check/mypy
239231
Please refer to the section _Developer install_ of the [installation instructions](docs/install.md)
240232
for information about how to set up a local copy of the software for development.
241233
234+
### Type annotation conventions
235+
236+
Code should have [type annotations](https://www.python.org/dev/peps/pep-0484/). We use
237+
[mypy](http://mypy-lang.org/) to check that type annotations are correct, and the following script
238+
to run it:
239+
240+
```shell
241+
check/mypy
242+
```
243+
244+
If your computer has multiple processor cores, you can add the option `-j 0` to the command above to
245+
make Mypy run in parallel for a substantial speed increase.
246+
247+
242248
### Linting and formatting
243249
244250
Code should meet common style standards for Python and be free of error-prone constructs. We use
@@ -282,7 +288,9 @@ We use [pytest](https://docs.pytest.org) to run our tests and
282288
* While developing, periodically check that changes do not break anything. For fast checks, use
283289
`pytest -m "not slow" PATH`, where `PATH` is a directory or pytest file to test.
284290
285-
* After finishing a task, run `check/pytest` to test all of the OpenFermion code.
291+
* After finishing a task, run `check/pytest` to test all of the OpenFermion code. If your system
292+
has multiple processor cores, you can add the option `-n auto` to make it run in parallel for a
293+
substantial speed increase. (Beware, though, that this is resource-intensive.)
286294
287295
We don't require 100% coverage, but coverage should be very high, and any uncovered code must be
288296
annotated with `# pragma: no cover`. To ignore coverage of a single line, place `# pragma: no cover`
@@ -294,9 +302,9 @@ cover` comment on its own line. Note, however, that these annotations should be
294302
After a task is finished, run each of the following to make sure everything passes all the tests:
295303

296304
* `check/format-incremental`
297-
* `check/pylint`
305+
* `check/pylint -j 0`
298306
* `check/mypy`
299-
* `check/pytest`
307+
* `check/pytest -n auto`
300308
* `check/pytest-and-incremental-coverage`
301309

302310
### Pull requests and code reviews

check/pylint

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515

1616
################################################################################
17-
# Runs pylint on the repository using a preconfigured .pylintrc file.
17+
# Runs pylint from the top level of the project.
1818
#
1919
# Usage:
2020
# check/pylint [--flags]
@@ -24,4 +24,4 @@
2424
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" || exit 1
2525
cd "$(git rev-parse --show-toplevel)" || exit 1
2626

27-
pylint --rcfile=dev_tools/conf/.pylintrc "$@" src dev_tools
27+
pylint "$@" src dev_tools

check/pylint-changed-files

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# Summary: run pylint on changed files using a preconfigured .pylintrc file.
17+
# Summary: run pylint on changed files from the top level of the project.
1818
#
1919
# Usage:
2020
# check/pylint-changed-files [BASE_REVISION]
@@ -81,4 +81,4 @@ echo "Found ${num_changed} lintable files associated with changes." >&2
8181
if [ "${num_changed}" -eq 0 ]; then
8282
exit 0
8383
fi
84-
env PYTHONPATH=dev_tools pylint --jobs=0 --rcfile=dev_tools/conf/.pylintrc "${changed[@]}"
84+
env PYTHONPATH=dev_tools pylint --jobs=0 "${changed[@]}"

check/pytest-and-incremental-coverage

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ fi
6868

6969
# Run tests while producing coverage files.
7070
check/pytest . \
71+
-n auto \
7172
--actually-quiet \
7273
--cov \
7374
--cov-report=annotate

dev_tools/requirements/deps/pytest.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
pytest
22
pytest-asyncio
33
pytest-cov
4+
pytest-randomly
45
pytest-retry
56
pytest-xdist
67

dev_tools/requirements/envs/dev.env.txt

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ backports-asyncio-runner==1.2.0 ; python_full_version < "3.11"
1919
# pytest-asyncio
2020
black==26.3.1
2121
# via -r deps/format.txt
22-
build==1.4.2
22+
build==1.4.4
2323
# via pip-tools
24-
certifi==2026.2.25
24+
certifi==2026.4.22
2525
# via requests
2626
charset-normalizer==3.4.7
2727
# via requests
2828
cirq-core==1.5.0
2929
# via -r deps/runtime.txt
30-
click==8.3.1
30+
click==8.3.3
3131
# via
3232
# black
3333
# pip-tools
@@ -57,7 +57,7 @@ h5py==3.16.0
5757
# via
5858
# -r deps/runtime.txt
5959
# pyscf
60-
idna==3.11
60+
idna==3.13
6161
# via requests
6262
iniconfig==2.3.0
6363
# via pytest
@@ -77,9 +77,9 @@ jupyter-core==5.9.1
7777
# via nbformat
7878
kiwisolver==1.5.0
7979
# via matplotlib
80-
librt==0.8.1
80+
librt==0.9.0
8181
# via mypy
82-
matplotlib==3.10.8
82+
matplotlib==3.10.9
8383
# via
8484
# ase
8585
# cirq-core
@@ -91,7 +91,7 @@ ml-dtypes==0.5.4
9191
# jaxlib
9292
mpmath==1.3.0
9393
# via sympy
94-
mypy==1.20.0
94+
mypy==1.20.2
9595
# via -r deps/mypy.txt
9696
mypy-extensions==1.1.0
9797
# via
@@ -121,7 +121,7 @@ numpy==2.2.6
121121
# types-networkx
122122
opt-einsum==3.4.0
123123
# via jax
124-
packaging==26.0
124+
packaging==26.2
125125
# via
126126
# black
127127
# build
@@ -133,15 +133,15 @@ pandas==2.3.3
133133
# via cirq-core
134134
pandas-stubs==2.3.3.260113
135135
# via -r deps/mypy.txt
136-
pathspec==1.0.4
136+
pathspec==1.1.1
137137
# via
138138
# black
139139
# mypy
140140
pillow==12.2.0
141141
# via matplotlib
142142
pip-tools==7.5.3
143143
# via -r deps/pip-tools.txt
144-
platformdirs==4.9.4
144+
platformdirs==4.9.6
145145
# via
146146
# black
147147
# jupyter-core
@@ -162,19 +162,22 @@ pyproject-hooks==1.2.0
162162
# via
163163
# build
164164
# pip-tools
165-
pyscf==2.12.1
165+
pyscf==2.13.0
166166
# via -r deps/resource_estimates_runtime.txt
167-
pytest==9.0.2
167+
pytest==9.0.3
168168
# via
169169
# -r deps/pytest.txt
170170
# pytest-asyncio
171171
# pytest-cov
172+
# pytest-randomly
172173
# pytest-retry
173174
# pytest-xdist
174175
pytest-asyncio==1.3.0
175176
# via -r deps/pytest.txt
176177
pytest-cov==7.1.0
177178
# via -r deps/pytest.txt
179+
pytest-randomly==4.1.0
180+
# via -r deps/pytest.txt
178181
pytest-retry==1.7.0
179182
# via -r deps/pytest.txt
180183
pytest-xdist==3.8.0
@@ -230,13 +233,13 @@ traitlets==5.14.3
230233
# via
231234
# jupyter-core
232235
# nbformat
233-
types-networkx==3.6.1.20260402
236+
types-networkx==3.6.1.20260408
234237
# via -r deps/mypy.txt
235-
types-pytz==2026.1.1.20260402
238+
types-pytz==2026.1.1.20260408
236239
# via pandas-stubs
237-
types-requests==2.33.0.20260402
240+
types-requests==2.33.0.20260408
238241
# via -r deps/mypy.txt
239-
types-setuptools==82.0.0.20260402
242+
types-setuptools==82.0.0.20260408
240243
# via -r deps/mypy.txt
241244
typing-extensions==4.15.0
242245
# via
@@ -247,13 +250,13 @@ typing-extensions==4.15.0
247250
# mypy
248251
# pytest-asyncio
249252
# referencing
250-
tzdata==2025.3
253+
tzdata==2026.2
251254
# via pandas
252255
urllib3==2.6.3
253256
# via
254257
# requests
255258
# types-requests
256-
wheel==0.46.3
259+
wheel==0.47.0
257260
# via pip-tools
258261

259262
# The following packages are considered to be unsafe in a requirements file:

dev_tools/requirements/envs/format.env.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ black==26.3.1
1616
# via
1717
# -c envs/dev.env.txt
1818
# -r deps/format.txt
19-
certifi==2026.2.25
19+
certifi==2026.4.22
2020
# via
2121
# -c envs/dev.env.txt
2222
# requests
@@ -28,7 +28,7 @@ cirq-core==1.5.0
2828
# via
2929
# -c envs/dev.env.txt
3030
# -r deps/runtime.txt
31-
click==8.3.1
31+
click==8.3.3
3232
# via
3333
# -c envs/dev.env.txt
3434
# black
@@ -57,15 +57,15 @@ h5py==3.16.0
5757
# via
5858
# -c envs/dev.env.txt
5959
# -r deps/runtime.txt
60-
idna==3.11
60+
idna==3.13
6161
# via
6262
# -c envs/dev.env.txt
6363
# requests
6464
kiwisolver==1.5.0
6565
# via
6666
# -c envs/dev.env.txt
6767
# matplotlib
68-
matplotlib==3.10.8
68+
matplotlib==3.10.9
6969
# via
7070
# -c envs/dev.env.txt
7171
# cirq-core
@@ -92,7 +92,7 @@ numpy==2.2.6
9292
# matplotlib
9393
# pandas
9494
# scipy
95-
packaging==26.0
95+
packaging==26.2
9696
# via
9797
# -c envs/dev.env.txt
9898
# black
@@ -102,15 +102,15 @@ pandas==2.3.3
102102
# via
103103
# -c envs/dev.env.txt
104104
# cirq-core
105-
pathspec==1.0.4
105+
pathspec==1.1.1
106106
# via
107107
# -c envs/dev.env.txt
108108
# black
109109
pillow==12.2.0
110110
# via
111111
# -c envs/dev.env.txt
112112
# matplotlib
113-
platformdirs==4.9.4
113+
platformdirs==4.9.6
114114
# via
115115
# -c envs/dev.env.txt
116116
# black
@@ -170,7 +170,7 @@ typing-extensions==4.15.0
170170
# -c envs/dev.env.txt
171171
# black
172172
# cirq-core
173-
tzdata==2025.3
173+
tzdata==2026.2
174174
# via
175175
# -c envs/dev.env.txt
176176
# pandas

0 commit comments

Comments
 (0)