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

extras_require doesn't work unless extras are all-lowercase #4617

Closed
nedbat opened this issue Jul 11, 2017 · 8 comments
Closed

extras_require doesn't work unless extras are all-lowercase #4617

nedbat opened this issue Jul 11, 2017 · 8 comments
Labels
C: extras Handling optional dependencies type: bug A confirmed bug or unintended behavior

Comments

@nedbat
Copy link

nedbat commented Jul 11, 2017

  • Pip version: 9.0.1
  • Python version: 3.5
  • Operating system: Mac

Description:

I tried to install django-rest-swagger[reST]==0.3.10, and it fails to install docutils:

$ pip install 'django-rest-swagger[reST]==0.3.10'
Collecting django-rest-swagger[reST]==0.3.10
  Using cached django_rest_swagger-0.3.10-py2.py3-none-any.whl
  Ignoring docutils: markers 'extra == "reST"' don't match your environment
Requirement already satisfied: PyYAML>=3.10 in /usr/local/virtualenvs/tmp-7024ad2664bea019/lib/python3.5/site-packages (from django-rest-swagger[rest]==0.3.10)
Requirement already satisfied: Django>=1.8 in /usr/local/virtualenvs/tmp-7024ad2664bea019/lib/python3.5/site-packages (from django-rest-swagger[rest]==0.3.10)
Requirement already satisfied: djangorestframework>=2.3.8 in /usr/local/virtualenvs/tmp-7024ad2664bea019/lib/python3.5/site-packages (from django-rest-swagger[rest]==0.3.10)
Requirement already satisfied: pytz in /usr/local/virtualenvs/tmp-7024ad2664bea019/lib/python3.5/site-packages (from Django>=1.8->django-rest-swagger[rest]==0.3.10)
Installing collected packages: django-rest-swagger
Successfully installed django-rest-swagger-0.3.10

django-rest-swagger has this in their setup.py:

extras_require = {
    'reST': ['docutils>=0.8'],
}

Stepping through the code, eventually "reST" is compared to "rest", and the error is produced.
Seems like extras_require keys have to be lowercase in order to work. No variation of "rest", "REST", "reST", etc, on the command line makes it succeed.

@pradyunsg pradyunsg added good first issue A good item for first time contributors to work on type: bug A confirmed bug or unintended behavior labels Jul 12, 2017
@pradyunsg
Copy link
Member

Thank you for filing this issue!

I'll try to take a look at this soon. :)

@pradyunsg pradyunsg self-assigned this Jul 12, 2017
@pradyunsg pradyunsg removed the good first issue A good item for first time contributors to work on label Jul 14, 2017
@pradyunsg pradyunsg added the C: extras Handling optional dependencies label Nov 11, 2017
@GabrielC101
Copy link
Contributor

GabrielC101 commented Dec 2, 2017

It seems this isn't a "bug" but a "feature." It was introduced in #4037 to fix #3810.

@ryan-copperleaf
Copy link

It’s decidedly a bug – just a bug introduced by a fix for a different bug.

@GabrielC101
Copy link
Contributor

GabrielC101 commented Dec 9, 2017

Sorry. I meant case insensitivity is a feature. But that's not the issue. You're right - it's a bug.

@benoit-pierre
Copy link
Member

benoit-pierre commented Sep 14, 2018

IHMO this is a bug in wheel: pypa/wheel#252.

@benoit-pierre
Copy link
Member

This can't really be fixed in pip because it does not have access to the original "unsafe" list of extras (pkg_resources will return a list of canonicalized extras), and the case insensitivity is a feature (all uses of django-rest-swagger[reST], django-rest-swagger[REST], or django-rest-swagger[rest] should work).

jfreeman812 pushed a commit to jfreeman812/QE-Tools that referenced this issue Apr 23, 2019
To work around this bug:
pypa/pip#4617

Hat tip to Brad Brown for finding this.
Uppercase worked when I was testing the package locally... sigh.
@pradyunsg
Copy link
Member

Tried this on pip 20.0.2:

$ pip install 'django-rest-swagger[reST]==0.3.10' --target /tmp/foo
Collecting django-rest-swagger[reST]==0.3.10
  Using cached django_rest_swagger-0.3.10-py2.py3-none-any.whl (212 kB)
  Ignoring docutils: markers 'extra == "reST"' don't match your environment
