Skip to content

Commit

Permalink
Use uv for requirements (#575)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz committed Apr 22, 2024
1 parent f5e3cef commit c8aef22
Show file tree
Hide file tree
Showing 19 changed files with 175 additions and 404 deletions.
237 changes: 103 additions & 134 deletions requirements/compile.py
Expand Up @@ -4,232 +4,201 @@
import os
import subprocess
import sys
from functools import partial
from pathlib import Path

if __name__ == "__main__":
os.chdir(Path(__file__).parent)
os.environ["CUSTOM_COMPILE_COMMAND"] = "requirements/compile.py"
os.environ["PIP_REQUIRE_VIRTUALENV"] = "0"
common_args = [
"-m",
"piptools",
"uv",
"pip",
"compile",
"--quiet",
# On Windows, Django also depends on tzdata, which we aren’t pinning
# "--generate-hashes",
"--allow-unsafe",
] + sys.argv[1:]
subprocess.run(
[
"python3.8",
*common_args,
"-P",
"Django>=3.2a1,<3.3",
"-o",
"--constraint",
"-",
"requirements.in",
*sys.argv[1:],
]
run = partial(subprocess.run, check=True)
run(
[
*common_args,
"--python",
"3.8",
"--output-file",
"py38-django32.txt",
],
check=True,
capture_output=True,
input=b"Django>=3.2a1,<3.3",
)
subprocess.run(
run(
[
"python3.8",
*common_args,
"-P",
"Django>=4.0a1,<4.1",
"-o",
"--python",
"3.8",
"--output-file",
"py38-django40.txt",
],
check=True,
capture_output=True,
input=b"Django>=4.0a1,<4.1",
)
subprocess.run(
run(
[
"python3.8",
*common_args,
"-P",
"Django>=4.1a1,<4.2",
"-o",
"--python",
"3.8",
"--output-file",
"py38-django41.txt",
],
check=True,
capture_output=True,
input=b"Django>=4.1a1,<4.2",
)
subprocess.run(
run(
[
"python3.8",
*common_args,
"-P",
"Django>=4.2a1,<5.0",
"-o",
"--python",
"3.8",
"--output-file",
"py38-django42.txt",
],
check=True,
capture_output=True,
input=b"Django>=4.2a1,<5.0",
)
subprocess.run(
run(
[
"python3.9",
*common_args,
"-P",
"Django>=3.2a1,<3.3",
"-o",
"--python",
"3.9",
"--output-file",
"py39-django32.txt",
],
check=True,
capture_output=True,
input=b"Django>=3.2a1,<3.3",
)
subprocess.run(
run(
[
"python3.9",
*common_args,
"-P",
"Django>=4.0a1,<4.1",
"-o",
"--python",
"3.9",
"--output-file",
"py39-django40.txt",
],
check=True,
capture_output=True,
input=b"Django>=4.0a1,<4.1",
)
subprocess.run(
run(
[
"python3.9",
*common_args,
"-P",
"Django>=4.1a1,<4.2",
"-o",
"--python",
"3.9",
"--output-file",
"py39-django41.txt",
],
check=True,
capture_output=True,
input=b"Django>=4.1a1,<4.2",
)
subprocess.run(
run(
[
"python3.9",
*common_args,
"-P",
"Django>=4.2a1,<5.0",
"-o",
"--python",
"3.9",
"--output-file",
"py39-django42.txt",
],
check=True,
capture_output=True,
input=b"Django>=4.2a1,<5.0",
)
subprocess.run(
run(
[
"python3.10",
*common_args,
"-P",
"Django>=3.2a1,<3.3",
"-o",
"--python",
"3.10",
"--output-file",
"py310-django32.txt",
],
check=True,
capture_output=True,
input=b"Django>=3.2a1,<3.3",
)
subprocess.run(
run(
[
"python3.10",
*common_args,
"-P",
"Django>=4.0a1,<4.1",
"-o",
"--python",
"3.10",
"--output-file",
"py310-django40.txt",
],
check=True,
capture_output=True,
input=b"Django>=4.0a1,<4.1",
)
subprocess.run(
run(
[
"python3.10",
*common_args,
"-P",
"Django>=4.1a1,<4.2",
"-o",
"--python",
"3.10",
"--output-file",
"py310-django41.txt",
],
check=True,
capture_output=True,
input=b"Django>=4.1a1,<4.2",
)
subprocess.run(
run(
[
"python3.10",
*common_args,
"-P",
"Django>=4.2a1,<5.0",
"-o",
"--python",
"3.10",
"--output-file",
"py310-django42.txt",
],
check=True,
capture_output=True,
input=b"Django>=4.2a1,<5.0",
)
subprocess.run(
run(
[
"python3.10",
*common_args,
"-P",
"Django>=5.0a1,<5.1",
"-o",
"--python",
"3.10",
"--output-file",
"py310-django50.txt",
],
check=True,
capture_output=True,
input=b"Django>=5.0a1,<5.1",
)
subprocess.run(
run(
[
"python3.11",
*common_args,
"-P",
"Django>=4.1a1,<4.2",
"-o",
"--python",
"3.11",
"--output-file",
"py311-django41.txt",
],
check=True,
capture_output=True,
input=b"Django>=4.1a1,<4.2",
)
subprocess.run(
run(
[
"python3.11",
*common_args,
"-P",
"Django>=4.2a1,<5.0",
"-o",
"--python",
"3.11",
"--output-file",
"py311-django42.txt",
],
check=True,
capture_output=True,
input=b"Django>=4.2a1,<5.0",
)
subprocess.run(
run(
[
"python3.11",
*common_args,
"-P",
"Django>=5.0a1,<5.1",
"-o",
"--python",
"3.11",
"--output-file",
"py311-django50.txt",
],
check=True,
capture_output=True,
input=b"Django>=5.0a1,<5.1",
)
subprocess.run(
run(
[
"python3.12",
*common_args,
"-P",
"Django>=4.2a1,<5.0",
"-o",
"--python",
"3.12",
"--output-file",
"py312-django42.txt",
],
check=True,
capture_output=True,
input=b"Django>=4.2a1,<5.0",
)
subprocess.run(
run(
[
"python3.12",
*common_args,
"-P",
"Django>=5.0a1,<5.1",
"-o",
"--python",
"3.12",
"--output-file",
"py312-django50.txt",
],
check=True,
capture_output=True,
input=b"Django>=5.0a1,<5.1",
)
19 changes: 4 additions & 15 deletions requirements/py310-django32.txt
@@ -1,21 +1,14 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# requirements/compile.py
#
# This file was autogenerated by uv via the following command:
# uv pip compile --constraint - requirements.in --python 3.10 --output-file py310-django32.txt
asgiref==3.8.1
# via django
brotli==1.1.0
# via -r requirements.in
certifi==2024.2.2
# via requests
charset-normalizer==3.3.2
# via requests
coverage[toml]==7.4.4
# via -r requirements.in
coverage==7.4.4
django==3.2.25
# via -r requirements.in
exceptiongroup==1.2.1
# via pytest
idna==3.7
Expand All @@ -27,15 +20,11 @@ packaging==24.0
pluggy==1.5.0
# via pytest
pytest==8.1.1
# via
# -r requirements.in
# pytest-randomly
# via pytest-randomly
pytest-randomly==3.15.0
# via -r requirements.in
pytz==2024.1
# via django
requests==2.31.0
# via -r requirements.in
sqlparse==0.5.0
# via django
tomli==2.0.1
Expand Down

0 comments on commit c8aef22

Please sign in to comment.