-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
extras are not validated against dependencies #7226
Comments
This is by design, the |
I'm going to close this for now as it's currently how this is designed; proposals for a better way to define extras are welcome, which could include the validations here (if we had something more specific than |
I think the way What is wrong in my opinion though is that I mean, take this for example:
and use it
I don't think this is related to Specifically:
Not sure if there are cases where a dependency is specified several times, then the above would not work and instead you need some |
python-poetry/poetry-core#542 Here would be a PR for it that fixes it, at least for |
It seems that this issue was closed due to a misunderstanding. If I don't miss anything, it doesn't make sense to reference a non-existent dependency in an extra. And since we define extras as arrays of dependencies, it makes sense to apply the same regex as for dependency names for validation.
There are multiple-constraints dependencies but I'm afraid these don't work well with extras anyway. |
@neersighted Has the design changed? Earlier same year @finswimmer, a member of poetry org, made directly the opposite statement in response to the issue #2357:
If the design has changed, can you please give any reference to the document that describes it. Otherwise which statement should be considered as the source of truth? |
They're both correct, I'm talking about the code as it exists today and the current architecture of how we define extras; @finswimmer is talking about the fact that while optional dependencies can be used to influence the solver, we won't capture them in the package's requirements unless they are assigned to an extra. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Issue
To give an example, with a pyproject.toml like
poetry lock
,poetry check
andpoetry install -E my_extra
all run without any error or anything. But they wouldn't install the numpy dependency. This is because there's an extra space inmy_extra = ["numpy "]
that means the extra isn't matched to the dependency. This would happen with any misspelling in themy_extra
list. So poetry just silently ignores entries in extras that can't be matched to a dependency.The poetry.lock file would just have a sections like
in this case.
It'd be nice to at least get a warning in
poetry lock
orpoetry check
when an extra item doesn't match a dependency. These types of errors can be hard to spot and can take a while to figure out.The text was updated successfully, but these errors were encountered: