Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from pathlib import Path
from tempfile import NamedTemporaryFile

import nox
from nox import Session, param, parametrize, session

Expand Down Expand Up @@ -114,20 +111,22 @@ def docs_github_pages(s: Session) -> None:

@session
def licenses(s: Session) -> None:
# Generate a unique temporary file name. uv cannot write to the temp file directly on
# Windows, so only use the name and allow uv to re-create it.
with NamedTemporaryFile() as t:
requirements_file = Path(t.name)

s.run_always(
# Install only main dependencies for license report.
s.run_install(
"uv",
"export",
"--no-emit-project",
"sync",
"--locked",
"--no-default-groups",
"--no-hashes",
f"--output-file={requirements_file}",
external=True,
"--no-install-project",
f"--python={s.virtualenv.location}",
env={"UV_PROJECT_ENVIRONMENT": s.virtualenv.location},
)
s.run_install(
"uv",
"pip",
"install",
"pip-licenses",
f"--python={s.virtualenv.location}",
env={"UV_PROJECT_ENVIRONMENT": s.virtualenv.location},
)
s.install("pip-licenses", "-r", str(requirements_file))
s.run("pip-licenses", *s.posargs)
requirements_file.unlink()