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

Incorrect warning that package "does not provide the extra" when extra contains an underscore #12431

Closed
1 task done
tjsmart opened this issue Dec 13, 2023 · 1 comment
Closed
1 task done
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior

Comments

@tjsmart
Copy link

tjsmart commented Dec 13, 2023

Description

If a package's extras contains an underscore pip will warn that the package "does not provide the extra" when in fact it does.

Expected behavior

I expected that whether a package specifies an extra named foo-bar or foo_bar that anyone should be able to pip install the extra dependency foo-bar or foo_bar without any warnings.

pip version

23.3.1

Python version

3.10.1

OS

Ubuntu 20.04.6 LTS

How to Reproduce

  1. Create a setup.cfg file with the following contents:
[metadata]
name = hello_hello
version = 0.0.0

[options.extras_require]
bye_bye =
    typing-extensions
  1. Create a setup.py file with the following contents:
from setuptools import setup

setup()
  1. Then run pip install -e '.[bye_bye]'.

Note:

  • A warning is emitted: "WARNING: hello-hello 0.0.0 does not provide the extra 'bye-bye'".
  • The bye-bye extras is used, and (in this case) typing-extensions is installed as desired.

Known Workaround

If I instead specify the extras with a hyphen, by making the following change to my setup.cfg:

[options.extras_require]
- bye_bye =
+ bye-bye =
    typing-extensions

The above command pip install -e '.[bye_bye]' runs successfully without any warning.

Also note that in both situations, the behavior does not change if I specify pip install -e '.[bye-bye]' from the command line.

Output

$ pip install -e '.[bye_bye]'
Looking in indexes: https://pypi.org/simple
Obtaining file:///tmp/cfg_extras
  Preparing metadata (setup.py) ... done
WARNING: hello-hello 0.0.0 does not provide the extra 'bye-bye'
Collecting typing-extensions
  Using cached typing_extensions-4.9.0-py3-none-any.whl.metadata (3.0 kB)
Using cached typing_extensions-4.9.0-py3-none-any.whl (32 kB)
Installing collected packages: hello-hello, typing-extensions
  Running setup.py develop for hello-hello
Successfully installed hello-hello-0.0.0 typing-extensions-4.9.0

Code of Conduct

@tjsmart tjsmart added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Dec 13, 2023
@uranusjr
Copy link
Member

This is a side effect of #11445.

@uranusjr uranusjr closed this as not planned Won't fix, can't repro, duplicate, stale Dec 13, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants