Skip to content

Commit

Permalink
Use uv for requirements (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz authored Apr 22, 2024
1 parent 7cbcb92 commit 84c355e
Showing 1 changed file with 102 additions and 134 deletions.
236 changes: 102 additions & 134 deletions requirements/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,232 +4,200 @@
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",
"--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",
)

0 comments on commit 84c355e

Please sign in to comment.