Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uppercase "extra" dependency marker not working #10889

Closed
1 task done
jeroendecroos opened this issue Feb 8, 2022 · 2 comments
Closed
1 task done

Uppercase "extra" dependency marker not working #10889

jeroendecroos opened this issue Feb 8, 2022 · 2 comments
Labels
PEP implementation Involves some PEP project: vendored dependency Related to a vendored dependency

Comments

@jeroendecroos
Copy link

Description

When installing a dependency with an "extras" specified ("dependency[extra]" https://www.python.org/dev/peps/pep-0508/#id12) it fails to install the requirement.

Pip does not fail, but a line in the logs show the issue:
Ignoring pystache: markers 'extra == "Mustache"' don't match your environment

I found some related issues:
#4617
#3810

But this seems either a regression or an unhandled case.

I've also started the debugger to confirm more:

(Pdb) l
454
455         def _make_requirement_from_install_req(
456             self, ireq: InstallRequirement, requested_extras: Iterable[str]
457         ) -> Optional[Requirement]:
458             import pdb; pdb.set_trace()
459  ->         if not ireq.match_markers(requested_extras):
460                 logger.info(
461                     "Ignoring %s: markers '%s' don't match your environment",
462                     ireq.name,
463                     ireq.markers,
464                 )
(Pdb) p requested_extras
frozenset({'mustache'})
(Pdb) p ireq
<InstallRequirement object: pystache; extra == "Mustache" (from gitchangelog[Mustache]) editable=False>
(Pdb) p  ireq.match_markers(requested_extras)
False
(Pdb) p  ireq.match_markers(frozenset({"Mustache"}))
True
(Pdb)

I'll probably can open up a PR to fix this soon.

Expected behavior

It installs the extra dependencies requested

pip version

22.0.3

Python version

3.7

OS

CentOS7

How to Reproduce

$ pip --version
pip 22.0.3 from [SCRUBED]/test_venv/lib/python3.7/site-packages/pip (python 3.7)
$ pip install gitchangelog[Mustache]

Output

Collecting gitchangelog[mustache]
  Downloading https://files.pythonhosted.org/packages/9d/f9/554f9d1e2031a330148299b81ed7d6d5f1ef8969154384ca4ae8dd403b7a/gitchangelog-3.0.4-py2.py3-none-any.
whl (54kB)
     |████████████████████████████████| 61kB 7.9MB/s
  Ignoring pystache: markers 'extra == "Mustache"' don't match your environment
Installing collected packages: gitchangelog
Successfully installed gitchangelog-3.0.4

Code of Conduct

@jeroendecroos jeroendecroos added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Feb 8, 2022
@jeroendecroos
Copy link
Author

jeroendecroos commented Feb 8, 2022

Seems the solution should be done in packaging I'll open an issue and link

@pradyunsg pradyunsg added project: vendored dependency Related to a vendored dependency PEP implementation Involves some PEP and removed type: bug A confirmed bug or unintended behavior S: needs triage Issues/PRs that need to be triaged labels Feb 16, 2022
@pradyunsg
Copy link
Member

Closing this, since this needs to be handled in packaging and is related to existing Python Packaging standards.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
PEP implementation Involves some PEP project: vendored dependency Related to a vendored dependency
Projects
None yet
Development

No branches or pull requests

2 participants