Visitar URL original
🐛 fix(config): let TOML ref read deps and commands by gaborbernat · Pull Request #4112 · tox-dev/tox · GitHub
Skip to content

🐛 fix(config): let TOML ref read deps and commands - #4112

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix/toml-ref-deps
Oct 3, 2026
Merged

gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix/toml-ref-deps

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

In a tox.toml, pointing one environment's deps, constraints or commands at another environment's value with a ref broke both tox config and tox run. 🐛 Take this config:

[env.a]
package = "skip"
deps = ["six"]
commands = [["python", "-V"]]

[env.b]
package = "skip"
deps = [{ replace = "ref", env = "a", key = "deps", extend = true }]

[env.c]
package = "skip"
commands = { replace = "ref", env = "a", key = "commands" }

Before this change, tox run -e b,c failed to load either environment:

b: failed to load b.deps: 'PythonDeps' object is not iterable
c: failed to load c.commands: Command(args=['python', '-V']) is not list
  b: FAIL code 1 (0.33 seconds)
  c: FAIL code 1 (0.13 seconds)
  evaluation failed :( (0.49 seconds)

With the fix, b installs six and c runs python -V, the same as if you had copied the values by hand:

c: commands[0]> python -V
Python 3.14.8
  b: OK (1.20 seconds)
  c: OK (0.05=setup[0.01]+cmd[0.04] seconds)
  congratulations :) (1.28 seconds)

✨ extend = true spreads the referenced entries into the surrounding list, so deps = [{ replace = "ref", env = "a", key = "deps", extend = true }, "attrs"] gives six and attrs. A ref to constraints returns the constraint file paths you wrote. References to extras, set_env and other keys behave as before. I hit this while auditing #4111.

A ref to deps placed inside a list without extend = true still fails, since it nests one list inside another, as the extend docs describe.

@gaborbernat gaborbernat added the bug:normal affects many people or has quite an impact label Oct 3, 2026
@gaborbernat
gaborbernat enabled auto-merge (squash) October 3, 2026 20:44
@gaborbernat
gaborbernat merged commit 3cb3208 into tox-dev:main Oct 3, 2026
30 checks passed
@gaborbernat
gaborbernat deleted the fix/toml-ref-deps branch October 12, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided bug:normal affects many people or has quite an impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant