-
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
Improve handling of extras #6130
Improve handling of extras #6130
Conversation
643903a
to
c049cb9
Compare
c049cb9
to
627d8a3
Compare
972789d
to
0e038f4
Compare
@radoering hi! I've also updated this one, now tests pass. |
0e038f4
to
bdc3f90
Compare
I will add a test for first change — check that poetry does not try to query PyPI for locked package with extras and secondary source. However I'm a bit at lost about the second one. What is the cleanest way to test that change? |
Does this PR resolve the following issue? |
@LarsDu do you have reproduction steps for that issue? I can check if my branch fixes it. |
Maybe, we can split this in two PRs? The first change seems quite clear and low risk (and easier to test). The second one has more potential for negative side effects. We should be able to proceed quite fast with the first one but I probably need some time to think about the second one. |
@radoering no problem, I'll split |
I have not yet an idea for the second one. For the first one something like this might be sufficient (
|
@radoering I've split the first change into #6472, along with your test. |
This PR splits out simple part of #6130. Once this merged I'll update that PR to contain only second (more controversial) fix.
@maksbotan I'll look into seeing if this branch resolves the issue sometime this week. We are primarily concerned with case 2: When we have multiple teams working out of the same repo with different extra dependencies, we want to avoid having the solver run across all extras as dependency conflicts can become extremely problematic. Having different groups of extras will necessitate making unit tests aware of dependencies, but that is a reasonable tradeoff. @radoering I believe this may cause side-effects as virtually all groups are currently having |
This PR solves a different issue from what you are interested in @LarsDu -- the idea here is to not solve for extras that are not defined on a dependency of your project. If your project (the 'root package') defines multiple extras, they must not conflict and the solver will ensure that all extras are installable at the same time. This is currently how Poetry's solver works and you are expressing a feature request found at #6419. A change to this behavior would be a large-scale, invasive refactor, and so far there have been no proposals on how to do so in a backwards-compatible and flexible manner. |
bdc3f90
to
413ef97
Compare
@radoering I've updated this PR to include only the second one of my changes. However, my initial pain point is solved by my other PR — the one for reusing locked git repo dependency. Previously poetry used to refetch git repo that is a transitive dependency under extra I don't actually depend on. Now that refetching is gone, this one is not so important for me. What do you think about the change in general? |
@maksbotan Finally, I had the time to take a closer look. I think I found a simpler solution to solve this issue. See #6615. |
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
This changeset improves caching of dependencies with extras in two ways:
foo[extra]
->foo
dependency preserves information aboutfoo
's source. If it comes from secondary repo, poetry will not look for it on PyPIfoo[extra1]
, do not look into dependencies offoo[extra2]
. This will save time whenextra2
contains some heavy-to-resolve dependencies like VCS ones.I'm all in for adding tests, but I'd need guidance how to proceed.
When this PR is merged, I'll backport it to 1.1 branch as well.