Mixed environment markers in extras produces mangled results

Open
#2,335 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
build-system

Research direction

Reproduce the issue from the setup.py example by running setup.py -q egg_info and inspect foo.egg-info/requires.txt. Trace how markers from the extra name and requirement are combined; done means the generated metadata contains valid combined marker syntax or rejects the mixed input clearly.

Written by the indexing model from the issue text.

Description

Creating a project that provides environment markers in both the extra name and in the requirements list produces mangled results in the metadata.

Example:

draft $ cat setup.py                                                                                                                                       
import setuptools
setuptools.setup(
    name='foo',
    extras_require = {
        'pyarrow: python_version >= "3.4"': [
            'pyarrow >= 1.0.0, < 2.0dev; python_version >= "3.5"',
        ],
    },
)
draft $ pip-run -q setuptools -- setup.py -q egg_info                                                                                                      
WARNING: You are using pip version 20.1.1; however, version 20.2.2 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -m pip install --upgrade pip' command.
draft $ cat foo.egg-info/requires.txt                                                                                                                      

[pyarrow: python_version >= "3.4"]

[pyarrow: python_version >= "3.4":python_version >= "3.5"]
pyarrow<2.0dev,>=1.0.0

Note python_version >= "3.4":python_version >= "3.5" is invalid environment marker syntax.

Setuptools should produce valid syntax by combining the two sets of markers with and or error if markers are specified in both places.

Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pypa/setuptools

All issues in pypa/setuptools

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.