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

Fix dropped markers in dependency walk #4686

Merged
merged 1 commit into from
Nov 14, 2021
Merged

Fix dropped markers in dependency walk #4686

merged 1 commit into from
Nov 14, 2021

Conversation

dimbleby
Copy link
Contributor

Pull Request Check List

Resolves: #3511

  • Added tests for changed code.
  • Updated documentation for changed code.

I would very much like a fix for #3511, and tonight for the first time I tried to understand the proposed fix at #3512. I must admit I found it all a bit confusing! Here is a version that makes a much more localised change - my hope is that this is more palatable for merging.

Again the aim is to make sure that when we encounter an already-encountered dependency, we do not drop the associated markers. But I've done this just by moving where we make the if key not in nested_dependencies check.

It's definitely possible that I've missed some good reason why #3512 is more complicated than this; but I have borrowed the unit test case added at #3512 and that still passes (and fails without the fix). And I've also tested the fix in a couple of real life projects where I have run into this bug, and it does the job for those too.

@johnmacnamararseg @abn

@dimbleby
Copy link
Contributor Author

While I'm here: among the code that I was confused by in this method was

if requirement.name in project_level_dependencies and level == 0:
# project level dependencies take precedence
continue

  • why wouldn't we want to pay attention to lower-level constraints for project-level dependencies?
  • if this code is right, why is it only right at level 0?

I tried removing this block altogether and no tests failed, I suspect that it may not be wanted.

Copy link
Member

@neersighted neersighted left a comment

Choose a reason for hiding this comment

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

Thanks for the excellent work here -- this is a very minimal and easy to understand changeset. Thanks @johnmacnamararseg for the excellent test case as well.

@neersighted neersighted merged commit b6e2440 into python-poetry:master Nov 14, 2021
@neersighted
Copy link
Member

Shoot, I forgot to add a Co-authored-by line to that commit, as the test was from #3512. Sorry @johnmacnamararseg.

neersighted added a commit that referenced this pull request Nov 14, 2021
A lack of a rebase before merge kept this intersection of changes from
being properly tested.
finswimmer pushed a commit that referenced this pull request Nov 14, 2021
A lack of a rebase before merge kept this intersection of changes from
being properly tested.
@dimbleby dimbleby deleted the export-fix branch November 14, 2021 10:38
1nF0rmed pushed a commit to 1nF0rmed/poetry that referenced this pull request Nov 15, 2021
…ry#4753)

A lack of a rebase before merge kept this intersection of changes from
being properly tested.
@polys
Copy link

polys commented Nov 24, 2021

Any updates on a release that will include this fix?

edvardm pushed a commit to edvardm/poetry that referenced this pull request Nov 24, 2021
…ry#4753)

A lack of a rebase before merge kept this intersection of changes from
being properly tested.
@dimbleby dimbleby mentioned this pull request Nov 27, 2021
neersighted added a commit to finswimmer/poetry that referenced this pull request Nov 28, 2021
This is a backport of python-poetry#4686. Note that the test is changed due to a
regression in `master` -- somewhere, the ability to drop two markers
that negate each other was lost.

Co-authored-by: Bjorn Neergaard <[email protected]>
neersighted added a commit that referenced this pull request Nov 28, 2021
This is a backport of #4686. Note that the test is changed due to a
regression in `master` -- somewhere, the ability to drop two markers
that negate each other was lost.

Co-authored-by: Bjorn Neergaard <[email protected]>
@johnmacnamararseg
Copy link

@dimbleby thanks for the improvement and helping get this across the finish line. much easier to follow than what I originally had. very happy to see this merged in!

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.

Markers not correctly assigned to nested dependencies
4 participants