Skip to content

'Parsed object has no attribute list_dependencies' on tox 4.6.2 when following guidance for testing EOL python versions #3042

@Mystake3

Description

@Mystake3

Issue

After upgrading to tox 4.6.0+ started seeing the following errors when performing a tox list command.

AttributeError: 'Parsed' object has no attribute 'list_dependencies'

This only occurs if there is a requires element in the [tox] section of the configuration ini. The one in this case is requires = virtualenv<20.22.0 which is being used to test EOL Python versions per the tox FAQ.

Looks like the settings querying done by #3024 should be performing a .get rather than expect the value to always be there.

Environment

Provide at least:

  • OS: Windows 10 x64, Python 3.11.2 x64
Output of pip list of the host Python, where tox is installed
(test_env) C:\Projects\simpleproject>pip list
Package       Version
------------- -------
cachetools    5.3.1
chardet       5.1.0
colorama      0.4.6
distlib       0.3.6
filelock      3.12.2
packaging     23.1
pip           23.1.2
platformdirs  3.5.3
pluggy        1.0.0
pyproject-api 1.5.2
setuptools    67.8.0
tox           4.6.2
virtualenv    20.23.1
wheel         0.40.0

Output of running tox

Output of tox -rvv
(test_env) C:\Projects\simpleproject>tox list -rvv
ROOT: 796 W will run in automatically provisioned tox, host C:\Projects\test_env\Scripts\python.exe is missing [requires (has)]: virtualenv<20.22.0 (20.23.1) [tox\provision.py:125]
ROOT: 828 I find interpreter for spec PythonSpec(path=C:\Projects\test_env\Scripts\python.exe) [virtualenv\discovery\builtin.py:58]
ROOT: 828 D got python info of %s from (WindowsPath('C:/Python311x64/python.exe'), WindowsPath('C:/Users/dev/AppData/Local/pypa/virtualenv/py_info/1/466d3831b321449d78c94ed99affac38a772e29cc437bae341ba817d9a397f45.json')) [virtualenv\app_data\via_disk_folder.py:131]
ROOT: 828 I proposed PythonInfo(spec=CPython3.11.4.final.0-64, system=C:\Python311x64\python.exe, exe=C:\Projects\test_env\Scripts\python.exe, platform=win32, version='3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]', encoding_fs_io=utf-8-cp1252) [virtualenv\discovery\builtin.py:65]
ROOT: 828 D accepted PythonInfo(spec=CPython3.11.4.final.0-64, system=C:\Python311x64\python.exe, exe=C:\Projects\test_env\Scripts\python.exe, platform=win32, version='3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]', encoding_fs_io=utf-8-cp1252) [virtualenv\discovery\builtin.py:67]
ROOT: 843 D symlink on filesystem does not work [virtualenv\info.py:45]
ROOT: 843 D filesystem is not case-sensitive [virtualenv\info.py:26]
ROOT: 952 I will run in a automatically provisioned python environment under C:\Projects\simpleproject\.tox\.tox\Scripts\python.exe [tox\provision.py:146]
ROOT: 952 W remove tox env folder C:\Projects\simpleproject\.tox\.tox [tox\tox_env\api.py:322]
ROOT: 1578 I create virtual environment via CPython3Windows(dest=C:\Projects\simpleproject\.tox\.tox, clear=False, no_vcs_ignore=False, global=False) [virtualenv\run\session.py:50]
ROOT: 1578 D create folder C:\Projects\simpleproject\.tox\.tox\Lib\site-packages [virtualenv\util\path\_sync.py:12]
ROOT: 1593 D create folder C:\Projects\simpleproject\.tox\.tox\Scripts [virtualenv\util\path\_sync.py:12]
ROOT: 1593 D write C:\Projects\simpleproject\.tox\.tox\pyvenv.cfg [virtualenv\create\pyenv_cfg.py:32]
ROOT: 1593 D    home = C:\Python311x64 [virtualenv\create\pyenv_cfg.py:36]
ROOT: 1593 D    implementation = CPython [virtualenv\create\pyenv_cfg.py:36]
ROOT: 1593 D    version_info = 3.11.4.final.0 [virtualenv\create\pyenv_cfg.py:36]
ROOT: 1593 D    virtualenv = 20.23.1 [virtualenv\create\pyenv_cfg.py:36]
ROOT: 1593 D    include-system-site-packages = false [virtualenv\create\pyenv_cfg.py:36]
ROOT: 1593 D    base-prefix = C:\Python311x64 [virtualenv\create\pyenv_cfg.py:36]
ROOT: 1593 D    base-exec-prefix = C:\Python311x64 [virtualenv\create\pyenv_cfg.py:36]
ROOT: 1593 D    base-executable = C:\Python311x64\python.exe [virtualenv\create\pyenv_cfg.py:36]
ROOT: 1609 D copy C:\Python311x64\Lib\venv\scripts\nt\python.exe to C:\Projects\simpleproject\.tox\.tox\Scripts\python.exe [virtualenv\util\path\_sync.py:40]
ROOT: 1656 D copy C:\Python311x64\Lib\venv\scripts\nt\pythonw.exe to C:\Projects\simpleproject\.tox\.tox\Scripts\pythonw.exe [virtualenv\util\path\_sync.py:40]
ROOT: 1703 D create virtualenv import hook file C:\Projects\simpleproject\.tox\.tox\Lib\site-packages\_virtualenv.pth [virtualenv\create\via_global_ref\api.py:91]
ROOT: 1718 D create C:\Projects\simpleproject\.tox\.tox\Lib\site-packages\_virtualenv.py [virtualenv\create\via_global_ref\api.py:94]
ROOT: 1718 D ============================== target debug ============================== [virtualenv\run\session.py:52]
ROOT: 1718 D debug via 'C:\Projects\simpleproject\.tox\.tox\Scripts\python.exe' 'C:\Projects\test_env\Lib\site-packages\virtualenv\create\debug.py' [virtualenv\create\creator.py:200]
ROOT: 1718 D {
  "sys": {
    "executable": "C:\\Projects\\simpleproject\\.tox\\.tox\\Scripts\\python.exe",
    "_base_executable": "C:\\Python311x64\\python.exe",
    "prefix": "C:\\Projects\\simpleproject\\.tox\\.tox",
    "base_prefix": "C:\\Python311x64",
    "real_prefix": null,
    "exec_prefix": "C:\\Projects\\simpleproject\\.tox\\.tox",
    "base_exec_prefix": "C:\\Python311x64",
    "path": [
      "C:\\Python311x64\\python311.zip",
      "C:\\Python311x64\\DLLs",
      "C:\\Python311x64\\Lib",
      "C:\\Python311x64",
      "C:\\Projects\\simpleproject\\.tox\\.tox",
      "C:\\Projects\\simpleproject\\.tox\\.tox\\Lib\\site-packages"
    ],
    "meta_path": [
      "<class '_virtualenv._Finder'>",
      "<class '_frozen_importlib.BuiltinImporter'>",
      "<class '_frozen_importlib.FrozenImporter'>",
      "<class '_frozen_importlib_external.PathFinder'>"
    ],
    "fs_encoding": "utf-8",
    "io_encoding": "cp1252"
  },
  "version": "3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]",
  "makefile_filename": "C:\\Python311x64\\Lib\\config\\Makefile",
  "os": "<module 'os' (frozen)>",
  "site": "<module 'site' (frozen)>",
  "datetime": "<module 'datetime' from 'C:\\\\Python311x64\\\\Lib\\\\datetime.py'>",
  "math": "<module 'math' (built-in)>",
  "json": "<module 'json' from 'C:\\\\Python311x64\\\\Lib\\\\json\\\\__init__.py'>"
} [virtualenv\run\session.py:53]
ROOT: 1953 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\dev\AppData\Local\pypa\virtualenv) [virtualenv\run\session.py:57]
ROOT: 1968 D install pip from wheel C:\Projects\test_env\Lib\site-packages\virtualenv\seed\wheels\embed\pip-23.1.2-py3-none-any.whl via CopyPipInstall [virtualenv\seed\embed\via_app_data\via_app_data.py:49]
ROOT: 1968 D install setuptools from wheel C:\Projects\test_env\Lib\site-packages\virtualenv\seed\wheels\embed\setuptools-67.8.0-py3-none-any.whl via CopyPipInstall [virtualenv\seed\embed\via_app_data\via_app_data.py:49]
ROOT: 1968 D install wheel from wheel C:\Projects\test_env\Lib\site-packages\virtualenv\seed\wheels\embed\wheel-0.40.0-py3-none-any.whl via CopyPipInstall [virtualenv\seed\embed\via_app_data\via_app_data.py:49]
ROOT: 1984 D copy directory C:\Users\dev\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\pip-23.1.2-py3-none-any\pip to C:\Projects\simpleproject\.tox\.tox\Lib\site-packages\pip [virtualenv\util\path\_sync.py:40]
ROOT: 1984 D copy C:\Users\dev\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-67.8.0-py3-none-any\distutils-precedence.pth to C:\Projects\simpleproject\.tox\.tox\Lib\site-packages\distutils-precedence.pth [virtualenv\util\path\_sync.py:40]
ROOT: 1984 D copy directory C:\Users\dev\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\wheel-0.40.0-py3-none-any\wheel to C:\Projects\simpleproject\.tox\.tox\Lib\site-packages\wheel [virtualenv\util\path\_sync.py:40]
ROOT: 2000 D copy directory C:\Users\dev\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-67.8.0-py3-none-any\pkg_resources to C:\Projects\simpleproject\.tox\.tox\Lib\site-packages\pkg_resources [virtualenv\util\path\_sync.py:40]
ROOT: 2203 D copy directory C:\Users\dev\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\wheel-0.40.0-py3-none-any\wheel-0.40.0.dist-info to C:\Projects\simpleproject\.tox\.tox\Lib\site-packages\wheel-0.40.0.dist-info [virtualenv\util\path\_sync.py:40]
ROOT: 2249 D copy C:\Users\dev\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\wheel-0.40.0-py3-none-any\wheel-0.40.0.virtualenv to C:\Projects\simpleproject\.tox\.tox\Lib\site-packages\wheel-0.40.0.virtualenv [virtualenv\util\path\_sync.py:40]
ROOT: 2421 D generated console scripts wheel3.exe wheel-3.11.exe wheel.exe wheel3.11.exe [virtualenv\seed\embed\via_app_data\pip_install\base.py:43]
ROOT: 2436 D copy directory C:\Users\dev\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-67.8.0-py3-none-any\setuptools to C:\Projects\simpleproject\.tox\.tox\Lib\site-packages\setuptools [virtualenv\util\path\_sync.py:40]
ROOT: 4311 D copy directory C:\Users\dev\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-67.8.0-py3-none-any\setuptools-67.8.0.dist-info to C:\Projects\simpleproject\.tox\.tox\Lib\site-packages\setuptools-67.8.0.dist-info [virtualenv\util\path\_sync.py:40]
ROOT: 4358 D copy C:\Users\dev\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-67.8.0-py3-none-any\setuptools-67.8.0.virtualenv to C:\Projects\simpleproject\.tox\.tox\Lib\site-packages\setuptools-67.8.0.virtualenv [virtualenv\util\path\_sync.py:40]
ROOT: 4358 D copy directory C:\Users\dev\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\setuptools-67.8.0-py3-none-any\_distutils_hack to C:\Projects\simpleproject\.tox\.tox\Lib\site-packages\_distutils_hack [virtualenv\util\path\_sync.py:40]
ROOT: 4374 D generated console scripts  [virtualenv\seed\embed\via_app_data\pip_install\base.py:43]
ROOT: 6233 D copy directory C:\Users\dev\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\pip-23.1.2-py3-none-any\pip-23.1.2.dist-info to C:\Projects\simpleproject\.tox\.tox\Lib\site-packages\pip-23.1.2.dist-info [virtualenv\util\path\_sync.py:40]
ROOT: 6280 D copy C:\Users\dev\AppData\Local\pypa\virtualenv\wheel\3.11\image\1\CopyPipInstall\pip-23.1.2-py3-none-any\pip-23.1.2.virtualenv to C:\Projects\simpleproject\.tox\.tox\Lib\site-packages\pip-23.1.2.virtualenv [virtualenv\util\path\_sync.py:40]
ROOT: 6452 D generated console scripts pip3.exe pip-3.11.exe pip3.11.exe pip.exe [virtualenv\seed\embed\via_app_data\pip_install\base.py:43]
ROOT: 6452 I add activators for Bash, Batch, Fish, Nushell, PowerShell, Python [virtualenv\run\session.py:63]
ROOT: 6499 D write C:\Projects\simpleproject\.tox\.tox\pyvenv.cfg [virtualenv\create\pyenv_cfg.py:32]
ROOT: 6499 D    home = C:\Python311x64 [virtualenv\create\pyenv_cfg.py:36]
ROOT: 6515 D    implementation = CPython [virtualenv\create\pyenv_cfg.py:36]
ROOT: 6515 D    version_info = 3.11.4.final.0 [virtualenv\create\pyenv_cfg.py:36]
ROOT: 6515 D    virtualenv = 20.23.1 [virtualenv\create\pyenv_cfg.py:36]
ROOT: 6515 D    include-system-site-packages = false [virtualenv\create\pyenv_cfg.py:36]
ROOT: 6515 D    base-prefix = C:\Python311x64 [virtualenv\create\pyenv_cfg.py:36]
ROOT: 6515 D    base-exec-prefix = C:\Python311x64 [virtualenv\create\pyenv_cfg.py:36]
ROOT: 6515 D    base-executable = C:\Python311x64\python.exe [virtualenv\create\pyenv_cfg.py:36]
ROOT: 6530 W install_deps> python -I -m pip install tox virtualenv<20.22.0 [tox\tox_env\api.py:427]
Looking in indexes: https://pypi.org/simple/
Collecting tox
  Using cached https://pypi.org/packages/3c/d7/092d1293f4bc30cd5c4532cdfb459c652b676f254750bb1fe04ec743c800/tox-4.6.2-py3-none-any.whl (151 kB)
