nox-uv


Namenox-uv JSON
Version 0.6.2 PyPI version JSON
download
home_pageNone
SummaryFacilitate nox integration with uv for Python projects
upload_time2025-07-31 00:28:44
maintainerNone
docs_urlNone
authorDan Tebben
requires_python>=3.9
licenseNone
keywords nox uv
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## Intro

[![GitHub Actions][github-actions-badge]](https://github.com/dantebben/nox-uv/actions)
[![PyPI version][pypi-version-badge]](https://pypi.python.org/pypi/nox-uv)
[![Python versions][python-versions-badge]](https://pypi.python.org/pypi/nox-uv)
[![uv][uv-badge]](https://github.com/astral-sh/uv)
[![Nox][nox-badge]](https://github.com/wntrblm/nox)
[![Ruff][ruff-badge]](https://github.com/astral-sh/ruff)
[![Type checked with mypy][mypy-badge]](https://mypy-lang.org/)

[github-actions-badge]: https://github.com/dantebben/nox-uv/workflows/CI/badge.svg
[pypi-version-badge]: https://img.shields.io/pypi/v/nox-uv.svg
[python-versions-badge]: https://img.shields.io/pypi/pyversions/nox-uv.svg
[uv-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json
[nox-badge]: https://img.shields.io/badge/%F0%9F%A6%8A-Nox-D85E00.svg
[ruff-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
[mypy-badge]: https://www.mypy-lang.org/static/mypy_badge.svg

`nox-uv` is a simple drop-in replacement for [nox](https://nox.thea.codes/)'s `@nox.session` that
installs dependencies constrained by [uv](https://docs.astral.sh/uv/)'s lockfile.

## Usage

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

```shell
uv add --group nox nox-uv
```

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

```toml
[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](#added-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.

```py
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"],
    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_groups` defined in `pyproject.toml` are _not_ installed by default. The
> user must explicitly list the desired groups in the `uv_groups` parameter. 

### 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_all_groups`: boolean to install all _dependency-groups_
- `uv_no_install_project`: boolean to not install the current project
- `uv_sync_locked`: boolean to validate that `uv.lock` is up to date


## Inspiration

This is heavily influenced by, but much more limited than, 
[nox-poetry](https://nox-poetry.readthedocs.io).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "nox-uv",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "nox, uv",
    "author": "Dan Tebben",
    "author_email": "Dan Tebben <dantebben@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/f2/18/726fc3942a5d2a6a8686d0b220aa12e8459e4294181c7842715e7dc0c2db/nox_uv-0.6.2.tar.gz",
    "platform": null,
    "description": "## Intro\n\n[![GitHub Actions][github-actions-badge]](https://github.com/dantebben/nox-uv/actions)\n[![PyPI version][pypi-version-badge]](https://pypi.python.org/pypi/nox-uv)\n[![Python versions][python-versions-badge]](https://pypi.python.org/pypi/nox-uv)\n[![uv][uv-badge]](https://github.com/astral-sh/uv)\n[![Nox][nox-badge]](https://github.com/wntrblm/nox)\n[![Ruff][ruff-badge]](https://github.com/astral-sh/ruff)\n[![Type checked with mypy][mypy-badge]](https://mypy-lang.org/)\n\n[github-actions-badge]: https://github.com/dantebben/nox-uv/workflows/CI/badge.svg\n[pypi-version-badge]: https://img.shields.io/pypi/v/nox-uv.svg\n[python-versions-badge]: https://img.shields.io/pypi/pyversions/nox-uv.svg\n[uv-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json\n[nox-badge]: https://img.shields.io/badge/%F0%9F%A6%8A-Nox-D85E00.svg\n[ruff-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json\n[mypy-badge]: https://www.mypy-lang.org/static/mypy_badge.svg\n\n`nox-uv` is a simple drop-in replacement for [nox](https://nox.thea.codes/)'s `@nox.session` that\ninstalls dependencies constrained by [uv](https://docs.astral.sh/uv/)'s lockfile.\n\n## Usage\n\nAdd `nox-uv` as a development dependency. The following example adds it into a `nox`\n`dependency-group`.\n\n```shell\nuv add --group nox nox-uv\n```\n\nUsing the following configuration within `pyproject.toml` as an example:\n\n```toml\n[dependency-groups]\nnox = [\n    \"nox-uv\",\n]\ntest = [\n    \"pytest\",\n    \"pytest-cov\",\n]\ntype_check = [\n    \"mypy\",\n]\nlint = [\n    \"ruff\",\n]\n```\n\nWithin, your `noxfile.py`:\n\n1. Import `session` from `nox_uv`.\n2. Set `venv_backend` to `\"uv\"`. This can be done globally using\n   `options.default_venv_backend = \"uv\"`.\n3. Use the new [`uv_*` parameters](#added-parameters) to `session` to control which dependencies\n   are synced into the session's virtual environment in addition to the project's main\n   dependencies.\n     - `uv sync` is used to install dependencies so that their versions are constrained by\n       `uv.lock`.\n     - By default (configurable with the `uv_sync_locked` parameter), `uv.lock` is also\n       validated to be up to date.\n\n```py\nfrom nox import Session, options\nfrom nox_uv import session\n\noptions.default_venv_backend = \"uv\"\n\n\n@session(\n    python=[\"3.10\", \"3.11\", \"3.12\", \"3.13\"],\n    uv_groups=[\"test\"],\n)\ndef test(s: Session) -> None:\n    s.run(\"python\", \"-m\", \"pytest\")\n\n\n@session(uv_groups=[\"type_check\"])\ndef type_check(s: Session) -> None:\n    s.run(\"mypy\", \"src\")\n\n\n@session(uv_only_groups=[\"lint\"])\ndef lint(s: Session) -> None:\n    s.run(\"ruff\", \"check\", \".\")\n    s.run(\"ruff\", \"format\", \"--check\", \".\")\n```\n\n> [!NOTE]\n> All `@session(...)` parameters are keywords only, no positional parameters are allowed.\n\n> [!NOTE]\n> The `default_groups` defined in `pyproject.toml` are _not_ installed by default. The\n> user must explicitly list the desired groups in the `uv_groups` parameter. \n\n### Added parameters\n\n- `uv_groups`: list of `uv` _dependency-groups_\n- `uv_extras`: list of `uv` _optional-dependencies_\n- `uv_only_groups`: list of `uv` _only-groups_ to include. Prevents installation of project\n   _dependencies_\n- `uv_all_extras`: boolean to install all _optional-dependencies_ from `pyproject.toml`\n- `uv_all_groups`: boolean to install all _dependency-groups_\n- `uv_no_install_project`: boolean to not install the current project\n- `uv_sync_locked`: boolean to validate that `uv.lock` is up to date\n\n\n## Inspiration\n\nThis is heavily influenced by, but much more limited than, \n[nox-poetry](https://nox-poetry.readthedocs.io).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Facilitate nox integration with uv for Python projects",
    "version": "0.6.2",
    "project_urls": {
        "Homepage": "https://github.com/dantebben/nox-uv",
        "Issues": "https://github.com/dantebben/nox-uv/issues",
        "Repository": "https://github.com/dantebben/nox-uv"
    },
    "split_keywords": [
        "nox",
        " uv"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fb7cb6d82aa05f9790846733cd7d5696641f5bdf8704d267a9ccb9e92b977f9d",
                "md5": "71b465ece7b329026b4de3a25c1d1051",
                "sha256": "705b3054d0f3f8134872f03e01ea29ee35d5c8a8a7085b3751306c82d35d4b6d"
            },
            "downloads": -1,
            "filename": "nox_uv-0.6.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "71b465ece7b329026b4de3a25c1d1051",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 5335,
            "upload_time": "2025-07-31T00:28:43",
            "upload_time_iso_8601": "2025-07-31T00:28:43.961528Z",
            "url": "https://files.pythonhosted.org/packages/fb/7c/b6d82aa05f9790846733cd7d5696641f5bdf8704d267a9ccb9e92b977f9d/nox_uv-0.6.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f218726fc3942a5d2a6a8686d0b220aa12e8459e4294181c7842715e7dc0c2db",
                "md5": "f660f0b7ef08b1432ff7f58f1a63a2ca",
                "sha256": "a7a0ffa9a868f48cf919e09f18fb266a89d5cac69a69ce1799fcfd6a7ba09285"
            },
            "downloads": -1,
            "filename": "nox_uv-0.6.2.tar.gz",
            "has_sig": false,
            "md5_digest": "f660f0b7ef08b1432ff7f58f1a63a2ca",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 4937,
            "upload_time": "2025-07-31T00:28:44",
            "upload_time_iso_8601": "2025-07-31T00:28:44.719498Z",
            "url": "https://files.pythonhosted.org/packages/f2/18/726fc3942a5d2a6a8686d0b220aa12e8459e4294181c7842715e7dc0c2db/nox_uv-0.6.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-31 00:28:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dantebben",
    "github_project": "nox-uv",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nox-uv"
}
        
Elapsed time: 1.33362s