Skip to content

Tox 4.4.0: Unnamed requirements are not allowed as constraints #2897

@mikegrima

Description

@mikegrima

Issue

Hello!

I have noticed a very recent issue with the latest Tox release (4.4.0) that is not present in 4.3.5. Whenever running tox, I get a bizarre error when installing dependencies where it complains about constraints. I have not defined any so I don't know why this error is happening. I'm running Python 3.9.

Environment

This happens on GitHub runners and also on my Mac.

% pip list
Package       Version
------------- -------
cachetools    5.3.0
chardet       5.1.0
colorama      0.4.6
distlib       0.3.6
filelock      3.9.0
packaging     23.0
pip           22.0.4
platformdirs  2.6.2
pluggy        1.0.0
pyproject_api 1.5.0
setuptools    58.1.0
tomli         2.0.1
tox           4.4.0
virtualenv    20.17.1

Output of running tox

% tox
py39: install_deps> python -I -m pip install '.[tests]'
.pkg: install_requires> python -I -m pip install setuptools
.pkg: _optional_hooks> python '/my/code/path/venv/lib/python3.9/site-packages/pyproject_api/_backend.py' True setuptools.build_meta
.pkg: get_requires_for_build_sdist> python '/my/code/path/venv/lib/python3.9/site-packages/pyproject_api/_backend.py' True setuptools.build_meta
.pkg: prepare_metadata_for_build_wheel> python '/my/code/path/venv/lib/python3.9/site-packages/pyproject_api/_backend.py' True setuptools.build_meta
.pkg: build_sdist> python '/my/code/path/venv/lib/python3.9/site-packages/pyproject_api/_backend.py' True setuptools.build_meta
py39: install_package_deps> python -I -m pip install PyJWT cloudaux cryptography requests retry slack-bolt '-c/my/code/path/.tox/py39/constraints.txt'
DEPRECATION: Constraints are only allowed to take the form of a package name and a version specifier. Other forms were originally permitted as an accident of the implementation, but were undocumented. The new implementation of the resolver no longer supports these forms. A possible replacement is replacing the constraint with a requirement. Discussion can be found at https://github.com/pypa/pip/issues/8210
ERROR: Unnamed requirements are not allowed as constraints

py39: exit 1 (0.32 seconds) /my/code/path> python -I -m pip install PyJWT cloudaux cryptography requests retry slack-bolt '-c/my/code/path/.tox/py39/constraints.txt' pid=70956
py39: FAIL ✖ in 14.78 seconds
lint: install_deps> python -I -m pip install '.[tests]'
lint: install_package_deps> python -I -m pip install PyJWT cloudaux cryptography requests retry slack-bolt '-c/my/code/path/.tox/lint/constraints.txt'
DEPRECATION: Constraints are only allowed to take the form of a package name and a version specifier. Other forms were originally permitted as an accident of the implementation, but were undocumented. The new implementation of the resolver no longer supports these forms. A possible replacement is replacing the constraint with a requirement. Discussion can be found at https://github.com/pypa/pip/issues/8210
ERROR: Unnamed requirements are not allowed as constraints

lint: exit 1 (0.31 seconds) /my/code/path> python -I -m pip install PyJWT cloudaux cryptography requests retry slack-bolt '-c/my/code/path/.tox/lint/constraints.txt' pid=71034
.pkg: _exit> python '/my/code/path/venv/lib/python3.9/site-packages/pyproject_api/_backend.py' True setuptools.build_meta
  py39: FAIL code 1 (14.78 seconds)
  lint: FAIL code 1 (12.69 seconds)
  evaluation failed :( (27.51 seconds)

Additional Details

I'm making use of pyproject.toml. I have a flat requirements.txt file with:

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}

In tox.ini, I have:

[testenv]
deps =
    .[tests]
commands =
    pytest --cov MYPROJECT --cov-report term-missing MYPROJECT/ -n auto {posargs}

Reverting back to 4.3.5 resolves the issue.

Metadata

Metadata

Assignees

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