pip icon indicating copy to clipboard operation
pip copied to clipboard

Document support for self-referential extras

Open ofek opened this issue 2 years ago • 3 comments

What's the problem this feature will solve?

This (coupled with maybe a new explicit test) will provide a guarantee to users that the following use case is supported:

[project]
name = "pkg"

[project.optional-dependencies]
all = ["pkg[a]", "pkg[b]"]
a = ["..."]
b = ["..."]

Describe the solution you'd like

Add a note in docs + a new test that explicitly checks this

Alternative Solutions

N/A

Additional context

@ichard26 found that this has been supported since 21.2 (tested by @henryiii) https://github.com/pypa/pip/issues/10393#issuecomment-941885429

Code of Conduct

ofek avatar Jul 24 '22 00:07 ofek

I marked this as awaiting PR. I'd say a having adding a test is important if we document it.

sbidoul avatar Jul 25 '22 08:07 sbidoul

Upd. I'm not sure what has changed, but I can't reproduce this behaviour anymore.

~~From https://github.com/pypa/hatch/pull/724#issuecomment-1420714830:~~

This doesn't work for me when my project name overlaps with other project available on PyPI (though I'm installing it in editable mode):

[project]
name = "chatbot"

[project.optional-dependencies]
profiling = ["pyinstrument"]
debugging = ["ipython"]
style = ["ruff", "black"]
testing = ["pytest", "pytest-cov"]
typechecking = ["mypy"]
all = ["chatbot[style,profiling,debugging,testing,typechecking]"]

Upon hatch run mypy, I get:

WARNING: chatbot 1.5.2b0 does not provide the extra 'debugging'
WARNING: chatbot 1.5.2b0 does not provide the extra 'profiling'
WARNING: chatbot 1.5.2b0 does not provide the extra 'style'
WARNING: chatbot 1.5.2b0 does not provide the extra 'testing'
WARNING: chatbot 1.5.2b0 does not provide the extra 'typechecking'
/bin/sh: mypy: command not found

Bobronium avatar Feb 08 '23 18:02 Bobronium

I don't think that's related to pip. You either didn't reinstall the package after changing the metadata (i.e. dependencies) or there's possibility some interaction with how hatch does things. If you are able to reproduce the failure from scratch in a new virtualenv, please file a new issue with the details.

pradyunsg avatar Feb 08 '23 18:02 pradyunsg