Skip to content

Commit 2747eae

Browse files
authored
Merge pull request #1891 from woodruffw-forks/ww/rm-458
simple-repository-api: remove partial TUF section
2 parents c97a3ec + 1b0bd31 commit 2747eae

File tree

1 file changed

+0
-40
lines changed

1 file changed

+0
-40
lines changed

source/specifications/simple-repository-api.rst

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -910,46 +910,6 @@ which version+format a specific repository URL was configured for, and when maki
910910
a request to that server, emit an ``Accept`` header that *only* includes the correct
911911
content type.
912912

913-
914-
TUF Support - PEP 458
915-
---------------------
916-
917-
:pep:`458` requires that all API responses are hashable and that they can be uniquely
918-
identified by a path relative to the repository root. For a Simple API repository, the
919-
target path is the Root of our API (e.g. ``/simple/`` on PyPI). This creates
920-
challenges when accessing the API using a TUF client instead of directly using a
921-
standard HTTP client, as the TUF client cannot handle the fact that a target could
922-
have multiple different representations that all hash differently.
923-
924-
:pep:`458` does not specify what the target path should be for the Simple API, but
925-
TUF requires that the target paths be "file-like", in other words, a path like
926-
``simple/PROJECT/`` is not acceptable, because it technically points to a
927-
directory.
928-
929-
The saving grace is that the target path does not *have* to actually match the URL
930-
being fetched from the Simple API, and it can just be a sigil that the fetching code
931-
knows how to transform into the actual URL that needs to be fetched. This same thing
932-
can hold true for other aspects of the actual HTTP request, such as the ``Accept``
933-
header.
934-
935-
Ultimately figuring out how to map a directory to a filename is out of scope for this
936-
spec (but it would be in scope for :pep:`458`), and this spec defers making a decision
937-
about how exactly to represent this inside of :pep:`458` metadata.
938-
939-
However, it appears that the current WIP branch against pip that attempts to implement
940-
:pep:`458` is using a target path like ``simple/PROJECT/index.html``. This could be
941-
modified to include the API version and serialization format using something like
942-
``simple/PROJECT/vnd.pypi.simple.vN.FORMAT``. So the v1 HTML format would be
943-
``simple/PROJECT/vnd.pypi.simple.v1.html`` and the v1 JSON format would be
944-
``simple/PROJECT/vnd.pypi.simple.v1.json``.
945-
946-
In this case, since ``text/html`` is an alias to ``application/vnd.pypi.simple.v1+html``
947-
when interacting through TUF, it likely will make the most sense to normalize to the
948-
more explicit name.
949-
950-
Likewise the ``latest`` metaversion should not be included in the targets, only
951-
explicitly declared versions should be supported.
952-
953913
Recommendations
954914
---------------
955915

0 commit comments

Comments
 (0)