|
8 | 8 | deps = nox.project.dependency_groups(pyproject, "test") |
9 | 9 | lint_deps = nox.project.dependency_groups(pyproject, "lint") |
10 | 10 | stubs_deps = nox.project.dependency_groups(pyproject, "stubs") |
11 | | -docs_deps = nox.project.dependency_groups(pyproject, "docs") |
12 | 11 |
|
13 | 12 | def install_rustworkx(session): |
14 | 13 | session.install(*deps) |
@@ -39,16 +38,35 @@ def lint(session): |
39 | 38 | session.run("cargo", "fmt", "--all", "--", "--check", external=True) |
40 | 39 | session.run("python", "tools/find_stray_release_notes.py") |
41 | 40 |
|
42 | | -@nox.session(python=["3"]) |
| 41 | +# For uv environments, we keep the virtualenvs separate to avoid conflicts |
| 42 | +@nox.session(python=["3"], venv_backend="uv", reuse_venv=False, default=False) |
43 | 43 | def docs(session): |
44 | | - install_rustworkx(session) |
45 | | - session.install(*docs_deps, "-c", "constraints.txt") |
46 | | - session.run("python", "-m", "ipykernel", "install", "--user") |
47 | | - session.run("jupyter", "kernelspec", "list") |
| 44 | + session.env["UV_PROJECT_ENVIRONMENT"] = session.virtualenv.location |
| 45 | + session.env["UV_FROZEN"] = "1" |
| 46 | + # faster build as generating docs already takes some time and we discard the env |
| 47 | + session.env["SETUPTOOLS_RUST_CARGO_PROFILE"] = "dev" |
| 48 | + session.run("uv", "sync", "--only-group", "docs") |
| 49 | + session.install(".") |
| 50 | + session.run( |
| 51 | + "uv", "run", "--", "python", "-m", "ipykernel", "install", "--user" |
| 52 | + ) |
| 53 | + session.run("uv", "run", "jupyter", "kernelspec", "list") |
48 | 54 | session.chdir("docs") |
49 | | - session.run("sphinx-build", "-W", "-d", "build/.doctrees", "-b", "html", "source", "build/html", *session.posargs) |
| 55 | + session.run( |
| 56 | + "uv", |
| 57 | + "run", |
| 58 | + "sphinx-build", |
| 59 | + "-W", |
| 60 | + "-d", |
| 61 | + "build/.doctrees", |
| 62 | + "-b", |
| 63 | + "html", |
| 64 | + "source", |
| 65 | + "build/html", |
| 66 | + *session.posargs, |
| 67 | + ) |
50 | 68 |
|
51 | | -@nox.session(python=["3"]) |
| 69 | +@nox.session(python=["3"], default=False) |
52 | 70 | def docs_clean(session): |
53 | 71 | session.chdir("docs") |
54 | 72 | session.run("rm", "-rf", "build", "source/apiref", external=True) |
|
0 commit comments