warehouse
warehouse copied to clipboard
Implement Alternate Repository Location for PEP 708
Adds per-project Alternate Repository Location as per PEP 708.
- Implements the UI and database changes.
- Includes changes to the html and json APIs.
- Includes tests.
- The alternate repository location information is on the project settings page.
- There is a form to add, and a list to show and delete existing entries.
Notes:
- The 'tracks' metadata does not make sense for PyPI, as PyPI does not extend other repositories.
Relates to #15431
Previews:
HTML: curl http://localhost/simple/[project_name]/
<!DOCTYPE html>
<html>
<head>
<meta name="pypi:repository-version" content="1.1">
<meta name="pypi:alternate-locations" content="https://example.org">
<title>Links for [project_name]</title>
</head>
...
JSON: curl -H "Accept: application/vnd.pypi.simple.v1+json" http://localhost/simple/[project_name]/
{"alternate-locations":["https://example.org"], ... }
Hi @cofiem and thank you for your contribution! I'm going to ask @dstufft to take a look as PEP author.
Thanks very much for the initial review, @ewdurbin! I'll have a look at the cache keys for the model.
Thanks for picking this up by the way! Really jazzed to see it getting worked on.
Thanks for reviewing @dstufft! @cofiem, I believe the comments from Donald should address the outstanding open questions.
Once this is updated I think it is ready for final review and merge!
@cofiem thank you! I pushed a commit to fix tests and include the self-reference in JSON API as well.
@dstufft I think this is ready to go, but I am curious if we should always send the self-reference in alternate-repositories value... or only when an alternate has been specified.
@ewdurbin That commit to fix tests and make the JSON & HTML apis match makes sense!
I'm going to hold off for a couple days, but if I don't hear from @dstufft on the two remaining open questions, I will remove the self-reference in alternate-repositories values and merge. The PEP reads as though they can be implied "When using alternate locations, clients MUST implicitly assume that the url the response was fetched from was included in the list."
Added a small callout block that we should remove when PEP 708 provisional acceptance becomes acceptance acceptance.
Excellent, thanks @ewdurbin!