Skip to content

Tox 'HandledError| SetupCfg .. tox:tox not found' in projects with setup.cfg and pyproject.toml #3602

@Dantali0n

Description

@Dantali0n

Issue

Tox should run when an environment is specified tox -e lint in a project with a setup.cfg file for the [metadata] and all [tool.tox] configuration in pyproject.toml. But instead it gives an error about the section tox:tox not being found in setup.cfg.

Environment

Provide at least:

  • OS: Arch Linux
  • Python: 3.13.7
  • Tox: 4.30.1
Output of pip list of the host Python, where tox is installed
Package               Version
--------------------- --------------
arrow                 1.3.0
binaryornot           0.4.4
cachetools            6.1.0
certifi               2025.8.3
cfgv                  3.4.0
chardet               5.2.0
charset-normalizer    3.4.3
click                 8.2.1
colorama              0.4.6
cookiecutter          2.6.0
cruft                 2.16.0
distlib               0.3.9
filelock              3.18.0
gitdb                 4.0.12
GitPython             3.1.45
identify              2.6.12
idna                  3.10
Jinja2                3.1.6
markdown-it-py        4.0.0
MarkupSafe            3.0.2
mdurl                 0.1.2
nodeenv               1.9.1
packaging             25.0
pip                   25.2
platformdirs          4.3.8
pluggy                1.6.0
pre_commit            4.2.0
Pygments              2.19.2
pyproject-api         1.9.1
python-dateutil       2.9.0.post0
python-slugify        8.0.4
PyYAML                6.0.2
requests              2.32.5
rich                  14.1.0
shellingham           1.5.4
six                   1.17.0
smmap                 5.0.2
text-unidecode        1.3
tox                   4.30.1
typer                 0.16.1
types-python-dateutil 2.9.0.20250809
typing_extensions     4.14.1
urllib3               2.5.0
virtualenv            20.31.2

Output of running tox

Output of tox -rvv
ROOT: HandledError| SetupCfg failed loading /home/lukken/projects/astron/lofar2/stingray/setup.cfg due to section tox:tox not found

Minimal example

setup.cfg

[metadata]
name = lofar-stingray
description = LOFAR station statistics gather and dump utility, writes station statistics continuously to the local S3 based object storage.
long_description = file: README.md
long_description_content_type = text/markdown
url = https://git.astron.nl/lofar2.0/stingray
license = Apache License 2.0
classifiers =
    Development Status :: 3 - Alpha
    Environment :: No Input/Output (Daemon)
    Intended Audience :: Developers
    Intended Audience :: Science/Research
    License :: OSI Approved :: Apache Software License
    Operating System :: OS Independent
    Programming Language :: Python
    Programming Language :: Python :: 3
    Programming Language :: Python :: 3 :: Only
    Programming Language :: Python :: 3.11
    Programming Language :: Python :: 3.12
    Topic :: Utilities
    Topic :: System :: Archiving :: Compression
    Topic :: Scientific/Engineering
    Topic :: Scientific/Engineering :: Astronomy

[options]
include_package_data = true
packages = find:
python_requires = >=3.11
install_requires = file: requirements.txt

pyproject.toml

[build-system]
requires = [
    "setuptools>=70.0",
    "setuptools_scm[toml]>=8.0",
    "wheel"
]
build-backend = "setuptools.build_meta"

[tool.tox]
# Generative environment list to test all supported Python versions
requires = ["tox>=4.21"]
env_list = ["lint"]

[tool.tox.env_run_base]
package = "editable"
deps = [
    "-r{toxinidir}/requirements.txt",
    "-r{toxinidir}/tests/requirements.txt"]
commands = [["python", "--version"], ["python", "-m", "pytest", "tests/{posargs}"]]

# Command prefixes to reuse the same virtualenv for all linting jobs.
[tool.tox.env.lint]
deps = [
    "ruff",
    "-r{toxinidir}/tests/requirements.txt"]
commands = [
    ["python", "-m", "ruff", "--version"],
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions