Skip to content

Commit e5e4a0a

Browse files
fix: Migrate to tox-uv-bare
This removes the need to have `uv` itself packaged into the venv. We now use the devcontainer's default uv version. The devcontainer.json changes are to deal with a migration issue that can occur due to older uv versions being in the venv - if that old version no longer meets the required version in `pyproject.toml` -> `tool.uv` -> `required-version` it means you end up with a venv that cannot run any uv commands as it is below the minimum version.
1 parent 0323d38 commit e5e4a0a

4 files changed

Lines changed: 14 additions & 43 deletions

File tree

‎.devcontainer/devcontainer.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,6 @@
6868
// Mount the parent as /workspaces so we can pip install peers as editable
6969
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind",
7070
// After the container is created, recreate the venv then make pre-commit first run faster
71-
"postCreateCommand": "uv venv --clear && uv sync && pre-commit install --install-hooks"
71+
// Ensure we use system uv, as there might be a different (old) version of uv in the venv
72+
"postCreateCommand": "/usr/bin/uv venv --clear && /usr/bin/uv sync && pre-commit install --install-hooks"
7273
}

‎pyproject.toml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dev = [
1818
"sphinx-autobuild",
1919
"sphinx-copybutton",
2020
"sphinx-design",
21-
"tox-uv",
21+
"tox-uv-bare",
2222
]
2323

2424
[tool.uv]
@@ -43,6 +43,13 @@ env_list = ["pre-commit", "tests", "docs"]
4343
[tool.tox.env_run_base]
4444
# Pass all environment variables to the test environments
4545
passenv = ["*"]
46+
allowlist_externals = [
47+
"pytest",
48+
"pre-commit",
49+
"sphinx-build",
50+
"sphinx-autobuild",
51+
"pyright",
52+
]
4653

4754
[tool.tox.env.pre-commit]
4855
description = "Run pre-commit on all files"

‎template/pyproject.toml.jinja‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dev = [
3434
{% if sphinx %}"sphinx-autobuild",
3535
"sphinx-copybutton",
3636
"sphinx-design",
37-
{% endif %}"tox-uv",
37+
{% endif %}"tox-uv-bare",
3838
"types-mock",
3939
]
4040

@@ -90,6 +90,7 @@ env_list = ["pre-commit", "type-checking", "tests"{% if sphinx %}, "docs"{% endi
9090
[tool.tox.env_run_base]
9191
# Pass all environment variables to the test environments
9292
passenv = ["*"]
93+
dependency_groups = ["dev"]
9394

9495
[tool.tox.env.pre-commit]
9596
description = "Run pre-commit on all files"

‎uv.lock‎

Lines changed: 2 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)