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

Poetry repeatedly re-queries PyPI for non-PyPI dependencies when resolving #5864

Closed
2 tasks done
DFEvans opened this issue Jun 17, 2022 · 3 comments
Closed
2 tasks done
Labels
kind/question User questions (candidates for conversion to discussion)

Comments

@DFEvans
Copy link

DFEvans commented Jun 17, 2022

  • I am on the latest Poetry version.

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

  • OS version and name: Windows 10 (in WSL2 Ubuntu)

  • Poetry version: 1.1.13

Issue

When resolving dependencies (e.g. during a poetry add), Poetry will query PyPI for some package information, and cache the result, preventing future queries.

However, if a package is available via an alternative source defined in the pyproject.toml, Poetry will query PyPI for every iteration of the resolving algorithm, receiving a 404 each time. With enough non-PyPI dependencies, and enough iterations of the resolver, PyPI will eventually return an error stating that the caller needs to back off (having hit their endpoints with hundreds of failing queries).

At one level, this is because Poetry does not cache failed responses - if PyPiRepository._get_release_info fails, a PackageNotFound exception is raised which bubbles up beyond the caching layer.

It is still surprising that Poetry is querying PyPI at all, though, given that my dependencies have source = xxx defined. It looks like Poetry should be querying only the specified source repository for packages with this specified, but repository is coming through as None here, and it's falling back on enumerating all repositories in priority order in the else block. The trail gets quite confusing to follow from here on, but it appears that the various source_... attributes on the dependency object are not being propagated from the pyproject.toml / poetry.lock.

@DFEvans DFEvans added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jun 17, 2022
@lalmei
Copy link
Contributor

lalmei commented Jun 21, 2022

Yeah saw similar behavior with default=true for a private repository.

@neersighted neersighted added kind/question User questions (candidates for conversion to discussion) and removed kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 5, 2022
@neersighted
Copy link
Member

This is currently as designed -- see #6713 for a proposal to introduce the behavior you desire/expect.

@neersighted neersighted closed this as not planned Won't fix, can't repro, duplicate, stale Oct 5, 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
kind/question User questions (candidates for conversion to discussion)
Projects
None yet
Development

No branches or pull requests

3 participants