extras_require in setup.cfg doesn't allow hyphen in extras name
See original GitHub issueI’m porting a setup.py
file to declarative setup.cfg
. In this package, an extra contains a hyphen. This works when defined in setup.py
but does not when defined in setup.cfg
. If I change the hyphen to an underscore, it works again, but this would break the extra for users.
To reproduce:
setup.py
:
from setuptools import setup
setup()
setup.cfg
:
[options.extras_require]
extra-a =
pytest
extra_b =
pytest
tox.ini
(to automate the virtual env creation)
[testenv:a]
extras = extra-a
[testenv:b]
extras = extra_b
Then run:
$ tox -e a
$ tox -e b
Notice the extras are installed in the “b” environment but not the “a” environment. AFAICT, the only difference is the use of a hyphen instead of an underscore.
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (10 by maintainers)
Top Results From Across the Web
How to put extras_require in setup.cfg - Stack Overflow
You need a config section: [options.extras_require] test = faker; pytest. Syntax is documented here. Share. Share a link to this answer.
Read more >setuptools.txt - Collection of Repositories
``extras_require`` A dictionary mapping names of "extras" (optional features of your project) to strings or lists of strings specifying what other distributions ...
Read more >setuptools-0.6.14devdev.egg.darcspatch.txt - Tahoe-LAFS
misc/dependencies/setuptools-0.6c12dev.egg oldhex ... + """Distribution doesn't have an "extra feature" of the given name""" + +_provider_factories ...
Read more >venv/Lib/site-packages/setuptools/dist.py
from setuptools.config import parse_configuration ... 'extras_require' -- a dictionary mapping names of optional "extras" to the.
Read more >CHANGES.rst - platform/external/python/setuptools - Google Git
#1207: Add support for ``long_description_type`` to setup.cfg. declarative config as intended ... #732: Now extras with a hyphen are honored per PEP 426....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
When this bug was filed, setuptools relied on distutils to parse the config files. Since then, in 24be5abd4cbd9d84537c457456f841522d626e14, the code was inlined, so it should be straightforward to adjust the parsing behavior. I believe it’s worth seriously considering just dropping that substitution.
As Jason mentioned, since the config parsing code is now within Setuptools, I believe this line is responsible for turning hyphens to underscores: https://github.com/pypa/setuptools/blob/main/setuptools/dist.py#L601. I wonder if we can simply remove the line, but I’m not sure if there are disadvantages to doing this.