Collecting virtualenv<20.22.0
  Using cached https://pypi.org/packages/fb/9b/445412c769289c18a5f9c2e8c816c1369f6c5fae4802f2196e5aef7630fd/virtualenv-20.21.1-py3-none-any.whl (8.7 MB)
Collecting cachetools>=5.3.1 (from tox)
  Using cached https://pypi.org/packages/a9/c9/c8a7710f2cedcb1db9224fdd4d8307c9e48cbddc46c18b515fefc0f1abbe/cachetools-5.3.1-py3-none-any.whl (9.3 kB)
Collecting chardet>=5.1 (from tox)
  Using cached https://pypi.org/packages/74/8f/8fc49109009e8d2169d94d72e6b1f4cd45c13d147ba7d6170fb41f22b08f/chardet-5.1.0-py3-none-any.whl (199 kB)
Collecting colorama>=0.4.6 (from tox)
  Using cached https://pypi.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting filelock>=3.12.2 (from tox)
  Using cached https://pypi.org/packages/00/45/ec3407adf6f6b5bf867a4462b2b0af27597a26bd3cd6e2534cb6ab029938/filelock-3.12.2-py3-none-any.whl (10 kB)
Collecting packaging>=23.1 (from tox)
  Using cached https://pypi.org/packages/ab/c3/57f0601a2d4fe15de7a553c00adbc901425661bf048f2a22dfc500caf121/packaging-23.1-py3-none-any.whl (48 kB)
