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

Avoiding custom repos when possible for significant faster locking #4587

Closed
2 tasks done
omerfeinberg opened this issue Oct 4, 2021 · 4 comments
Closed
2 tasks done
Labels
status/duplicate Duplicate issues

Comments

@omerfeinberg
Copy link

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

The purpose of this suggestion is to significantly enhance performance for users who use both pypi and one or more custom repo for package discovery. 4X faster locks in my experience.

When poetry initializes a lock process it builds a pool of repos to query. it has two types of repositories: PypiRepository in case no other repo was set as default, and LegacyRepository for any user-defined repo.
During the dependency discovery process, poetry goes through the dependency tree, and for every dependency queries all repos for sub dependencies. as a result, if I set a custom repo from which I want to fetch a couple of specific packages, I will actually query it for available versions of every used package, resulting in hundreds of unnecessary calls.

My suggestion is to create a new property for repo called "Avoidable" (If anyone has a better naming suggestion I will appreciate it). When going over all available repos, every avoidable repo will be skipped in case a previous repo already returned an answer for the current package. It will be marked as false on default for backward compatibility purposes, although I believe in the future it should be true :)

Testing this approach in my day-job project (default pypi, custom gemfury, ±8 packages need the custom repo) gave incredible results. In version 1.18 adding this twick poetry's source code reduced locking time from 200-250 secs to 50-60. I've also tried applying in on current master (1.2.0a2), reducing times from 60 secs (which is already awesome btw. Great job whoever did this) to 15-18 secs.

The main drawback of this approach is when a custom repo contains custom versions of packages also available in pypi. in this case, the user can either specify from which repo this package suppose to come (This feature exists, right?) or just not use the avoidable flag.

I already have a working prototype of this which needs a bit of a cleanup, requiring PRs for both poetry and poetry-core. any opinions/suggestions before I go though with this?

@omerfeinberg omerfeinberg added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Oct 4, 2021
@omerfeinberg
Copy link
Author

A different approach would be a global configuration value which states whether the version solver should continue querying repos after the first valid response. defining only certain repos as "avoidable" may be over complicating things

@ofercaspi
Copy link

That sounds great, I'd love to have a feature of that sort, I've spent so much time waiting for locking :( . I would suggest the name "fallback" (instead of "avoidable"), and consider having it as an install/update flag too, and not only as a definition attached to the repo itself.

@neersighted neersighted added status/duplicate Duplicate issues and removed kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Oct 10, 2022
@neersighted
Copy link
Member

A mergable redesign of sources is tracked in #6713. It covers this ask in a more robust/better designed way, more or less.

@neersighted neersighted closed this as not planned Won't fix, can't repro, duplicate, stale Oct 10, 2022
Copy link

github-actions bot commented Mar 1, 2024

This issue 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 Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/duplicate Duplicate issues
Projects
None yet
Development

No branches or pull requests

3 participants