-
Notifications
You must be signed in to change notification settings - Fork 424
Replace pip-compile-based dependency management with uv-based approach
#1352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
eea01ac
60eca48
9dfc625
a408926
78544f6
85c5313
03e1a63
2b14198
3b060e3
2b546b4
9ea386a
76f861d
f00d09c
7d366bc
a590d14
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| 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 ;; | ||
| *) 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 \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this still needed? The output in |
||
| -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like a duplicate of |
||
| -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 | ||
| 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" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see any reference to |
||
| 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 |
| 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| 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' | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit - can we handle
--helptoo for a good measure?