-
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
Refactor repositories pool #6669
Refactor repositories pool #6669
Conversation
I also removed the inheritance from |
I expect that the order of primary sources in |
Hi @radoering, thank you for your swift consideration.
That is very reasonable. I've clarified the resolution order in the docs. Please have a look at the proposed change. I'm also looking forward to your other thoughts on the PR. |
I just ran I still need to take a closer look, but at first glance it looks like a neat simplification. 👍 However, I noticed that without |
We now have 100% test coverage for
I assumed that we wouldn't do this too often, but it was quite easy to make this constant-time lookup (at the slight expense of clarity). |
@b-kamphorst I'm okay with the rename personally -- the plugin is coupled to implementation details and we can work around that with a 3-PR-dance or just some maintainer magic (but we should break the rename out into a separate PR). Regarding |
I'm strongly for breaking all the renaming out in a separate PR with renaming only and no other changes.
Sounds great. 🎉
The only way to be sure is doing some measurements. (On the one hand I don't assume it is called too often or has a significant influence, but on the other hand I can imagine that some of the methods are called for each package lookup.) If others don't mind we can also take the risk. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking a lot more promising overall -- I haven't had time to look at everything exhaustively, but I left some feedback.
On the rename, I suggest we either to that in a separate PR, or you raise some DeprecationWarnings when the old names are imported.
I'd also like to see the kwargs change -- @dimbleby described it accurately, and it would remove the need for type: ignore[override]
while better encapsulating how these classes are used.
When renaming you have to cut the commits carefully in order to avoid "breaking" git history. We shouldn't just squash the commits. See python-poetry/poetry-core#482 for example. That's why I suggest doing it in a separate PR. |
It appears that master (44a89cb) breaks all tests? |
You've got a typing issue. |
Fixed that. Locally the tests also failed in some places but apparently that is resolved :-) I prepared another PR with the name changes. I'll present it when this PR is closed. Thanks for your time, I enjoy the collaboration! |
Hi @radoering, @neersighted, are there any other changes that need to be processed here (at some point @neersighted mentioned that the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks very promising. I have some concerns about the specific implementation, but otherwise the new tests look good and the architecture seems sound. Good work cleaning this up!
Once review is addressed, I'd like to see cleaner history -- it would be nice to introduce the new tests and then the refactor (assuming the tests pass without the refactor -- I didn't look closely to see if they would run against the old implementation).
This took me a lot of time, but at least I learned a bit more about git (plenty to learn left). The added tests are now in the first commit (not 100% at that commit just yet). |
I personally would drop the |
@b-kamphorst I've pushed up a rebase of your branch that squashes the changes down into mergable commits -- I think this is good to go once we address the final review comments, as long as we keep the history clean. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final batch of requested changes -- should be good to go after we discuss/address these.
I have processed the suggested changes (in a separate commit for your convenience). If they are in line with your expectations, feel free to squash the final commit into another commit and make this fly :) |
Introduces Priority enum to help in bookkeeping of repository types. Additionally specifies parameter 'repository' to 'repository_name' where relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. FWIW, I would suggest getting familiar with interactive rebases and how to leverage the edit
rebase command (as well as the git reset
CLI command) to manipulate the history of branches. When you're doing larger, more ambitious PRs like this, you generally want to take the approach you took and make the history as atomic/easy to follow for reviewers as possible.
Then, when it's time for merge, you'll want to squash your commits down. In the simple/smaller PR case a squash of everything is just fine. But in a larger PR like this it's helpful to capture some of the evolutionary steps as commits in history -- which is when you want to master that process of munging history during an interactive rebase.
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
Relates-to: #3155
I refactored
Pool
in preparation of tackling #6713. Most notably, this PR uses an enum to significantly reduce the bookkeeping effort for the various types of repositories (primary / default / secondary).Two considerations:
RepositoryPriority
(name open for suggestions) should be an attribute of aRepository
instead. I'm willing to have a look at that, but as that change will scatter all over the (test) code I decided to present this suggestion first.OrderedDict
is used just to satisfy the testtest_repository_ordering
intests/repositories/test_pool.py
. Although I appreciate the deterministic approach, I would like to verify whether this ordering is actually relevant. In particular, was the order only verified to ensure proper ordering + clustering between default/primary/secondary, or also proper ordering within each cluster? Phrased differently, does the user expect that the order in which primary sources A and B are added through the CLI affects the resolution order? They might and I'm happy to leave it as is, but otherwise we can use normal dicts.