Skip to content

refactor the search for direct-origin dependencies#5904

Merged
radoering merged 3 commits intopython-poetry:masterfrom
dimbleby:refactor-search-for-dependency
Jun 26, 2022
Merged

refactor the search for direct-origin dependencies#5904
radoering merged 3 commits intopython-poetry:masterfrom
dimbleby:refactor-search-for-dependency

Conversation

@dimbleby
Copy link
Copy Markdown
Contributor

refactoring suggested by #5903.

  • all the search_for_xxx() methods returned a list of length one, which is a bit weird
  • the whole pattern is repeated three times, let's just do it once.

IMO it's kinda ugly that search_for_xxx(dependency) makes updates to dependency, that doesn't match my intuition for what such a method ought to do. But trying to refactor that broke more tests than I care to investigate.

In particular this rearrangement ensures that the updates that we make to the input dependency are the same regardless of whether we got there via the _deferred_cache or not.

@dimbleby dimbleby force-pushed the refactor-search-for-dependency branch from 415a9d3 to 3263f33 Compare June 23, 2022 20:38
Comment thread src/poetry/puzzle/provider.py Outdated
@dimbleby dimbleby force-pushed the refactor-search-for-dependency branch from 75c2ecb to 25e0ac6 Compare June 25, 2022 17:41
Copy link
Copy Markdown
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.

Have you thought about the following changes in behavior? (Not sure about the consequences or if it's relevant at all.)

package is not cloned anymore for file and directory dependencies. Thus, package.root_dir, package.files, package.develop are set according to the first dependency.

It seems like VCS dependencies were only put into the cache but never taken from it. Seems like a bug, but had the same effect as cloning. Now, package.develop is set according to the first dependency.

@dimbleby
Copy link
Copy Markdown
Contributor Author

@radoering yes I noticed those things, but couldn't think of a reason that they should matter - so chose to trust the test suite when it said that it saw no problem.

@radoering
Copy link
Copy Markdown
Member

Me neither. Should be fine.

@radoering radoering merged commit 63c86bf into python-poetry:master Jun 26, 2022
@dimbleby dimbleby deleted the refactor-search-for-dependency branch June 26, 2022 18:18
@github-actions
Copy link
Copy Markdown

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.

3 participants