Collecting platformdirs>=3.5.3 (from tox)
  Using cached https://pypi.org/packages/6d/1a/96efea7b36835ce89911d7813fe68f5b1db7ecae4023bf209a7aeba93017/platformdirs-3.5.3-py3-none-any.whl (15 kB)
Collecting pluggy>=1 (from tox)
  Using cached https://pypi.org/packages/9e/01/f38e2ff29715251cf25532b9082a1589ab7e4f571ced434f98d0139336dc/pluggy-1.0.0-py2.py3-none-any.whl (13 kB)
Collecting pyproject-api>=1.5.2 (from tox)
  Using cached https://pypi.org/packages/ce/a7/0666a457fe35518d998448a6606b5f66c4bf092864bac6ef7fc380da582b/pyproject_api-1.5.2-py3-none-any.whl (12 kB)
INFO: pip is looking at multiple versions of tox to determine which version is compatible with other requirements. This could take a while.
Collecting tox
  Using cached https://pypi.org/packages/ac/78/25ccd23e1755e3d86a77272f1e5192a48a7333c4c4e79076c753d34da8ea/tox-4.6.1-py3-none-any.whl (151 kB)
  Using cached https://pypi.org/packages/25/a2/bd10aec8c560e97fd6fc0ae044a42dc2d1095fdb3c56d8965ac68c69aa22/tox-4.6.0-py3-none-any.whl (148 kB)
  Using cached https://pypi.org/packages/eb/2a/1cf03754356acd0fa2d89c825878e499072488a455e57554db262d9bcd93/tox-4.5.2-py3-none-any.whl (148 kB)
  Using cached https://pypi.org/packages/29/eb/5a56994b37d9141a6c7fa6ddb5c76a50b234a424eae4e79c56f33b61c686/tox-4.5.1-py3-none-any.whl (148 kB)
