-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
Recursive extra dependencies compiles wrong requirements.txt #2110
Comments
This is an edge case; we probably need to add some logic to drop the origin requirements if they are recursive extras, as they are redundant if the dependencies they imply are already part of the requirements file. That should happen directly after the resolution process. It's rather low priority, I presume, we have a lot of other issues to tackle right now - you're welcome to try and draft a fix, of course. |
I encountered this issue too - as workaround for now, I stopped using nested optional-dependencies groups. Using the example above: [project.optional-dependencies]
dev = ["build", "pyyaml"] # instead of `["package[test,tools]"]`
tools = ["build"]
test = ["pyyaml"] |
To eliminate the ambiguity: these are not dependency groups, but extras. Dependency groups are a separate concept that basically standardize what pip's requirements files solve across the ecosystem through PEP 735. They are exposed to project contributors (those who work with Git checkouts, usually). And extras are pieces of metadata that are exposed to all end-users, especially those that get dists from PyPI. People are so used to abusing extras as dependency groups because there was no standard in the past, and also they didn't realize that extras are public APIs for the end-users essentially. |
The line:
Declares "a dependency of this package is That makes the package I understand the intent of wanting to specify that an extra depends on other extras, but that's not what this syntax means, and not how pip will interpret it. |
@WhyNotHugo I think, pip started supporting this at some point, but it's tribal knowledge. Hynek said it's since pip 21.2: https://hynek.me/articles/python-recursive-optional-dependencies/. The change log does not call it out explicitly, though: https://pip.pypa.io/en/stable/news/#v21-2. It's not really documented prominently anywhere: pypa/pip#11296. And the maintainers don't even know what enabled the feature: pypa/pip#10393 (comment). |
Thanks for the clarification. I had no idea. I hope you'll forgive my ignorance, given that the devs themselves didn't even know about it 😂 |
When pyproject.toml references its own local package to recursively include extra dependencies, it outputs a requirements.txt file which references the local package with the absolute path which is a problem as its not portable and should instead just list the dependencies
It was previously possible with setup.py with this configuration:
Environment Versions
Steps to replicate
Expected result
Actual result
Linked issues
The text was updated successfully, but these errors were encountered: