Description
What's the problem this feature will solve?
I'm trying to make bootstrapping my dev environment as simple as possible. I happen to LOVE tox-uv. I'd like to make it easy for people to get going even if they don't have the plugin installed. Right now, if an environment has a defined runner that is not valid you cannot run any environment at all, even if that environment would run fine with the virtualenv runner.
Describe the solution you'd like
Instead of throwing a KeyError I'd like environments without useable runners to be ignored.
Consider this tox.ini and assume there is an existing uv.lock in the project.
[testenv:dev]
deps=
tox
tox-uv
skip_install = true
commands=
tox -r -e _bootstrap
[testenv:_bootstrap]
runner = uv-venv-lock-runner
envdir = {toxinidir}/.venv
skip_install = true
commands=
If I run:
python3.11 -m venv .tvenv
.tvenv/bin/pip install tox
.tvenv/bin/tox -e dev
I get the error:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jabbera/temp/tox/.tvenv/lib/python3.11/site-packages/tox/tox_env/register.py", line 72, in runner
return self._run_envs[name]
~~~~~~~~~~~~~~^^^^^^
KeyError: 'uv-venv-lock-runner'
I'm not trying to run that environment to start so the fact that I don't have the runner should not matter. If the environment was ignored I would end up with a properly bootstrapped .venv folder because I install tox-uv into the dev tox environment.
Alternative Solutions
The alternative is fine, but it's certainly not as nice looking:
[testenv:dev]
description = Creates a bootstrapped virtual environment using uv named .venv ready for development on your OS.
deps =
uv
tox
tox-uv
skip_install = true
commands =
tox -e _dev-boostrap
[testenv:_dev-boostrap]
description = This is what actually creates the environment. Should only be called from the dev environment. It exsts so tox -r -e dev works.
envdir = {toxinidir}/.venv
skip_install = true
deps =
commands =
uv sync --extra dev