Skip to content

Commit

Permalink
Use uv with the local nox session (#10540)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex authored Mar 6, 2024
1 parent 7c72b45 commit c48eabb
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@
nox.options.reuse_existing_virtualenvs = True


def install(session: nox.Session, *args: str, silent: bool = False) -> None:
if not silent:
def install(
session: nox.Session,
*args: str,
verbose: bool = True,
) -> None:
if verbose:
args += ("-v",)
session.install(
"-c",
"ci-constraints-requirements.txt",
*args,
silent=silent,
silent=False,
)


Expand Down Expand Up @@ -247,7 +251,7 @@ def rust(session: nox.Session) -> None:
process_rust_coverage(session, rust_tests, prof_location)


@nox.session
@nox.session(venv_backend="uv")
def local(session):
pyproject_data = load_pyproject_toml()
test_dependencies = pyproject_data["project"]["optional-dependencies"][
Expand All @@ -261,11 +265,9 @@ def local(session):
*test_dependencies,
*pyproject_data["project"]["optional-dependencies"]["ssh"],
*pyproject_data["project"]["optional-dependencies"]["nox"],
"flit",
silent=True,
"cryptography_vectors @ ./vectors/",
verbose=False,
)
with session.cd("vectors/"):
session.run("flit", "install", "-s", silent=True)

session.run("ruff", "format", ".")
session.run("ruff", "check", ".")
Expand All @@ -292,7 +294,15 @@ def local(session):
"noxfile.py",
)

install(session, ".")
install(
session,
# Needed until https://github.com/astral-sh/uv/issues/2152 is fixed
"--reinstall-package",
"cryptography",
"--refresh-package",
"cryptography",
"cryptography @ .",
)

if session.posargs:
tests = session.posargs
Expand Down

0 comments on commit c48eabb

Please sign in to comment.