Skip to content

Commit 3cb0ad0

Browse files
woodruffwdi
andauthored
docs/api: clean up Upload API docs slightly (#17514)
* docs/api: clean up Upload API docs slightly Signed-off-by: William Woodruff <[email protected]> * fixup pluralization docs Signed-off-by: William Woodruff <[email protected]> --------- Signed-off-by: William Woodruff <[email protected]> Co-authored-by: Dustin Ingram <[email protected]>
1 parent 93ee7f1 commit 3cb0ad0

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

docs/user/api/upload.md

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,42 @@ POST request with the following fields:
2727
- `:action` set to `file_upload`
2828
- `protocol_version` set to `1`
2929
- `content` with the file to be uploaded and the proper filename
30-
(i.e. `my_foo_bar-4.2-cp36-cp36m-manylinux1_x86_64.whl`)
30+
(e.g. `my_foo_bar-4.2-cp36-cp36m-manylinux1_x86_64.whl`)
3131
- One of the following hash digests:
3232
- `md5_digest` set to the md5 hash of the uploaded file in urlsafe base64
33-
with no padding
33+
with no padding
3434
- `sha256_digest` set to the SHA2-256 hash in hexadecimal
3535
- `blake2_256_digest` set to the Blake2b 256-bit hash in hexadecimal
36-
- `filetype` set to the type of the artifact, i.e. `bdist_wheel`
37-
or `sdist`
38-
- When used with `bdist_wheel` for `filetype`, `pyversion` must be set to
39-
a specific release, i.e. `cp36`, when used with `sdist` it must be set to
40-
`source`
41-
- `metadata_version`, `name` and `version` set according to the
36+
- `filetype` must be set to the type of the artifact: `bdist_wheel` or `sdist`.
37+
- `pyversion` must be set to a [Python tag] for `bdist_wheel` uploads,
38+
or `source` for `sdist` uploads.
39+
- `metadata_version`, `name` and `version` must be set according to the
4240
[Core metadata specifications]
4341
- `attestations` can be set to a JSON array of [attestation objects].
4442
PyPI will reject the upload if it can't verify each of the
4543
supplied attestations.
46-
- You can set any other field from the [Core metadata specifications]
47-
All fields need to be renamed to lowercase and hyphens need to replaced
48-
by underscores. So instead of "`Description-Content-Type`" the field must be
49-
named "`description_content_type`". Note that adding a field
50-
"`Description-Content-Type`" will not raise an error but will be silently
51-
ignored.
44+
- You can set any other field from the [Core metadata specifications].
45+
46+
All fields need to be renamed to lowercase and hyphens need to replaced
47+
by underscores. Additionally, multiple-use fields (like `Classifier`)
48+
are pluralized (e.g. `classifiers`) with some limited exceptions
49+
noted below:
50+
51+
| Metadata field | Form field |
52+
|----------------|------------|
53+
| `Platform` | `platform` (**not** `platforms`) |
54+
| `Supported-Platform` | `supported_platform` (**not** `supported_platforms`) |
55+
| `License-File` | `license_file` (**not** `license_files`) |
56+
57+
58+
!!! warning
59+
60+
The transformation above *must* be performed.
61+
Sending a form field like `Description-Content-Type` will not raise an
62+
error but will be **silently ignored**.
5263

5364
[attestation objects]: ./integrity.md#concepts
5465

5566
[Core metadata specifications]: https://packaging.python.org/specifications/core-metadata
67+
68+
[Python tag]: https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/#python-tag

0 commit comments

Comments
 (0)