nox-uv 0.2.1__tar.gz → 0.2.3__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.
@@ -10,7 +10,7 @@ jobs:
10
10
  runs-on: ubuntu-24.04
11
11
  strategy:
12
12
  matrix:
13
- python-version: ["3.10", "3.11", "3.12", "3.13" ]
13
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13" ]
14
14
  steps:
15
15
  - uses: actions/checkout@v4
16
16
  - name: Install uv
@@ -1,28 +1,38 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nox-uv
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: Facilitate nox integration with uv for Python projects
5
5
  Project-URL: Homepage, https://github.com/dantebben/nox-uv
6
6
  Author-email: Dan Tebben <dantebben@gmail.com>
7
7
  License-Expression: MIT
8
8
  License-File: LICENSE.txt
9
- Requires-Python: >=3.10
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Testing
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.9
10
23
  Requires-Dist: nox>=2025.2.9
11
- Provides-Extra: doc
12
- Requires-Dist: mkdocs; extra == 'doc'
13
- Provides-Extra: plot
14
- Requires-Dist: plotly; extra == 'plot'
24
+ Provides-Extra: pyyaml
25
+ Requires-Dist: pyyaml; extra == 'pyyaml'
26
+ Provides-Extra: scapy
27
+ Requires-Dist: scapy; extra == 'scapy'
15
28
  Description-Content-Type: text/markdown
16
29
 
17
30
  ## Intro
18
31
 
