Skip to content

Commit

Permalink
Use uv for envs, particularly the requirements env.
Browse files Browse the repository at this point in the history
Faster, etc.
  • Loading branch information
Julian committed Apr 21, 2024
1 parent 33a6ccf commit d031bce
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 51 deletions.
33 changes: 10 additions & 23 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --strip-extras docs/requirements.in
#
# This file was autogenerated by uv via the following command:
# uv pip compile --output-file docs/requirements.txt docs/requirements.in
alabaster==0.7.16
# via sphinx
attrs==23.2.0
Expand All @@ -16,21 +12,20 @@ certifi==2024.2.2
# via requests
charset-normalizer==3.3.2
# via requests
docutils==0.20.1
docutils==0.21.1
# via sphinx
furo==2024.1.29
# via -r docs/requirements.in
idna==3.6
idna==3.7
# via requests
imagesize==1.4.1
# via sphinx
jinja2==3.1.3
# via sphinx
lxml==5.1.0
lxml==5.2.1
# via sphinx-json-schema-spec
markupsafe==2.1.5
# via jinja2
packaging==23.2
packaging==24.0
# via sphinx
pyenchant==3.2.2
# via sphinxcontrib-spelling
Expand All @@ -40,20 +35,17 @@ pygments==2.17.2
# pygments-github-lexers
# sphinx
pygments-github-lexers==0.0.5
# via -r docs/requirements.in
file:.#egg=referencing
# via -r docs/requirements.in
referencing @ file:.#egg=referencing
requests==2.31.0
# via sphinx
rpds-py==0.17.1
rpds-py==0.18.0
# via referencing
snowballstemmer==2.2.0
# via sphinx
soupsieve==2.5
# via beautifulsoup4
sphinx==7.2.6
sphinx==7.3.7
# via
# -r docs/requirements.in
# furo
# sphinx-basic-ng
# sphinx-copybutton
Expand All @@ -63,9 +55,7 @@ sphinx==7.2.6
sphinx-basic-ng==1.0.0b2
# via furo
sphinx-copybutton==0.5.2
# via -r docs/requirements.in
sphinx-json-schema-spec==2024.1.1
# via -r docs/requirements.in
sphinxcontrib-applehelp==1.0.8
# via sphinx
sphinxcontrib-devhelp==1.0.6
Expand All @@ -79,10 +69,7 @@ sphinxcontrib-qthelp==1.0.7
sphinxcontrib-serializinghtml==1.1.10
# via sphinx
sphinxcontrib-spelling==8.0.0
# via -r docs/requirements.in
sphinxext-opengraph==0.9.1
# via -r docs/requirements.in
url-py==0.10.0
# via -r docs/requirements.in
urllib3==2.2.0
urllib3==2.2.1
# via requests
23 changes: 12 additions & 11 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
tests=ROOT / "test-requirements.txt",
)
REQUIREMENTS_IN = [ # this is actually ordered, as files depend on each other
path.parent / f"{path.stem}.in" for path in REQUIREMENTS.values()
(path.parent / f"{path.stem}.in", path) for path in REQUIREMENTS.values()
]

SUPPORTED = ["3.8", "3.9", "3.10", "pypy3.10", "3.11", "3.12"]
LATEST = SUPPORTED[-1]

nox.options.default_venv_backend = "uv|virtualenv"
nox.options.sessions = []


Expand Down Expand Up @@ -167,13 +168,13 @@ def requirements(session):
You should commit the result afterwards.
"""
session.install("pip-tools")
for each in REQUIREMENTS_IN:
session.run(
"pip-compile",
"--resolver",
"backtracking",
"--strip-extras",
"-U",
each.relative_to(ROOT),
)
if session.venv_backend == "uv":
cmd = ["uv", "pip", "compile"]
else:
session.install("pip-tools")
cmd = ["pip-compile", "--resolver", "backtracking", "--strip-extras"]

for each, out in REQUIREMENTS_IN:
# otherwise output files end up with silly absolute path comments...
relative = each.relative_to(ROOT)
session.run(*cmd, "--upgrade", "--output-file", out, relative)
26 changes: 9 additions & 17 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --strip-extras test-requirements.in
#
# This file was autogenerated by uv via the following command:
# uv pip compile --output-file test-requirements.txt test-requirements.in
attrs==23.2.0
# via
# pytest-subtests
# referencing
iniconfig==2.0.0
# via pytest
packaging==23.2
packaging==24.0
# via pytest
pluggy==1.4.0
pluggy==1.5.0
# via pytest
pytest==8.0.0
# via
# -r test-requirements.in
# pytest-subtests
pytest-subtests==0.11.0
# via -r test-requirements.in
file:.#egg=referencing
# via -r test-requirements.in
rpds-py==0.17.1
pytest==8.1.1
# via pytest-subtests
pytest-subtests==0.12.1
referencing @ file:.#egg=referencing
rpds-py==0.18.0
# via referencing

0 comments on commit d031bce

Please sign in to comment.