pypa / flit

Simplified packaging of Python modules

Home Page:https://flit.pypa.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WARNING: project does not provide the extra

aaarrti opened this issue · comments

Hi,
I have a project which has nested optional dependencies, for example

[project.optional-dependencies]
foo_bar = []
dev = ["sampleproject[foo_bar]"]

running pip install .[dev] prints

WARNING: sampleproject 3.0.0 does not provide the extra 'foo-bar'

even though I have never requested extra foo-bar. It seems to me like flit assumes extra dependencies are always in kebab-case. Is this behaviour expected?

(fyi: I am not a flit maintainer, but I figured I can answer this)

flit assumes extra dependencies are always in kebab-case

In this case, it's actually the correct implementation of this specification — see "Name normalization".

But in any case, flit does not do anything here; When you do pip install .[dev], pip itself parses the extras when installing your package: https://github.com/pypa/pip/blob/9ef0fdfc848c7796d10eae436f8880018851555a/src/pip/_internal/req/constructors.py#L330

So, yes, this behaviour is expected, as all package and extras names in Python get normalized to kebab-case

Thanks @kytta for answering this!

The normalisation to kebab-case isn't actually implemented yet - it's part of PR #676 - but I don't think that will change pip's behaviour on this. I'm not sure whether depending on an extra in your own project is exactly expected - possibly this doesn't work right when you're installing from a local folder rather than a package index.