Collecting Django>=1.8
  Downloading Django-3.0.3-py3-none-any.whl (7.5 MB)
     |████████████████████████████████| 7.5 MB 713 kB/s 
Collecting djangorestframework>=2.3.8
  Downloading djangorestframework-3.11.0-py3-none-any.whl (911 kB)
     |████████████████████████████████| 911 kB 1.0 MB/s 
Processing /Users/pradyunsg/Library/Caches/pip/wheels/e4/76/4d/a95b8dd7b452b69e8ed4f68b69e1b55e12c9c9624dd962b191/PyYAML-5.3-cp38-cp38-macosx_10_14_x86_64.whl
Collecting asgiref~=3.2
  Downloading asgiref-3.2.3-py2.py3-none-any.whl (18 kB)
Collecting pytz
  Using cached pytz-2019.3-py2.py3-none-any.whl (509 kB)
Collecting sqlparse>=0.2.2
  Downloading sqlparse-0.3.1-py2.py3-none-any.whl (40 kB)
     |████████████████████████████████| 40 kB 930 kB/s 
Installing collected packages: asgiref, pytz, sqlparse, Django, djangorestframework, PyYAML, django-rest-swagger
Successfully installed Django-3.0.3 PyYAML-5.3 asgiref-3.2.3 django-rest-swagger-0.3.10 djangorestframework-3.11.0 pytz-2019.3 sqlparse-0.3.1

@ichard26
Copy link
Member

ichard26 commented May 7, 2024

Fixed by #12002 which landed in pip v23.3.

~/dev/oss/pip ❯ git checkout 24.0
HEAD is now at ef78c129b Tweak NEWS.rst

~/dev/oss/pip ❯ pip install django-rest-swagger[reST]==0.3.10 --target /tmp/pip/(uuidgen)
Collecting django-rest-swagger==0.3.10 (from django-rest-swagger[reST]==0.3.10)
  Using cached django_rest_swagger-0.3.10-py2.py3-none-any.whl.metadata (1.4 kB)
Collecting Django>=1.8 (from django-rest-swagger==0.3.10->django-rest-swagger[reST]==0.3.10)
  Using cached Django-5.0.6-py3-none-any.whl.metadata (4.1 kB)
Collecting PyYAML>=3.10 (from django-rest-swagger==0.3.10->django-rest-swagger[reST]==0.3.10)
  Using cached PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)
Collecting djangorestframework>=2.3.8 (from django-rest-swagger==0.3.10->django-rest-swagger[reST]==0.3.10)
  Using cached djangorestframework-3.15.1-py3-none-any.whl.metadata (11 kB)
Collecting docutils>=0.8 (from django-rest-swagger[reST]==0.3.10)
  Using cached docutils-0.21.2-py3-none-any.whl.metadata (2.8 kB)
Collecting asgiref<4,>=3.7.0 (from Django>=1.8->django-rest-swagger==0.3.10->django-rest-swagger[reST]==0.3.10)
  Using cached asgiref-3.8.1-py3-none-any.whl.metadata (9.3 kB)
Collecting sqlparse>=0.3.1 (from Django>=1.8->django-rest-swagger==0.3.10->django-rest-swagger[reST]==0.3.10)
  Using cached sqlparse-0.5.0-py3-none-any.whl.metadata (3.9 kB)
Using cached django_rest_swagger-0.3.10-py2.py3-none-any.whl (212 kB)
Using cached Django-5.0.6-py3-none-any.whl (8.2 MB)
Using cached djangorestframework-3.15.1-py3-none-any.whl (1.1 MB)
Using cached docutils-0.21.2-py3-none-any.whl (587 kB)
Using cached PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (757 kB)
Using cached asgiref-3.8.1-py3-none-any.whl (23 kB)
Using cached sqlparse-0.5.0-py3-none-any.whl (43 kB)
Installing collected packages: sqlparse, PyYAML, docutils, asgiref, Django, djangorestframework, django-rest-swagger
Successfully installed Django-5.0.6 PyYAML-6.0.1 asgiref-3.8.1 django-rest-swagger-0.3.10 djangorestframework-3.15.1 docutils-0.21.2 sqlparse-0.5.0

@ichard26 ichard26 closed this as completed May 7, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: extras Handling optional dependencies type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants