Skip to content
Open
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
32 changes: 0 additions & 32 deletions dev_tools/requirements/Dockerfile

This file was deleted.

107 changes: 107 additions & 0 deletions dev_tools/requirements/create-env-files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/bin/bash
# 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.
# 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.

set -o errexit
set -o nounset

declare -r usage="Usage: ${0} [-h] [UV_OPTIONS]
Generate environment files for OpenFermion development using uv's
'universal' option, making the result compatible with multiple
Python versions. The output is written to subdirectories under
dev_tools/requirements/.

Options:
-h Show this help message and exit

All other options on the command line will be passed directly to
'uv pip compile'. Run 'uv pip compile --help' to learn about the
options available."

while [[ $# -gt 0 ]]; do
case "${1}" in
-h) echo "${usage}"; exit 0 ;;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit - can we handle --help too for a good measure?

*) break ;;
esac
done

# Go to the top of the local TFQ git tree. Do it early in case this fails.
script_dir=$(CDPATH="" cd -- "$(dirname -- "${0}")" && pwd -P)
repo_dir=$(git -C "${script_dir}" rev-parse --show-toplevel 2>/dev/null)
cd "${repo_dir}"

mkdir -p dev_tools/requirements/envs dev_tools/requirements/max_compat

# ~~~~ Generate normal requirements files ~~~~

uv pip compile "$@" \
-o dev_tools/requirements/envs/dev.env.txt \
dev_tools/requirements/deps/format.txt \
dev_tools/requirements/deps/mypy.txt \
dev_tools/requirements/deps/pylint.txt \
dev_tools/requirements/deps/pytest.txt \
dev_tools/requirements/deps/resource_estimates_runtime.txt \
dev_tools/requirements/deps/runtime.txt \
dev_tools/requirements/deps/shellcheck.txt

uv pip compile "$@" \
-o dev_tools/requirements/envs/format.env.txt \
-c dev_tools/requirements/envs/dev.env.txt \
dev_tools/requirements/deps/format.txt \
dev_tools/requirements/deps/runtime.txt

uv pip compile "$@" \
-o dev_tools/requirements/envs/pylint.env.txt \
-c dev_tools/requirements/envs/dev.env.txt \
dev_tools/requirements/deps/pylint.txt \
dev_tools/requirements/deps/runtime.txt

uv pip compile "$@" \
-o dev_tools/requirements/envs/pytest.env.txt \
-c dev_tools/requirements/envs/dev.env.txt \
dev_tools/requirements/deps/pytest.txt \
dev_tools/requirements/deps/runtime.txt

uv pip compile "$@" \
-o dev_tools/requirements/envs/pytest-extra.env.txt \
-c dev_tools/requirements/envs/dev.env.txt \
dev_tools/requirements/deps/pytest.txt \
dev_tools/requirements/deps/resource_estimates_runtime.txt \
dev_tools/requirements/deps/runtime.txt

uv pip compile "$@" \
-o dev_tools/requirements/envs/mypy.env.txt \
-c dev_tools/requirements/envs/dev.env.txt \
dev_tools/requirements/deps/mypy.txt \
dev_tools/requirements/deps/runtime.txt

uv pip compile "$@" \
-o dev_tools/requirements/envs/shellcheck.env.txt \
-c dev_tools/requirements/envs/dev.env.txt \
dev_tools/requirements/deps/shellcheck.txt

# ~~~~ Generate max_compat files ~~~~

uv pip compile "$@" \
-o dev_tools/requirements/max_compat/dev.env.txt \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed? The output in dev_tools/requirements/max_compat/dev.env.txt is nearly identical to dev_tools/requirements/envs/pytest.env.txt. It appears to be compiled for Python >= 3.12 so the constraints in oldest-versions.txt have no effect.

-c dev_tools/requirements/deps/oldest-versions.txt \
dev_tools/requirements/deps/pytest.txt \
dev_tools/requirements/deps/runtime.txt

uv pip compile "$@" \
-o dev_tools/requirements/max_compat/pytest-max-compat.env.txt \
Comment on lines +102 to +103

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a duplicate of dev_tools/requirements/max_compat/dev.env.txt.
Please fix or delete.

-c dev_tools/requirements/deps/oldest-versions.txt \
-c dev_tools/requirements/max_compat/dev.env.txt \
dev_tools/requirements/deps/pytest.txt \
dev_tools/requirements/deps/runtime.txt
4 changes: 2 additions & 2 deletions dev_tools/requirements/deps/oldest-versions.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Used as a constraint file for pytest-max-compat
cirq-core~=1.4.1
cirq-google~=1.4.1
cirq-core ~= 1.4.1; python_version < "3.11"
cirq-google ~= 1.4.1; python_version < "3.11"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any reference to cirq_google in the repo, please delete if redundant.

4 changes: 2 additions & 2 deletions dev_tools/requirements/deps/resource_estimates_runtime.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pyscf
jax~=0.4.38
jaxlib~=0.4.38
jax
jaxlib
ase
23 changes: 6 additions & 17 deletions dev_tools/requirements/deps/runtime.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
cirq-core>=1.4.1,<1.6.0
cirq-core >= 1.4.1, < 1.6.0; python_version < "3.11"
cirq-core >= 1.6.0; python_version >= "3.11"
Comment on lines +1 to +2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit puzzled why is this needed. cirq-core carries a python_requires metadata so if installing to 3.10, pip should find the latest version 1.5.0 (and later versions for later Pythons).

deprecation
h5py>=3.10.0
h5py
networkx
numpy>=1.26
numpy
pubchempy
requests~=2.34.0

scipy~=1.15

requests
scipy
sympy

# Transitive dependency. Versions 1.3.3+ require Python 311. Constraining it
# lets us produce a single set of requirements files for Python 3.10 - 3.12.
contourpy<1.3.3

# Another transitive dependency. We don't care about the version of this
# backport because it's only needed for a pytest extension. However, because we
# run pip-compile in Python 3.10 for maximum compatibility, we need to add an
# explicit constraint to keep this package out of the requirements files.
backports-asyncio-runner ; python_full_version < '3.11'
Loading
Loading