Facilitate nox integration with uv for Python projects
Project description
Intro
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:
- Import
sessionfromnox_uv. - Set
venv_backendto"uv". This can be done globally usingoptions.default_venv_backend = "uv". - Use the new
uv_*parameters tosessionto control which dependencies are synced into the session's virtual environment in addition to the project's main dependencies.uv syncis used to install dependencies so that their versions are constrained byuv.lock.- By default (configurable with the
uv_sync_lockedparameter),uv.lockis 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", ".")
[!NOTE] All
@session(...)parameters are keywords only, no positional parameters are allowed.
[!NOTE] The
default_groupsdefined inpyproject.tomlare not installed by default. The user must explicitly list the desired groups in theuv_groupsparameter.
Added parameters
uv_groups: list ofuvdependency-groupsuv_extras: list ofuvoptional-dependenciesuv_only_groups: list ofuvonly-groups to include. Prevents installation of project dependenciesuv_all_extras: boolean to install all optional-dependencies frompyproject.tomluv_no_extras: list of extras to exclude during install ofuv_all_extrasuv_all_groups: boolean to install all dependency-groupsuv_no_groups: list of groups to exclude during install ofuv_all_groupsuv_no_install_project: boolean to not install the current projectuv_sync_locked: boolean to validate thatuv.lockis up to date
Inspiration
This is heavily influenced by, but much more limited than, nox-poetry.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nox_uv-0.7.0.tar.gz.
File metadata
- Download URL: nox_uv-0.7.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60ac21c16650f05ebb520d737cc2e838c7a49be2ad1dbcd7165ffd3675560991
|
|
| MD5 |
b96344ac693d963695a346260b6b933b
|
|
| BLAKE2b-256 |
9fa2be2f4d0fd1632213eb5962c8e5ee27def06305403786e21fc3179c7e26e6
|
File details
Details for the file nox_uv-0.7.0-py3-none-any.whl.
File metadata
- Download URL: nox_uv-0.7.0-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51f9bb68ca6d721706f6372f0dec8ebfcc00408c2172b2bfeb6a6c06d9e3ab38
|
|
| MD5 |
76c2311630dfb7c0759fc8d9335fd45f
|
|
| BLAKE2b-256 |
8694afa119b031c08e74a2e078260c5cdbb56b53949e5d2a0158215e8c265e12
|