-
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
Allow opting out the pypi JSON API #7582
Comments
did you try this? what happened? regardless of the API that it queries, poetry assumes that all distributions of a package have the same metadata: so merely "not querying the JSON API" will make no difference to that. You didn't say what problem you're trying to solve that has sent you down this path; possibly if you said something about that then more useful advice could be offered. |
Hi @dimbleby , thanks for the response. I did try this and it actually seems to work! However, I don't have full observability on whether the JSON API is totally avoided or not. I will try some network profiling [[tool.poetry.source]]
default = true
name = "pypi-simple"
url = "https://pypi.org/simple"
Could you elaborate on that? What I was assuming is that Poetry will correctly fetch the dependencies of packages published on a Simple API repository. Say the repository contains
It's not a specific problem, merely making sure that the right dependencies are selected for a given package. The JSON API doesn't seem to offer such functionality because of the "common" |
If not using another API, poetry will download some arbitrary distribution of the package whose metadata it needs. That might be the windows distribution or the linux one; or a py38 distribution or a py310 distribution, or whatever. Then it will read the metadata from that distribution and assume that it is the same for all distributions of that version of the package. (This is analogous to reading the same data from the JSON API, which is populated by whichever distribution happens to be uploaded first) You cannot solve the problem that you are trying to solve by avoiding the JSON API. On the other hand since you don't have an actual problem that you are trying to solve, that doesn't seem so important. |
We may be at cross-purposes: this is simply not true The JSON API offers per-version information, which poetry uses. So perhaps you're happy all along. What it does not offer is per-distribution information, which can in principle vary. But it nearly always doesn't. |
That makes total sense, and I'm not here to question this :) I'm only interested about different dependencies for different versions of the same package, not different distributions.
Ok, maybe I completely missed it and if you're right (I'm sure you are!) then we can consider this issue solved. Could you just point me to that out of curiosity? If I run this
Then I only see a single
I'm considering moving from a private repository that mirrors pypi to calling pypi directly. Since the behaviour is different (as the private repository does not offer the JSON API), I just want to verify that dependency resolution will keep being correct. I didn't get into an issue yet, but I wanted to investigate :) |
|
Oooo then consider myself fully satisfied. The possibility of specifying the version in the JSON API completely slipped off me. Thanks for the quick reply! |
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. |
Probably the opposite request of #5337 😄
I searched the Poetry CHANGELOG and, although I read some mentions about PyPI deprecated JSON APIs, I believe Poetry is still using the JSON API when targeting the public pypi repository. If that's not the case, then we can risolve the issue immediately.
As the PyPI JSON API is inherently bugged to due dependencies being specified at the package level rather than at the specific version level, I'd like to have a way to completely opt out of that feature and consider PyPI as a PEP 503 Simple API repository. Note how in PDM this is even the default behaviour: pdm-project/pdm#112.
I didn't find in the documentation an explicit way to disable this behaviour, although I'd like to ask you if through some hack this is already achievable - like defining a custom repository with
default = true
that points tohttps://pypi.org/simple/
. If there is a solution and is not too hackish (aka we should expect the behaviour to stay consistent across Poetry releases), then I would consider this issue resolved without further changes.Thank you a lot for maintaining Poetry 👏
The text was updated successfully, but these errors were encountered: