Skip to content

Commit 21e5dc1

Browse files
authored
Update sdist spec to reflect PEP 625 (#1141)
1 parent 8327369 commit 21e5dc1

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

source/specifications/source-distribution-format.rst

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,23 @@ deemed a source tree.
3333
Source distribution file name
3434
=============================
3535

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`).
4141

4242
The name and version components of the filename MUST match the values stored
4343
in the metadata contained in the file.
4444

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+
4553
Source distribution file format
4654
===============================
4755

@@ -57,4 +65,5 @@ No other content of a sdist is required or defined. Build systems can store
5765
whatever information they need in the sdist to build the project.
5866

5967
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

Comments
 (0)