-
-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Issue
When entries in tools.uv.sources
are lists instead of dictionaries, as is common in forked dependency structures such as multi-backend PyTorch setups, tox
fails to install the virtual environment.
Example pyproject.toml
snippet:
[tool.uv.sources]
torch = [
{ index = "pytorch-cpu", group = "cpu" },
{ index = "pytorch-gpu", group = "gpu" },
]
Stack trace:
Traceback (most recent call last):
File "/Users/mde48/.local/share/uv/tools/tox/lib/python3.12/site-packages/tox/session/cmd/run/single.py", line 47, in _evaluate
tox_env.setup()
File "/Users/mde48/.local/share/uv/tools/tox/lib/python3.12/site-packages/tox/tox_env/api.py", line 285, in setup
self._setup_with_env()
File "/Users/mde48/.local/share/uv/tools/tox/lib/python3.12/site-packages/tox/tox_env/runner.py", line 146, in _setup_with_env
self._setup_pkg()
File "/Users/mde48/.local/share/uv/tools/tox/lib/python3.12/site-packages/tox/tox_env/runner.py", line 171, in _setup_pkg
self._install(self._packages, RunToxEnv.__name__, "package")
File "/Users/mde48/.local/share/uv/tools/tox/lib/python3.12/site-packages/tox/tox_env/api.py", line 119, in _install
self.installer.install(arguments, section, of_type)
File "/Users/mde48/.local/share/uv/tools/tox/lib/python3.12/site-packages/tox_uv/_installer.py", line 105, in install
self._install_list_of_deps(arguments, section, of_type)
File "/Users/mde48/.local/share/uv/tools/tox/lib/python3.12/site-packages/tox_uv/_installer.py", line 137, in _install_list_of_deps
and pkg.name in self._sourced_pkg_names
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mde48/.local/share/uv/python/cpython-3.12.11-macos-aarch64-none/lib/python3.12/functools.py", line 998, in __get__
val = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "/Users/mde48/.local/share/uv/tools/tox/lib/python3.12/site-packages/tox_uv/_installer.py", line 119, in _sourced_pkg_names
return {key for key, val in sources.items() if val.get("workspace", False)}
^^^^^^^
AttributeError: 'list' object has no attribute 'get'
After reviewing this function, it appears this line is assuming that tool.uv.sources
maps package names to objects, but it is allowed to map them to lists of objects.
Environment
Provide at least:
- OS: macOS
Output of pip list
of the host Python, where tox
is installed
not sure how to get this when using recommended uv tool install
setup.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working