Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with deps when using native TOML configuration #3387

Closed
daneah opened this issue Oct 2, 2024 · 1 comment · Fixed by #3388
Closed

Error with deps when using native TOML configuration #3387

daneah opened this issue Oct 2, 2024 · 1 comment · Fixed by #3388
Assignees
Labels
bug:normal affects many people or has quite an impact

Comments

@daneah
Copy link

daneah commented Oct 2, 2024

Issue

tox doesn't accept deps as a list when using (as documented) the native TOML configuration.

Environment

Provide at least:

  • OS: macOS
Output of pip list of the host Python, where tox is installed
$ pipx runpip tox list
Package       Version
------------- -------
cachetools    5.5.0
chardet       5.2.0
colorama      0.4.6
distlib       0.3.7
filelock      3.16.1
packaging     24.1
pip           24.2
platformdirs  4.3.6
pluggy        1.5.0
pyproject-api 1.8.0
setuptools    69.0.2
tox           4.21.0
tox-uv        1.13.0
uv            0.4.18
virtualenv    20.26.6
wheel         0.42.0

Output of running tox

Output of tox -rvv
Traceback (most recent call last):
  File "/Users/dhillard/.local/pipx/venvs/tox/lib/python3.11/site-packages/tox/session/cmd/run/single.py", line 47, in _evaluate
    tox_env.setup()
  File "/Users/dhillard/.local/pipx/venvs/tox/lib/python3.11/site-packages/tox/tox_env/api.py", line 249, in setup
    self._setup_env()
  File "/Users/dhillard/.local/pipx/venvs/tox/lib/python3.11/site-packages/tox/tox_env/python/runner.py", line 89, in _setup_env
    self._install_deps()
  File "/Users/dhillard/.local/pipx/venvs/tox/lib/python3.11/site-packages/tox/tox_env/python/runner.py", line 92, in _install_deps
    requirements_file: PythonDeps = self.conf["deps"]
                                    ~~~~~~~~~^^^^^^^^
  File "/Users/dhillard/.local/pipx/venvs/tox/lib/python3.11/site-packages/tox/config/sets.py", line 116, in __getitem__
    return self.load(item)
           ^^^^^^^^^^^^^^^
  File "/Users/dhillard/.local/pipx/venvs/tox/lib/python3.11/site-packages/tox/config/sets.py", line 127, in load
    return config_definition.__call__(self._conf, self.loaders, ConfigLoadArgs(chain, self.name, self.env_name))  # noqa: PLC2801
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dhillard/.local/pipx/venvs/tox/lib/python3.11/site-packages/tox/config/of_type.py", line 109, in __call__
    value = loader.load(key, self.of_type, self.factory, conf, args)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dhillard/.local/pipx/venvs/tox/lib/python3.11/site-packages/tox/config/loader/api.py", line 148, in load
    converted = self.build(key, of_type, factory, conf, raw, args)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dhillard/.local/pipx/venvs/tox/lib/python3.11/site-packages/tox/config/loader/toml/__init__.py", line 66, in build
    return self.to(exploded, of_type, factory)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dhillard/.local/pipx/venvs/tox/lib/python3.11/site-packages/tox/config/loader/convert.py", line 52, in to
    return factory(raw)
           ^^^^^^^^^^^^
  File "/Users/dhillard/.local/pipx/venvs/tox/lib/python3.11/site-packages/tox/tox_env/python/pip/req_file.py", line 128, in factory
    raise TypeError(raw)
TypeError: ['pytest', 'pytest-cov', 'pytest-randomly']

Minimal example

$ ls -a
.    ..    pyproject.toml
# pyproject.toml

[tool.tox]
env_list = ["py311"]

[tool.tox.env.py311]
deps = [
    "pytest",
    "pytest-cov",
    "pytest-randomly",
]
commands = [
    ["pytest", { replace = "posargs", default = [] }],
]
$ tox --version
4.21.0 from /Users/dhillard/.local/pipx/venvs/tox/lib/python3.11/site-packages/tox/__init__.py
registered plugins:
    tox-uv-1.13.0 at /Users/dhillard/.local/pipx/venvs/tox/lib/python3.11/site-packages/tox_uv/plugin.py with uv==0.4.18
@gaborbernat gaborbernat self-assigned this Oct 2, 2024
@gaborbernat gaborbernat added the bug:normal affects many people or has quite an impact label Oct 2, 2024
@gaborbernat
Copy link
Member

This now has been fixed in 4.21.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:normal affects many people or has quite an impact
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants