Skip to content

Commit cfdf937

Browse files
committed
Define index-specific-metadata
1 parent 98d5e07 commit cfdf937

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

peps/pep-0694.rst

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,8 @@ The request includes the following top-level keys:
334334

335335
``meta`` (**required**)
336336
Describes information about the payload itself. Currently, the only defined sub-key is
337-
``api-version`` the value of which must be the string ``"2.0"``.
337+
``api-version`` the value of which must be the string ``"2.0"``. Optional sub-keys can define
338+
:ref:`index-specific behavior <index-specific-metadata>`.
338339

339340
``name`` (**required**)
340341
The name of the project that this session is attempting to release a new version of. The name
@@ -363,6 +364,34 @@ The session is owned by the user that created it,
363364
and all subsequent requests **MUST** be performed with the same credentials,
364365
otherwise a ``403 Forbidden`` will be returned on those subsequent requests.
365366

367+
.. _index-specific-metadata:
368+
369+
Optional Index-specific Metadata
370+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
371+
372+
Index can optionally define their own metadata for index-specific behavior. The metadata key
373+
**MUST** begin with an underscore, with the following value easily and uniquely identifying the
374+
index. For example, PyPI could allow for projects to be created in an `organization account
375+
<https://docs.pypi.org/organization-accounts/>`__ of which the publisher is a member by using the
376+
following index-specific metadata section:
377+
378+
.. code-block:: json
379+
380+
{
381+
"meta": {
382+
"api-version": "2.0",
383+
"_pypi.org": {
384+
"organization": "my-main-org"
385+
}
386+
},
387+
"name": "foo",
388+
"version": "1.0",
389+
}
390+
391+
This is only an example. This PEP does not define or reserve any index-specific keys or metadata;
392+
that is left up to the index to specify and document. The semantics (e.g. whether bogus keys or
393+
values result in an error or are ignored) of the index-specific metadata is also undefined here.
394+
366395
.. _publishing-session-response:
367396

368397
Response Body
@@ -1018,9 +1047,9 @@ To do this, :ref:`create a new publishing session <publishing-session-create>`,
10181047
JSON body of the create session request, you can simply use a placeholder version number such as
10191048
``"0.0.0a0"``. The version is ignored if no artifacts are uploaded.
10201049

1021-
TBD: org is ignored if it's not a new project registration.
1022-
1023-
The user that created the session will become the owner of the new project.
1050+
Generally the user that created the session will become the owner of the new project, however the
1051+
index could define :ref:`index-specific metadata <index-specific-metadata>` to, for example, allow
1052+
an organization of which the publisher is a member, to own the new project.
10241053

10251054

10261055
Open Questions

0 commit comments

Comments
 (0)