Skip to content

Bug with poetry and overlapping extras #2791

@dconathan

Description

@dconathan

Issue

I'm not sure if this is a poetry bug or a tox bug, but I figured I'd start here. The issue seems to be with how:

def extract_extra_markers(deps: list[Requirement]) -> list[tuple[Requirement, set[str | None]]]:

is parsing extras that fall into multiple extra groups. That is if you have the same requirement in 2+ extra groups, poetry will e.g., produce the line:

Requires-Dist: filelock (>=3.9.0,<4.0.0) ; extra == "extras1" or extra == "extras2"

in the PKG-INFO

Then when tox is run with e.g., extras = extras1, you get:

py-extras1: install_package_deps> python -I -m pip install 'filelock<4.0.0,>=3.9.0; or extra == "extras2"'
...
pip._vendor.packaging.markers.InvalidMarker: Invalid marker: 'or extra == "extras2"', parse error at 'or extra'

Environment

Provide at least:

  • OS: macos
  • pip list of the host Python where tox is installed:
./.venv/bin/pip list
Package       Version
------------- -------
cachetools    5.2.0
chardet       5.1.0
colorama      0.4.6
distlib       0.3.6
filelock      3.9.0
packaging     22.0
pip           22.3.1
platformdirs  2.6.2
pluggy        1.0.0
pyproject_api 1.2.1
setuptools    65.5.0
tox           4.1.0
virtualenv    20.17.1

Minimal example

I've created a minimal poetry project that reproduces this bug: https://github.com/dconathan/poetry-tox-bug

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