@@ -33,15 +33,23 @@ deemed a source tree.
33
33
Source distribution file name
34
34
=============================
35
35
36
- The file name of a sdist is not currently standardised, although the * de facto *
37
- form is ``{name}-{version}.tar.gz ``, where ``{name} `` is the canonicalized form
38
- of the project name (see :pep: ` 503 ` for the canonicalization rules) with `` - ``
39
- characters replaced with `` _ ``, and ``{version} `` is the canonicalized form of
40
- the project version (see :ref: `version-specifiers `).
36
+ The file name of a sdist was standardised in :pep: ` 625 `. The file name must be in
37
+ the form ``{name}-{version}.tar.gz ``, where ``{name} `` is normalised according to
38
+ the same rules as for binary distributions (see :ref: ` binary-distribution-format `),
39
+ and ``{version} `` is the canonicalized form of the project version (see
40
+ :ref: `version-specifiers `).
41
41
42
42
The name and version components of the filename MUST match the values stored
43
43
in the metadata contained in the file.
44
44
45
+ Code that produces a source distribution file MUST give the file a name that matches
46
+ this specification. This includes the ``build_sdist `` hook of a build backend.
47
+
48
+ Code that processes source distribution files MAY recognise source distribution files
49
+ by the ``.tar.gz `` suffix and the presence of precisely *one * hyphen in the filename.
50
+ Code that does this may then use the distribution name and version from the filename
51
+ without further verification.
52
+
45
53
Source distribution file format
46
54
===============================
47
55
@@ -57,4 +65,5 @@ No other content of a sdist is required or defined. Build systems can store
57
65
whatever information they need in the sdist to build the project.
58
66
59
67
The tarball should use the modern POSIX.1-2001 pax tar format, which specifies
60
- UTF-8 based file names.
68
+ UTF-8 based file names. In particular, source distribution files must be readable
69
+ using the standard library tarfile module with the open flag 'r:gz'.
0 commit comments