-
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
fix #8614 source constriants failed with extras #8802
fix #8614 source constriants failed with extras #8802
Conversation
e374137
to
2c8864d
Compare
2c8864d
to
ebf8852
Compare
Thank you so much for trying to fix this! It seems that this proposed code is evaluated quite early in the Poetry lifecycle, so that you're working with the raw TOML structure: for group in [*local_config.get("group", {}).values(), local_config]:
for name, dependency in group.get("dependencies", {}).items():
if isinstance(dependency, dict) and "source" in dependency:
dependency_source_cache[name] = dependency["source"] This is good, because it runs before packages can be looked up. But I'm not sure whether it supports all documented dependency specification forms, in particular multiple constraint dependencies where the entry might be a list, not a dict. The docs give this example: [tool.poetry.dependencies]
foo = [
{version = "<=1.9", python = ">=3.6,<3.8"},
{version = "^2.0", python = ">=3.8"}
] In #8614, I noted that each candidate's source might differ. For example: some-dep = [
{ ..., source = "repo-a", python = ">=3.6,<3.8" },
{ ..., source = "repo-b", python = ">=3.8" },
] I'm not sure whether Poetry actually supports this.
|
Thank you for your feedback. Yes, I did forget about handling multiple constraint dependencies, I will add support for them. As you pointed out, the current pull request doesn't completely resolve the issue if we don't ensure the consistency of source information. I'm also addressing the related problem of "Package's source inconsistency" described in #8704. However, I still don't have a clear idea of how to develop it correctly. Did poetry already handle this issue somewhere? I don't have an idea yet. The primary goal of the pull request is to provide a partial solution that is at least on par with the current situation. This is because the mapping comes into play only when the repository_name is not provided. |
I'm not sure if this is the right path, but since I have no other solution in mind, I'll give some feedback:
It does.
It's probably better to use the parsed dependencies in |
After thinking about it again, I believe that this issue should be addressed in the solver instead of the repository pool. The repository pool is not aware of markers (and probably should not be) so that it is not possible to handle multiple constraints with different sources. I gave it a try in #8835 and I am not aware of any drawbacks yet. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Pull Request Check List
Resolves: #8614
dependency_source_mapping
parameter for theRepositoryPool
class, which is derived directly from thepyproject.toml
file.