Skip to content

Commit 41455f3

Browse files
committed
-> native uv for dpeendency groups.
1 parent e93532d commit 41455f3

File tree

7 files changed

+934
-149
lines changed

7 files changed

+934
-149
lines changed

docs/requirements.in

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/requirements.txt

Lines changed: 0 additions & 84 deletions
This file was deleted.

noxfile.py

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@
99
DOCS = ROOT / "docs"
1010
TESTS = ROOT / "tests"
1111

12-
REQUIREMENTS = dict(
13-
docs=DOCS / "requirements.txt",
14-
tests=TESTS / "requirements.txt",
15-
)
16-
REQUIREMENTS_IN = [ # this is actually ordered, as files depend on each other
17-
(path.parent / f"{path.stem}.in", path) for path in REQUIREMENTS.values()
18-
]
19-
2012
SUPPORTED = [
2113
"3.10",
2214
"3.11",
@@ -29,7 +21,7 @@
2921
]
3022
LATEST = SUPPORTED[-1]
3123

32-
nox.options.default_venv_backend = "uv|virtualenv"
24+
nox.options.default_venv_backend = "uv"
3325
nox.options.sessions = []
3426

3527

@@ -52,12 +44,15 @@ def tests(session):
5244
# but it produces strange symbol errors saying:
5345
# dynamic module does not define module export function (PyInit_rpds)
5446
# so OK, dev it is.
55-
session.install(
56-
"--config-settings",
47+
session.run_install(
48+
"uv",
49+
"sync",
50+
"--group=test",
51+
"--config-setting",
5752
"build-args=--profile=dev",
5853
"--no-cache",
59-
"-r",
60-
REQUIREMENTS["tests"],
54+
f"--python={session.virtualenv.location}",
55+
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
6156
)
6257

6358
if session.posargs and session.posargs[0] == "coverage":
@@ -89,9 +84,15 @@ def build(session):
8984
"""
9085
Build a distribution suitable for PyPI and check its validity.
9186
"""
92-
session.install("build", "twine")
87+
session.install("build[uv]", "twine")
9388
with TemporaryDirectory() as tmpdir:
94-
session.run("python", "-m", "build", ROOT, "--outdir", tmpdir)
89+
session.run(
90+
"pyproject-build",
91+
"--installer=uv",
92+
ROOT,
93+
"--outdir",
94+
tmpdir,
95+
)
9596
session.run("twine", "check", "--strict", tmpdir + "/*")
9697

9798

@@ -109,7 +110,16 @@ def typing(session):
109110
"""
110111
Check the codebase using pyright by type checking the test suite.
111112
"""
112-
session.install("pyright", ROOT, "-r", REQUIREMENTS["tests"])
113+
session.run_install(
114+
"uv",
115+
"sync",
116+
"--group=typing",
117+
"--config-setting",
118+
"build-args=--profile=dev",
119+
"--no-cache",
120+
f"--python={session.virtualenv.location}",
121+
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
122+
)
113123
session.run("pyright", TESTS)
114124

115125

@@ -131,7 +141,16 @@ def docs(session, builder):
131141
"""
132142
Build the documentation using a specific Sphinx builder.
133143
"""
134-
session.install("-r", REQUIREMENTS["docs"])
144+
session.run_install(
145+
"uv",
146+
"sync",
147+
"--group=docs",
148+
"--config-setting",
149+
"build-args=--profile=dev",
150+
"--no-cache",
151+
f"--python={session.virtualenv.location}",
152+
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
153+
)
135154
with TemporaryDirectory() as tmpdir_str:
136155
tmpdir = Path(tmpdir_str)
137156
argv = ["-n", "-T", "-W"]
@@ -161,22 +180,3 @@ def docs_style(session):
161180
"pygments-github-lexers",
162181
)
163182
session.run("python", "-m", "doc8", "--config", PYPROJECT, DOCS)
164-
165-
166-
@session(default=False)
167-
def requirements(session):
168-
"""
169-
Update the project's pinned requirements.
170-
171-
You should commit the result afterwards.
172-
"""
173-
if session.venv_backend == "uv":
174-
cmd = ["uv", "pip", "compile"]
175-
else:
176-
session.install("pip-tools")
177-
cmd = ["pip-compile", "--resolver", "backtracking", "--strip-extras"]
178-
179-
for each, out in REQUIREMENTS_IN:
180-
# otherwise output files end up with silly absolute path comments...
181-
relative = each.relative_to(ROOT)
182-
session.run(*cmd, "--upgrade", "--output-file", out, relative)

pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,22 @@ known-first-party = ["rpds"]
139139
"noxfile.py" = ["ANN", "D100", "S101", "T201"]
140140
"docs/*" = ["ANN", "D", "INP001"]
141141
"tests/*" = ["ANN", "B018", "D", "PLR", "RUF012", "S", "SIM", "TRY"]
142+
143+
[dependency-groups]
144+
docs = [
145+
"furo>=2025.9.25",
146+
"pygments-github-lexers>=0.0.5",
147+
"sphinx>5",
148+
"sphinx-copybutton>=0.5.2",
149+
"sphinxcontrib-spelling>5",
150+
"sphinxext-opengraph>=0.13.0",
151+
"url-py>=0.18.0",
152+
]
153+
test = [
154+
"pytest>=9.0.1",
155+
"pytest-run-parallel>=0.7.1",
156+
]
157+
typing = [
158+
{ include-group = "test" },
159+
"pyright>=1.1.407",
160+
]

tests/requirements.in

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/requirements.txt

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)