Skip to main content

Intro

GitHub Actions PyPI version Python versions uv Nox Ruff Type checked with mypy Python Blueprint

nox-uv is a simple drop-in replacement for nox's @nox.session that installs dependencies constrained by uv's lockfile.

Usage

Add nox-uv as a development dependency. The following example adds it into a nox dependency-group.

uv add --group nox nox-uv

Using the following configuration within pyproject.toml as an example:

[dependency-groups]
nox = [
    "nox-uv",
]
test = [
    "pytest",
    "pytest-cov",
]
type_check = [
    "mypy",
]
lint = [
    "ruff",
]

Within, your noxfile.py:

  1. Import session from nox_uv.
  2. Set venv_backend to "uv". This can be done globally using options.default_venv_backend = "uv".
  3. Use the new uv_* parameters to session to control which dependencies are synced into the session's virtual environment in addition to the project's main dependencies.
    • uv sync is used to install dependencies so that their versions are constrained by uv.lock.
    • By default (configurable with the uv_sync_locked parameter), uv.lock is also validated to be up to date.
from nox import Session, options
from nox_uv import session

options.default_venv_backend = "uv"


@session(
    python=["3.10", "3.11", "3.12", "3.13", "3.14"],
    uv_groups=["test"],
)
def test(s: Session) -> None:
    s.run("python", "-m", "pytest")


@session(uv_groups=["type_check"])
def type_check(s: Session) -> None:
    s.run("mypy", "src")


@session(uv_only_groups=["lint"])
def lint(s: Session) -> None:
    s.run("ruff", "check", ".")
    s.run("ruff", "format", "--check", ".")

Added parameters

  • uv_groups: list of uv dependency-groups
  • uv_extras: list of uv optional-dependencies
  • uv_only_groups: list of uv only-groups to include. Prevents installation of project dependencies
  • uv_all_extras: boolean to install all optional-dependencies from pyproject.toml
  • uv_no_extras: list of extras to exclude during install of uv_all_extras
  • uv_all_groups: boolean to install all dependency-groups
  • uv_no_groups: list of groups to exclude during install of uv_all_groups
  • uv_no_install_project: boolean to not install the current project
  • uv_packages: list of uv packages to install, only valid in a uv workspace.
  • uv_all_packages: boolean to install all uv packages, only valid in a uv workspace.
  • uv_sync_locked: boolean to validate that uv.lock is up to date
  • uv_quiet: boolean to silence uv sync command

Inspiration

This is heavily influenced by, but much more limited than, nox-poetry.

Release files for nox-uv 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nox-uv 0.8.0
File Size Uploaded
nox_uv-0.8.0.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nox-uv 0.8.0
File Interpreter ABI Platform
nox_uv-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.0 kB

Release files / nox_uv-0.8.0.tar.gz

Download URL nox_uv-0.8.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
609595d9c4983b1c4abe8b44299b4223fb876f3794012a633c94acae697ed485
BLAKE2b-256 checksum
How to use checksums
3eb85a186592e002ac454450d6a43d6171b6207b0b4141db78464f7d4672ae8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.2","id":"zara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / nox_uv-0.8.0-py3-none-any.whl

Download URL nox_uv-0.8.0-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f62c0e016fd8403fd4352ec1e6eb06d6f9967adc44bba74524d7f74da5ac1b19
BLAKE2b-256 checksum
How to use checksums
0294a2dae05f049990adff252037252da412f56fadd358fb3eca474c838c3dc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.2","id":"zara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page