Skip to content

[1.2] Avoid the deprecated JSON API#6549

Merged
neersighted merged 1 commit into
1.2from
backport-6081-to-1.2
Sep 17, 2022
Merged

[1.2] Avoid the deprecated JSON API#6549
neersighted merged 1 commit into
1.2from
backport-6081-to-1.2

Conversation

@poetry-bot

@poetry-bot poetry-bot Bot commented Sep 17, 2022

Copy link
Copy Markdown

Backport b61a4dd from #6081.

Resolves #6076

I've taken the JSON version of the simple API and converted it into a
`LinkSource` so that the package-finding logic in the `PyPiRepository`
is very similar to - but annoyingly not quite the same as! - the
`LegacyRepository`.

I've also taken the opportunity to refactor the `LegacyRepository` ever
so slightly to emphasise that similarity. I think I've probably fixed a
small bug re caching and pre-releases: previously the processing for
ignored pre-releases was skipped when reading from the cache.

I believe this change will tend to be a modest performance hit. Eg
consider a package like `cryptography`, for which there are maybe a
couple of dozen downloads available at each release: to get the
available versions we now have to iterate over each of those files and
parse their names, rather than simply reading the answer.

However if the API that poetry currently uses is truly deprecated I see
little choice but to suck that up - or risk being in an awkward spot
when it is turned off. cf #5970, but worse.

Most of the changes are in the test fixtures:
- unversioned fixtures were generated from the existing fixtures: I
didn't want to download fresh data and start getting different answers
than the tests were expecting
- new versioned fixtures were downloaded fresh

(cherry picked from commit b61a4dd)
@neersighted neersighted enabled auto-merge (rebase) September 17, 2022 17:32
@neersighted neersighted merged commit fa20185 into 1.2 Sep 17, 2022
@neersighted neersighted deleted the backport-6081-to-1.2 branch September 17, 2022 17:41
@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.

2 participants