Skip to content

--print-extras-to does not work with tox 4.44.0 #90

Description

@mtelka

After upgrade of tox from 4.38.0 to 4.44.0 the --print-extras-to option started to fail:

$ wget https://files.pythonhosted.org/packages/source/f/fixtures/fixtures-4.2.8.tar.gz
$ gtar xf fixtures-4.2.8.tar.gz
$ cd fixtures-4.2.8
$ tox --version
4.44.0 from /usr/lib/python3.14/vendor-packages/tox/__init__.py
registered plugins:
    tox-current-env-0.0.16 at /usr/lib/python3.14/vendor-packages/tox_current_env/hooks.py
$ tox --no-provision --print-extras-to=- -e py314
Traceback (most recent call last):
  File "/usr/bin/tox-3.14", line 8, in <module>
    sys.exit(run())
             ~~~^^
  File "/usr/lib/python3.14/vendor-packages/tox/run.py", line 23, in run
    result = main(sys.argv[1:] if args is None else args)
  File "/usr/lib/python3.14/vendor-packages/tox/run.py", line 49, in main
    return handler(state)
  File "/usr/lib/python3.14/vendor-packages/tox/session/cmd/legacy.py", line 115, in legacy
    return run_sequential(state)
  File "/usr/lib/python3.14/vendor-packages/tox/session/cmd/run/sequential.py", line 25, in run_sequential
    return execute(state, max_workers=1, has_spinner=False, live=True)
  File "/usr/lib/python3.14/vendor-packages/tox/session/cmd/run/common.py", line 216, in execute
    state.envs.ensure_only_run_env_is_active()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.14/vendor-packages/tox/session/env_select.py", line 560, in ensure_only_run_env_is_active
    envs, active = self._defined_envs, self._env_name_to_active()
                   ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/vendor-packages/tox/session/env_select.py", line 344, in _defined_envs
    run_env = self._build_run_env(name)
  File "/usr/lib/python3.14/vendor-packages/tox/session/env_select.py", line 434, in _build_run_env
    run_env.register_config()
    ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.14/vendor-packages/tox/tox_env/python/runner.py", line 57, in register_config
    self.conf.add_config(
    ~~~~~~~~~~~~~~~~~~~~^
        keys=["extras"],
        ^^^^^^^^^^^^^^^^
    ...<3 lines>...
        post_process=_normalize_extras,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.14/vendor-packages/tox/config/sets.py", line 101, in add_config
    result = self._add_conf(keys_, definition)
  File "/usr/lib/python3.14/vendor-packages/tox/config/sets.py", line 129, in _add_conf
    self._on_duplicate_conf(key, definition)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/vendor-packages/tox/config/sets.py", line 140, in _on_duplicate_conf
    raise ValueError(msg)
ValueError: duplicate configuration definition for py314:
has: ConfigDynamicDefinition(keys=['extras'], desc=extras to install of the target package, of_type=typing.Set[str], default=set())
new: ConfigDynamicDefinition(keys=['extras'], desc=extras to install of the target package, of_type=set[str], default=set())
$

With tox 4.38.0 everything works as expected:

$ tox --version
4.38.0 from /usr/lib/python3.14/vendor-packages/tox/__init__.py
registered plugins:
    tox-current-env-0.0.16 at /usr/lib/python3.14/vendor-packages/tox_current_env/hooks.py
$ tox --no-provision --print-extras-to=- -e py314
test
docs
  py314: OK (0.04 seconds)
  congratulations :) (0.14 seconds)
$

Activity

  1. changed the title [-]`--print-extras-to=-` does not work with tox 4.44.0[/-] [+]`--print-extras-to` does not work with tox 4.44.0[/+] on Feb 22, 2026
  2. hroncok commented on Feb 23, 2026

    @hroncok
    Member

    I guess this is coming from

    https://github.com/fedora-python/tox-current-env/blob/d4ed1c673f2143656d8848ba4dd3f05d371a1560/src/tox_current_env/hooks4.py#L247-257

    Perhaps the if "extras" not in self.conf: guard is no longer working? Or perhaps tox defines this after us? Nevertheless, worst case scenarion, we can guard this with our own tox-version-based if.

    Is it possible this was now broken by the typing.Set[str] -> set[str] difference in upstream and it only workjed before because the definitions were identical? Will check later when this was changed upstream.

  3. hroncok commented on Feb 23, 2026

    @hroncok
    Member

    tox-dev/tox@7b601a7 landed in 4.44.0

    And it calls add_config for the extras not sure why that was added here, but I guess we should not be doing that anymore.

  4. hroncok commented on May 5, 2026

    @hroncok
    Member

    Sorry, it took me longer to get to this than expected. #91

  5. self-assigned this
    on May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions