I have the following section in my pyproject.toml:
[tool.setuptools.dynamic.optional-dependencies]
some_extra = {file = ["requirements-some-extra.txt"]}
However, when I try to install the package with said extra like so:
pip install -e "./package[some_extra]"
Then I get a warning from pip:
WARNING: package 0.0.1 does not provide the extra 'some-extra'
At the same time, it is also not allowed to use hyphens in the pyproject.toml key. I tried
[tool.setuptools.dynamic.optional-dependencies]
some-extra = {file = ["requirements-some-extra.txt"]}
but the key needs to be a valid python identifier.
What am I doing wrong?
Just a note: When not using a separator symbol, it all works fine, but I feel like it should be possible to use one.
One possibility is that
pipis warning about the lack of normalisation in theextrasname. This is a relatively recent deployment (insetuptools-years), mandated by PEP 685, and that has not yet been fully implemented insetuptools.I suspect that a newer version of setuptools will automatically do the normalisation, however, as you mentioned,
setuptoolsvalidation ofpyproject.tomlhas not yet been updated to consider PEP 685. Have you tried to use the latest version of setuptools in[build-system] requires?Another possibility is that
pipwants you to writepackage[some-extra]in thepip installcommand.