tox-uv-bare
tox-uv-bare is a plugin for tox that integrates the `uv` dependency manager, allowing tox to leverage `uv`'s speed for virtual environment creation and dependency resolution. This 'bare' package requires users to provide their own `uv` installation. The current version is 1.35.0, and the project has a frequent release cadence, often issuing multiple bug fix and minor feature updates per month.
Warnings
- gotcha The `tox-uv-bare` package explicitly requires you to 'bring your own uv'. This means `uv` must be installed separately (e.g., `pip install uv` or via pre-built binaries) and available in your system's PATH. If `uv` is not found, tox will fall back to its default installer, or the environment creation will fail.
- breaking `tox-uv-bare` requires Python 3.10 or newer. Attempting to use it with older Python versions will lead to installation failures or unexpected runtime errors.
- gotcha Changes to environment variables prefixed with `UV_` (e.g., `UV_EXCLUDE_NEWER`) now correctly invalidate `tox-uv`'s install cache. Prior to version 1.35.0, changes to these variables might not have triggered a cache invalidation, leading to stale environments or unexpected behavior.
- gotcha For new projects, consider using the `tox-uv` meta-package instead of `tox-uv-bare`. The `tox-uv` meta-package includes `uv` as a dependency, simplifying installation by not requiring a separate `uv` installation. `tox-uv-bare` is primarily for users who prefer to manage their `uv` installation independently.
Install
-
pip install tox-uv-bare -
pip install uv
Imports
- tox_uv
This is a tox plugin, typically enabled via tox.ini. Direct Python imports by end-users are uncommon.
Quickstart
# tox.ini
[tox]
requires = tox-uv-bare
plugins = tox_uv
env_list = py
[testenv:py]
commands = python -c "import sys; print(f'Python: {sys.version}')"
python -c "import uv; print(f'uv is available')" # This command will fail, uv is not imported into the venv directly
# To check uv is working, ensure it was used to create the venv and install deps
python -c "print('Hello from uv-managed environment!')"
# Or a minimal example in pyproject.toml
# [tool.tox]
# requires = ["tox-uv-bare"]
# plugins = ["tox_uv"]
# env_list = ["py"]
# [testenv:py]
# commands = ["python -c \"import sys; print(f'Python: {sys.version}')\""]