19
- This is heavliy influcenced by, but much more limited than,
20
- [nox-poetry](https://nox-poetry.readthedocs.io).
21
-
22
32
  This is a basic drop-in replacement for `nox.session` of [nox](https://nox.thea.codes/) to be used
23
33
  with the [uv](https://docs.astral.sh/uv/) package manager.
24
34
 
25
- To use, import `session` from `nox-uv` in your `nox-file`.
35
+ To use, import `session` from `nox-uv` in your `noxfile.py`.
26
36
 
27
37
  **NOTE**: All `@session(...)` parameters are keywords only, no positional parameters are allowed.
28
38
 
@@ -36,3 +46,7 @@ user must explicitly list the desired groups in the `uv_groups` parameter.
36
46
  - `uv_all_extras`: boolean to install all extras from `pyproject.toml`
37
47
  - `uv_all_groups`: boolean to install all dependency groups
38
48
 
49
+ ## Inspiration
50
+
51
+ This is heavliy influcenced by, but much more limited than,
52
+ [nox-poetry](https://nox-poetry.readthedocs.io).
@@ -1,12 +1,9 @@
1
1
  ## Intro
2
2
 
3
- This is heavliy influcenced by, but much more limited than,
4
- [nox-poetry](https://nox-poetry.readthedocs.io).
5
-
6
3
  This is a basic drop-in replacement for `nox.session` of [nox](https://nox.thea.codes/) to be used
7
4
  with the [uv](https://docs.astral.sh/uv/) package manager.
8
5
 
9
- To use, import `session` from `nox-uv` in your `nox-file`.
6
+ To use, import `session` from `nox-uv` in your `noxfile.py`.
10
7
 
11
8
  **NOTE**: All `@session(...)` parameters are keywords only, no positional parameters are allowed.
12
9
 
@@ -20,3 +17,7 @@ user must explicitly list the desired groups in the `uv_groups` parameter.
20
17
  - `uv_all_extras`: boolean to install all extras from `pyproject.toml`
21
18
  - `uv_all_groups`: boolean to install all dependency groups
22
19
 
20
+ ## Inspiration
21
+
22
+ This is heavliy influcenced by, but much more limited than,
23
+ [nox-poetry](https://nox-poetry.readthedocs.io).
@@ -3,7 +3,7 @@ from nox import Session, options, parametrize
3
3
  from nox_uv import session
4
4
 
5
5
  options.error_on_external_run = True
6
- options.reuse_existing_virtualenvs = True
6
+ options.reuse_existing_virtualenvs = False
7
7
  options.default_venv_backend = "uv"
8
8
  options.sessions = ["uv_lock_check", "lint", "type_check", "test"]
9
9
 
@@ -14,8 +14,7 @@ def uv_lock_check(s: Session) -> None:
14
14
 
15
15
 
16
16
  @session(
17
- reuse_venv=True,
18
- python=["3.10", "3.11", "3.12", "3.13"],
17
+ python=["3.9", "3.10", "3.11", "3.12", "3.13"],
19
18
  uv_groups=["test"],
20
19
  )
21
20
  def test(s: Session) -> None:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nox-uv"
3
- version = "0.2.1"
3
+ version = "0.2.3"
4
4
  description = "Facilitate nox integration with uv for Python projects"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -8,14 +8,31 @@ authors = [
8
8
  ]
9
9
  license = "MIT"
10
10
  license-files = ["LICENSE.txt"]
11
- requires-python = ">=3.10"
11
+ classifiers = [
12
+ "Development Status :: 4 - Beta",
13
+ "Intended Audience :: Developers",
14
+ "License :: OSI Approved :: MIT License",
15
+ "Operating System :: OS Independent",
16
+ "Programming Language :: Python",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.9",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Topic :: Software Development :: Testing",
24
+ "Typing :: Typed",
25
+ ]
26
+
27
+ requires-python = ">=3.9"
12
28
  dependencies = [
13
29
  "nox>=2025.2.9",
14
30
  ]
15
31
 
32
+ # These optional dependencies are only for testing ability to include/exclude extras.
16
33
  [project.optional-dependencies]
17
- plot = ["plotly"]
18
- doc = ["mkdocs"]
34
+ pyyaml = ["pyyaml"]
35
+ scapy = ["scapy"]
19
36
 
20
37
 
21
38
 
@@ -2,13 +2,13 @@ from __future__ import annotations
2
2
 
3
3
  from collections.abc import Callable, Sequence
4
4
  import functools
5
- from typing import Any, TypeVar
5
+ from typing import Any, TypeVar, Union
6
6
 
7
7
  import nox
8
8
 
9
9
  R = TypeVar("R")
10
10
 
11
- Python = Sequence[str] | str | bool | None
11
+ Python = Union[Sequence[str], str, bool]
12
12
 
13
13
 
14
14
  def session(
@@ -77,17 +77,17 @@ def session(
77
77
  @functools.wraps(function)
78
78
  def wrapper(s: nox.Session, *_args: Any, **_kwargs: Any) -> None:
79
79
  if s.venv_backend == "uv":
80
- env: dict[str, Any] = {"UV_PROJECT_ENVIRONMENT": s.virtualenv.location}
80
+ s.env["UV_PROJECT_ENVIRONMENT"] = s.virtualenv.location
81
81
 
82
82
  # UV called from Nox does not respect the Python version set in the Nox session.
83
83
  # We need to pass the Python version to UV explicitly.
84
84
  if s.python is not None:
85
- env["UV_PYTHON"] = s.python
85
+ # NOTE: casting to string explicitly because implicit casting isn't working
86
+ # for the type checker.
87
+ s.env["UV_PYTHON"] = str(s.python)
88
+
89
+ s.run_install(*sync_cmd)
86
90
 
87
- s.run_install(
88
- *sync_cmd,
89
- env=env,
90
- )
91
91
  function(nox.Session(s._runner), *_args, **_kwargs)
92
92
 
93
93
  return nox.session( # type: ignore
@@ -0,0 +1,62 @@
1
+ from nox import Session, options
2
+
3
+ from nox_uv import session
4
+
5
+ options.default_venv_backend = "uv"
6
+ options.reuse_existing_virtualenvs = False
7
+
8
+ options.sessions = [
9
+ "check_python_version",
10
+ "only_test_group",
11
+ "all_groups",
12
+ "all_extras",
13
+ "correct_python",
14
+ ]
15
+
16
+
17
+ @session(venv_backend="none")
18
+ def check_python_version(s: Session) -> None:
19
+ s.run("python3", "--version")
20
+
21
+
22
+ @session(uv_groups=["test"])
23
+ def only_test_group(s: Session) -> None:
24
+ r = s.run("uv", "pip", "list", silent=True)
25
+ assert isinstance(r, str)
26
+ assert "pytest-cov" in r
27
+ assert "networkx" not in r
28
+
29
+
30
+ @session(uv_all_groups=True)
31
+ def all_groups(s: Session) -> None:
32
+ r = s.run("uv", "pip", "list", silent=True)
33
+ assert isinstance(r, str)
34
+ assert "pytest-cov" in r
35
+ assert "networkx" in r
36
+
37
+
38
+ @session(uv_all_extras=True)
39
+ def all_extras(s: Session) -> None:
40
+ r = s.run("uv", "pip", "list", silent=True)
41
+ assert isinstance(r, str)
42
+ assert "networkx" not in r
43
+ assert "pyyaml" in r
44
+
45
+
46
+ @session(uv_extras=["pyyaml"])
47
+ def only_one_extra(s: Session) -> None:
48
+ r = s.run("uv", "pip", "list", silent=True)
49
+ assert isinstance(r, str)
50
+ assert "scapy" not in r
51
+ assert "networkx" not in r
52
+ assert "pyyaml" in r
53
+
54
+
55
+ @session(python=["3.10"])
56
+ def correct_python(s: Session) -> None:
57
+ assert s.python == "3.10"
58
+ v = s.run("python3", "--version", silent=True)
59
+ if isinstance(v, str):
60
+ assert "Python 3.10" in v
61
+ else:
62
+ raise RuntimeError("Python version was not returned.")