Collecting distlib<1,>=0.3.6 (from virtualenv<20.22.0)
  Using cached https://pypi.org/packages/76/cb/6bbd2b10170ed991cf64e8c8b85e01f2fb38f95d1bc77617569e0b0b26ac/distlib-0.3.6-py2.py3-none-any.whl (468 kB)
Installing collected packages: distlib, pluggy, platformdirs, packaging, filelock, colorama, chardet, cachetools, virtualenv, pyproject-api, tox
Successfully installed cachetools-5.3.1 chardet-5.1.0 colorama-0.4.6 distlib-0.3.6 filelock-3.12.2 packaging-23.1 platformdirs-3.5.3 pluggy-1.0.0 pyproject-api-1.5.2 tox-4.5.1 virtualenv-20.21.1
ROOT: 24993 I exit 0 (18.44 seconds) C:\Projects\simpleproject> python -I -m pip install tox virtualenv<20.22.0 pid=2992 [tox\execute\api.py:279]
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Projects\test_env\Lib\site-packages\tox\__main__.py", line 6, in <module>
    run()
  File "C:\Projects\test_env\Lib\site-packages\tox\run.py", line 19, in run
    result = main(sys.argv[1:] if args is None else args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Projects\test_env\Lib\site-packages\tox\run.py", line 41, in main
    result = provision(state)
             ^^^^^^^^^^^^^^^^
  File "C:\Projects\test_env\Lib\site-packages\tox\provision.py", line 126, in provision
    return run_provision(provision_tox_env, state)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Projects\test_env\Lib\site-packages\tox\provision.py", line 148, in run_provision
    tox_env.setup()
  File "C:\Projects\test_env\Lib\site-packages\tox\tox_env\api.py", line 256, in setup
    self._done_with_setup()
  File "C:\Projects\test_env\Lib\site-packages\tox\tox_env\python\api.py", line 231, in _done_with_setup
    if self.journal or self.options.list_dependencies:
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Parsed' object has no attribute 'list_dependencies'

Minimal example

pyproject.toml

[build-system]
build-backend = "hatchling.build"
requires = ["hatchling"]

[project]
name = "simpleproject"
version="1.0.0"
requires-python = ">=3.6"

[tool.hatch]
build.dev-mode-dirs = ["src"]
build.targets.sdist.include = ["/src", "/tests", "/tox.ini"]

[tool.black]
line-length = 120

tox.ini

[tox]
distshare={toxworkdir}/distshare
requires = virtualenv<20.22.0

[testenv]
description = Run a testenv

[testenv:something]
install_command = python -m pip install {opts} {packages}

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