Skip to content
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

revert #5770, provide new fix #6058

Merged
merged 3 commits into from
Jul 31, 2022
Merged

Conversation

dimbleby
Copy link
Contributor

Pull Request Check List

Resolves: #6054

I think that the fix made at #5770 was not good. (I did review it at the time without seeing problems, so no blame!)

As I now understand it, the problem that it was trying to solve was:

  • we register a direct-origin assignment for foo
  • we then register a regular assignment for foo[extras]
  • we'd like for the result to be that all foo-related assignments find the direct-origin package
  • but that's not what happens

#5770 fixed this by finding the foo assignment at the second bullet, and then the intersection of a direct-origin and not-direct-origin term always favours the direct-origin.

I think this is probably unreliable: eg in the first bullet we might have registered a direct-origin assignment for foo[other-extras]. Or bullets 1 and 2 might happen the other way round.

Apart from that, #6054 exposed a problem where we registered regular assignments for foo and foo[extras], but with incompatible version ranges. Before #5770 that was fine and is unwound later in the search, but after #5770 we try to update the foo assignment and go wrong.

This MR undoes the fix of #5770 and tries another. I have arranged that:

  • we always try to resolve direct-origin dependencies first
  • the provider remembers direct-origin dependencies and returns them again if asked for the same package but with different features

That fixes the original #5311 because now the direct-origin version of the foo package is the only one that we ever see; and, per the new testcase, unbreaks #6054

Copy link
Member

@radoering radoering left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that resolving direct origin dependencies first seems to be sensible. I just noticed a minor inconsistency (see comment below).

src/poetry/puzzle/provider.py Outdated Show resolved Hide resolved
dimbleby and others added 2 commits July 31, 2022 14:54
@radoering
Copy link
Member

I just added some dedicated tests for search_for (some general tests and some related to this change).

@radoering radoering merged commit fd4af82 into python-poetry:master Jul 31, 2022
@dimbleby dimbleby deleted the refix-5311 branch July 31, 2022 15:49
efugier pushed a commit to efugier/poetry that referenced this pull request Aug 4, 2022
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

poetry 1.2.0b3 lock fails with no output
2 participants