Skip to content

Commit a12785a

Browse files
committed
Simplify licenses session
1 parent 142a9b8 commit a12785a

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

noxfile.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -114,20 +114,22 @@ def docs_github_pages(s: Session) -> None:
114114

115115
@session
116116
def licenses(s: Session) -> None:
117-
# Generate a unique temporary file name. uv cannot write to the temp file directly on
118-
# Windows, so only use the name and allow uv to re-create it.
119-
with NamedTemporaryFile() as t:
120-
requirements_file = Path(t.name)
121-
122-
s.run_always(
117+
# Install only main dependencies for license report.
118+
s.run_install(
123119
"uv",
124-
"export",
125-
"--no-emit-project",
120+
"sync",
121+
"--locked",
126122
"--no-default-groups",
127-
"--no-hashes",
128-
f"--output-file={requirements_file}",
129-
external=True,
123+
"--no-install-project",
124+
f"--python={s.virtualenv.location}",
125+
env={"UV_PROJECT_ENVIRONMENT": s.virtualenv.location},
126+
)
127+
s.run_install(
128+
"uv",
129+
"pip",
130+
"install",
131+
"pip-licenses",
132+
f"--python={s.virtualenv.location}",
133+
env={"UV_PROJECT_ENVIRONMENT": s.virtualenv.location},
130134
)
131-
s.install("pip-licenses", "-r", str(requirements_file))
132135
s.run("pip-licenses", *s.posargs)
133-
requirements_file.unlink()

0 commit comments

Comments
 (0)