nox-uv 0.4.0__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nox_uv-0.4.0 → nox_uv-0.6.0}/.github/workflows/ci.yml +1 -3
- {nox_uv-0.4.0 → nox_uv-0.6.0}/PKG-INFO +7 -6
- {nox_uv-0.4.0 → nox_uv-0.6.0}/README.md +6 -5
- {nox_uv-0.4.0 → nox_uv-0.6.0}/noxfile.py +5 -23
- {nox_uv-0.4.0 → nox_uv-0.6.0}/pyproject.toml +5 -2
- {nox_uv-0.4.0 → nox_uv-0.6.0}/src/nox_uv/__init__.py +12 -5
- {nox_uv-0.4.0 → nox_uv-0.6.0}/tests/subproject/noxfile.py +22 -6
- {nox_uv-0.4.0 → nox_uv-0.6.0}/tests/subproject/pyproject.toml +8 -3
- nox_uv-0.6.0/tests/subproject/src/subproject/__init__.py +0 -0
- {nox_uv-0.4.0 → nox_uv-0.6.0}/tests/subproject/uv.lock +6 -3
- nox_uv-0.6.0/uv.lock +429 -0
- nox_uv-0.4.0/uv.lock +0 -411
- {nox_uv-0.4.0 → nox_uv-0.6.0}/.editorconfig +0 -0
- {nox_uv-0.4.0 → nox_uv-0.6.0}/.gitignore +0 -0
- {nox_uv-0.4.0 → nox_uv-0.6.0}/.python-version +0 -0
- {nox_uv-0.4.0 → nox_uv-0.6.0}/LICENSE.txt +0 -0
- {nox_uv-0.4.0 → nox_uv-0.6.0}/src/nox_uv/py.typed +0 -0
- {nox_uv-0.4.0 → nox_uv-0.6.0}/tests/__init__.py +0 -0
- {nox_uv-0.4.0 → nox_uv-0.6.0}/tests/subproject/.python-version +0 -0
- {nox_uv-0.4.0 → nox_uv-0.6.0}/tests/subproject/README.md +0 -0
- {nox_uv-0.4.0/tests → nox_uv-0.6.0/tests/subproject/src}/subproject/main.py +0 -0
- {nox_uv-0.4.0 → nox_uv-0.6.0}/tests/test_lib.py +0 -0
|
@@ -3,7 +3,7 @@ name: CI
|
|
|
3
3
|
on: [push, pull_request]
|
|
4
4
|
|
|
5
5
|
env:
|
|
6
|
-
UV_VERSION: "0.7.
|
|
6
|
+
UV_VERSION: "0.7.12"
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
9
|
test:
|
|
@@ -15,8 +15,6 @@ jobs:
|
|
|
15
15
|
- uses: actions/checkout@v4
|
|
16
16
|
- name: Install uv
|
|
17
17
|
uses: astral-sh/setup-uv@v5
|
|
18
|
-
# Caching is enabled by default for GitHub-hosted runners:
|
|
19
|
-
# https://github.com/astral-sh/setup-uv?tab=readme-ov-file#enable-caching
|
|
20
18
|
with:
|
|
21
19
|
version: ${{ env.UV_VERSION }}
|
|
22
20
|
- name: Set up Python ${{ matrix.python-version }}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nox-uv
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: Facilitate nox integration with uv for Python projects
|
|
5
5
|
Project-URL: Homepage, https://github.com/dantebben/nox-uv
|
|
6
6
|
Project-URL: Repository, https://github.com/dantebben/nox-uv
|
|
@@ -44,8 +44,8 @@ Description-Content-Type: text/markdown
|
|
|
44
44
|
[ruff-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
|
|
45
45
|
[mypy-badge]: https://www.mypy-lang.org/static/mypy_badge.svg
|
|
46
46
|
|
|
47
|
-
`nox-uv` is a simple drop-in replacement for [nox](https://nox.thea.codes/)'s `@nox.session` that
|
|
48
|
-
dependencies constrained by [uv](https://docs.astral.sh/uv/)'s lockfile.
|
|
47
|
+
`nox-uv` is a simple drop-in replacement for [nox](https://nox.thea.codes/)'s `@nox.session` that
|
|
48
|
+
installs dependencies constrained by [uv](https://docs.astral.sh/uv/)'s lockfile.
|
|
49
49
|
|
|
50
50
|
## Usage
|
|
51
51
|
|
|
@@ -107,7 +107,7 @@ def type_check(s: Session) -> None:
|
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
@session(uv_only_groups=["lint"])
|
|
110
|
-
def
|
|
110
|
+
def lint(s: Session) -> None:
|
|
111
111
|
s.run("ruff", "check", ".")
|
|
112
112
|
s.run("ruff", "format", "--check", ".")
|
|
113
113
|
```
|
|
@@ -124,10 +124,11 @@ def type_check(s: Session) -> None:
|
|
|
124
124
|
- `uv_groups`: list of `uv` _dependency-groups_
|
|
125
125
|
- `uv_extras`: list of `uv` _optional-dependencies_
|
|
126
126
|
- `uv_only_groups`: list of `uv` _only-groups_ to include. Prevents installation of project
|
|
127
|
-
_dependencies_
|
|
127
|
+
_dependencies_
|
|
128
128
|
- `uv_all_extras`: boolean to install all _optional-dependencies_ from `pyproject.toml`
|
|
129
129
|
- `uv_all_groups`: boolean to install all _dependency-groups_
|
|
130
|
-
- `
|
|
130
|
+
- `uv_no_install_project`: boolean to not install the current project
|
|
131
|
+
- `uv_sync_locked`: boolean to validate that `uv.lock` is up to date
|
|
131
132
|
|
|
132
133
|
|
|
133
134
|
## Inspiration
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
[ruff-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
|
|
17
17
|
[mypy-badge]: https://www.mypy-lang.org/static/mypy_badge.svg
|
|
18
18
|
|
|
19
|
-
`nox-uv` is a simple drop-in replacement for [nox](https://nox.thea.codes/)'s `@nox.session` that
|
|
20
|
-
dependencies constrained by [uv](https://docs.astral.sh/uv/)'s lockfile.
|
|
19
|
+
`nox-uv` is a simple drop-in replacement for [nox](https://nox.thea.codes/)'s `@nox.session` that
|
|
20
|
+
installs dependencies constrained by [uv](https://docs.astral.sh/uv/)'s lockfile.
|
|
21
21
|
|
|
22
22
|
## Usage
|
|
23
23
|
|
|
@@ -79,7 +79,7 @@ def type_check(s: Session) -> None:
|
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
@session(uv_only_groups=["lint"])
|
|
82
|
-
def
|
|
82
|
+
def lint(s: Session) -> None:
|
|
83
83
|
s.run("ruff", "check", ".")
|
|
84
84
|
s.run("ruff", "format", "--check", ".")
|
|
85
85
|
```
|
|
@@ -96,10 +96,11 @@ def type_check(s: Session) -> None:
|
|
|
96
96
|
- `uv_groups`: list of `uv` _dependency-groups_
|
|
97
97
|
- `uv_extras`: list of `uv` _optional-dependencies_
|
|
98
98
|
- `uv_only_groups`: list of `uv` _only-groups_ to include. Prevents installation of project
|
|
99
|
-
_dependencies_
|
|
99
|
+
_dependencies_
|
|
100
100
|
- `uv_all_extras`: boolean to install all _optional-dependencies_ from `pyproject.toml`
|
|
101
101
|
- `uv_all_groups`: boolean to install all _dependency-groups_
|
|
102
|
-
- `
|
|
102
|
+
- `uv_no_install_project`: boolean to not install the current project
|
|
103
|
+
- `uv_sync_locked`: boolean to validate that `uv.lock` is up to date
|
|
103
104
|
|
|
104
105
|
|
|
105
106
|
## Inspiration
|
|
@@ -4,12 +4,7 @@ from nox_uv import session
|
|
|
4
4
|
|
|
5
5
|
options.error_on_external_run = True
|
|
6
6
|
options.default_venv_backend = "uv"
|
|
7
|
-
options.sessions = ["
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@session(venv_backend="none")
|
|
11
|
-
def uv_lock_check(s: Session) -> None:
|
|
12
|
-
s.run("uv", "lock", "--check")
|
|
7
|
+
options.sessions = ["lint", "type_check", "test"]
|
|
13
8
|
|
|
14
9
|
|
|
15
10
|
@session(
|
|
@@ -31,9 +26,7 @@ def test(s: Session) -> None:
|
|
|
31
26
|
)
|
|
32
27
|
|
|
33
28
|
|
|
34
|
-
|
|
35
|
-
# environment. This requires that nox is run within `poetry shell` or using `poetry run nox ...`.
|
|
36
|
-
@session(venv_backend="none")
|
|
29
|
+
@session(uv_only_groups=["lint"])
|
|
37
30
|
@parametrize(
|
|
38
31
|
"command",
|
|
39
32
|
[
|
|
@@ -57,7 +50,7 @@ def fmt(s: Session, command: list[str]) -> None:
|
|
|
57
50
|
s.run(*command)
|
|
58
51
|
|
|
59
52
|
|
|
60
|
-
@session(
|
|
53
|
+
@session(uv_only_groups=["lint"])
|
|
61
54
|
@parametrize(
|
|
62
55
|
"command",
|
|
63
56
|
[
|
|
@@ -69,22 +62,11 @@ def lint(s: Session, command: list[str]) -> None:
|
|
|
69
62
|
s.run(*command)
|
|
70
63
|
|
|
71
64
|
|
|
72
|
-
@session(
|
|
65
|
+
@session(uv_only_groups=["lint"])
|
|
73
66
|
def lint_fix(s: Session) -> None:
|
|
74
67
|
s.run("ruff", "check", ".", "--extend-fixable", "F401", "--fix")
|
|
75
68
|
|
|
76
69
|
|
|
77
|
-
@session(
|
|
70
|
+
@session(uv_groups=["test", "type_check"])
|
|
78
71
|
def type_check(s: Session) -> None:
|
|
79
72
|
s.run("mypy", "src", "tests", "noxfile.py")
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
@session(venv_backend="none")
|
|
83
|
-
def simple_test(s: Session) -> None:
|
|
84
|
-
assert 1 == 1
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
@session(venv_backend="none")
|
|
88
|
-
def run_test_as_session(s: Session) -> None:
|
|
89
|
-
"""Test ability to call a nother session."""
|
|
90
|
-
simple_test(s)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "nox-uv"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.6.0"
|
|
4
4
|
description = "Facilitate nox integration with uv for Python projects"
|
|
5
5
|
keywords = ["nox", "uv"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -44,9 +44,12 @@ lint = [
|
|
|
44
44
|
"ruff>=0.9.7",
|
|
45
45
|
]
|
|
46
46
|
test = [
|
|
47
|
+
# TODO: Remove this upper bound with pytest-cov fixes issues with filterwarnings = ["error"]
|
|
48
|
+
# https://github.com/pytest-dev/pytest-cov/issues/693
|
|
49
|
+
"pytest<8.4.0",
|
|
47
50
|
"pytest-cov>=6.0.0",
|
|
48
51
|
]
|
|
49
|
-
|
|
52
|
+
type_check = [
|
|
50
53
|
"mypy>=1.15.0",
|
|
51
54
|
]
|
|
52
55
|
|
|
@@ -26,6 +26,7 @@ def session(
|
|
|
26
26
|
uv_only_groups: Sequence[str] = (),
|
|
27
27
|
uv_all_extras: bool = False,
|
|
28
28
|
uv_all_groups: bool = False,
|
|
29
|
+
uv_no_install_project: bool = False,
|
|
29
30
|
uv_sync_locked: bool = True,
|
|
30
31
|
**kwargs: dict[str, Any],
|
|
31
32
|
) -> Callable[..., Callable[..., R]]:
|
|
@@ -34,7 +35,7 @@ def session(
|
|
|
34
35
|
Args:
|
|
35
36
|
args: Positional arguments are forwarded to ``nox.session``.
|
|
36
37
|
kwargs: Keyword arguments are forwarded to ``nox.session``. Used to catch any future
|
|
37
|
-
arguments of nox.session that aren't
|
|
38
|
+
arguments of nox.session that aren't explicitly captured in nox_uv.session.
|
|
38
39
|
|
|
39
40
|
Returns:
|
|
40
41
|
The decorated session function.
|
|
@@ -55,6 +56,7 @@ def session(
|
|
|
55
56
|
uv_all_extras=uv_all_extras,
|
|
56
57
|
uv_all_groups=uv_all_groups,
|
|
57
58
|
uv_only_groups=uv_only_groups,
|
|
59
|
+
uv_no_install_project=uv_no_install_project,
|
|
58
60
|
uv_sync_locked=uv_sync_locked,
|
|
59
61
|
**kwargs,
|
|
60
62
|
) # type: ignore
|
|
@@ -84,6 +86,9 @@ def session(
|
|
|
84
86
|
if uv_all_extras:
|
|
85
87
|
extended_cmd.append("--all-extras")
|
|
86
88
|
|
|
89
|
+
if uv_no_install_project:
|
|
90
|
+
extended_cmd.append("--no-install-project")
|
|
91
|
+
|
|
87
92
|
sync_cmd += extended_cmd
|
|
88
93
|
|
|
89
94
|
@functools.wraps(function)
|
|
@@ -94,15 +99,17 @@ def session(
|
|
|
94
99
|
# UV called from Nox does not respect the Python version set in the Nox session.
|
|
95
100
|
# We need to pass the Python version to UV explicitly.
|
|
96
101
|
if s.python is not None:
|
|
97
|
-
|
|
98
|
-
# for the type checker.
|
|
99
|
-
s.env["UV_PYTHON"] = str(s.python)
|
|
102
|
+
s.env["UV_PYTHON"] = s.virtualenv.location
|
|
100
103
|
|
|
104
|
+
s.debug(
|
|
105
|
+
f"UV_PYTHON={s.env['UV_PYTHON']} | "
|
|
106
|
+
f"UV_PROJECT_ENVIRONMENT={s.env['UV_PROJECT_ENVIRONMENT']}"
|
|
107
|
+
)
|
|
101
108
|
s.run_install(*sync_cmd)
|
|
102
109
|
else:
|
|
103
110
|
if len(extended_cmd) > 0:
|
|
104
111
|
raise s.error(
|
|
105
|
-
'Using "uv" specific
|
|
112
|
+
'Using "uv" specific parameters is not allowed outside of a "uv" '
|
|
106
113
|
"venv_backend.\n"
|
|
107
114
|
f"Check the venv_backend, or the {extended_cmd} parameters."
|
|
108
115
|
)
|
|
@@ -3,8 +3,6 @@ from nox import Session, options
|
|
|
3
3
|
from nox_uv import session
|
|
4
4
|
|
|
5
5
|
options.default_venv_backend = "uv"
|
|
6
|
-
options.reuse_existing_virtualenvs = False
|
|
7
|
-
|
|
8
6
|
options.sessions = [
|
|
9
7
|
"check_python_version",
|
|
10
8
|
"install_nothing",
|
|
@@ -14,12 +12,14 @@ options.sessions = [
|
|
|
14
12
|
"one_extra",
|
|
15
13
|
"correct_python",
|
|
16
14
|
"only_groups",
|
|
15
|
+
"no_install_project",
|
|
16
|
+
"do_install_project",
|
|
17
17
|
]
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
@session(venv_backend="none")
|
|
21
21
|
def check_python_version(s: Session) -> None:
|
|
22
|
-
s.run("
|
|
22
|
+
s.run("python", "--version")
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
@session
|
|
@@ -74,7 +74,7 @@ def one_extra(s: Session) -> None:
|
|
|
74
74
|
@session(python=["3.10"])
|
|
75
75
|
def correct_python(s: Session) -> None:
|
|
76
76
|
assert s.python == "3.10"
|
|
77
|
-
v = s.run("
|
|
77
|
+
v = s.run("python", "--version", silent=True)
|
|
78
78
|
if isinstance(v, str):
|
|
79
79
|
assert "Python 3.10" in v
|
|
80
80
|
else:
|
|
@@ -89,11 +89,27 @@ def only_groups(s: Session) -> None:
|
|
|
89
89
|
assert "nox-uv" not in r
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
@session(uv_groups=["
|
|
92
|
+
@session(uv_no_install_project=True, uv_groups=["lint"])
|
|
93
|
+
def no_install_project(s: Session) -> None:
|
|
94
|
+
r = s.run("uv", "pip", "list", silent=True)
|
|
95
|
+
assert isinstance(r, str)
|
|
96
|
+
assert "ruff" in r
|
|
97
|
+
assert "subproject" not in r
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@session(uv_groups=["lint"])
|
|
101
|
+
def do_install_project(s: Session) -> None:
|
|
102
|
+
r = s.run("uv", "pip", "list", silent=True)
|
|
103
|
+
assert isinstance(r, str)
|
|
104
|
+
assert "ruff" in r
|
|
105
|
+
assert "subproject" in r
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@session(uv_groups=["type_check"], venv_backend="virtualenv")
|
|
93
109
|
def failed_virtualenv(s: Session) -> None:
|
|
94
110
|
pass
|
|
95
111
|
|
|
96
112
|
|
|
97
|
-
@session(uv_groups=["
|
|
113
|
+
@session(uv_groups=["type_check"], venv_backend="none")
|
|
98
114
|
def failed_venv_none(s: Session) -> None:
|
|
99
115
|
pass
|
|
@@ -5,7 +5,7 @@ description = "Project for testing nox-uv"
|
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.9"
|
|
7
7
|
classifiers = [
|
|
8
|
-
"Private
|
|
8
|
+
"Private :: Do Not Upload",
|
|
9
9
|
]
|
|
10
10
|
dependencies = [
|
|
11
11
|
"nox-uv",
|
|
@@ -14,6 +14,11 @@ dependencies = [
|
|
|
14
14
|
[tool.uv.sources]
|
|
15
15
|
nox-uv = { path = "../../", editable = true }
|
|
16
16
|
|
|
17
|
+
[build-system]
|
|
18
|
+
requires = ["hatchling"]
|
|
19
|
+
build-backend = "hatchling.build"
|
|
20
|
+
|
|
21
|
+
|
|
17
22
|
[project.optional-dependencies]
|
|
18
23
|
pyyaml = ["pyyaml"]
|
|
19
24
|
scapy = ["scapy"]
|
|
@@ -29,7 +34,7 @@ lint = [
|
|
|
29
34
|
test = [
|
|
30
35
|
"pytest-cov>=6.0.0",
|
|
31
36
|
]
|
|
32
|
-
|
|
37
|
+
type_check = [
|
|
33
38
|
"mypy>=1.15.0",
|
|
34
39
|
]
|
|
35
40
|
|
|
@@ -37,5 +42,5 @@ type-check = [
|
|
|
37
42
|
default-groups = [
|
|
38
43
|
"lint",
|
|
39
44
|
"test",
|
|
40
|
-
"
|
|
45
|
+
"type_check",
|
|
41
46
|
]
|
|
File without changes
|
|
@@ -266,7 +266,7 @@ wheels = [
|
|
|
266
266
|
|
|
267
267
|
[[package]]
|
|
268
268
|
name = "nox-uv"
|
|
269
|
-
version = "0.
|
|
269
|
+
version = "0.6.0"
|
|
270
270
|
source = { editable = "../../" }
|
|
271
271
|
dependencies = [
|
|
272
272
|
{ name = "nox" },
|
|
@@ -277,7 +277,10 @@ requires-dist = [{ name = "nox", specifier = ">=2025.5.1" }]
|
|
|
277
277
|
|
|
278
278
|
[package.metadata.requires-dev]
|
|
279
279
|
lint = [{ name = "ruff", specifier = ">=0.9.7" }]
|
|
280
|
-
test = [
|
|
280
|
+
test = [
|
|
281
|
+
{ name = "pytest", specifier = "<8.4.0" },
|
|
282
|
+
{ name = "pytest-cov", specifier = ">=6.0.0" },
|
|
283
|
+
]
|
|
281
284
|
type-check = [{ name = "mypy", specifier = ">=1.15.0" }]
|
|
282
285
|
|
|
283
286
|
[[package]]
|
|
@@ -427,7 +430,7 @@ wheels = [
|
|
|
427
430
|
[[package]]
|
|
428
431
|
name = "subproject"
|
|
429
432
|
version = "0.1.0"
|
|
430
|
-
source = {
|
|
433
|
+
source = { editable = "." }
|
|
431
434
|
dependencies = [
|
|
432
435
|
{ name = "nox-uv" },
|
|
433
436
|
]
|