Skip to content

Commit 297d78f

Browse files
committed
Reference the existing sdist format from the build interface
Replace duplicate PEP 517 archive descriptions with links to the current source distribution specification, which already incorporates later metadata and archive requirements. Retain the hook's requirement to include pyproject.toml from the build directory and the requirement that sdists produce wheels with the corresponding name and version. Point the sdist source-tree definition at the local configuration and interface specifications instead of sending readers to PEPs 517 and 518. Preserve all UnsupportedOperation and intermediate-sdist fallback text. Closes #388; addresses part of #955 and #1093.
1 parent 259d25a commit 297d78f

2 files changed

Lines changed: 6 additions & 35 deletions

File tree

‎source/specifications/build-system-interface.rst‎

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,8 @@ Must build a .tar.gz source distribution and place it in the specified
149149
``sdist_directory``. It must return the basename (not the full path) of the
150150
``.tar.gz`` file it creates, as a unicode string.
151151

152-
A .tar.gz source distribution (sdist) contains a single top-level directory called
153-
``{name}-{version}`` (e.g. ``foo-1.0``), containing the source files of the
154-
package. This directory must also contain the
155-
``pyproject.toml`` from the build directory, and a PKG-INFO file containing
156-
metadata in the format described in
157-
:pep:`345`. Although historically
158-
zip files have also been used as sdists, this hook should produce a gzipped
159-
tarball. This is already the more common format for sdists, and having a
160-
consistent format makes for simpler tooling.
161-
162-
The generated tarball should use the modern POSIX.1-2001 pax tar format, which
163-
specifies UTF-8 based file names. This is not yet the default for the tarfile
164-
module shipped with Python 3.6, so backends using the tarfile module need to
165-
explicitly pass ``format=tarfile.PAX_FORMAT``.
152+
The source distribution must conform to :ref:`source-distribution-format`
153+
and contain the ``pyproject.toml`` from the build directory.
166154

167155
Some backends may have extra requirements for creating sdists, such as version
168156
control tools. However, some frontends may prefer to make intermediate sdists
@@ -433,29 +421,12 @@ hood and apply duct tape when necessary.
433421
Source distributions
434422
====================
435423

436-
We continue with the legacy sdist format, adding some new restrictions.
437-
This format is mostly
438-
undefined, but basically comes down to: a file named
439-
``{NAME}-{VERSION}.{EXT}``, which unpacks into a buildable source tree
440-
called ``{NAME}-{VERSION}/``. Traditionally these have always
441-
contained ``setup.py``\-style source trees; we now allow them to also
442-
contain ``pyproject.toml``\-style source trees.
424+
The :ref:`source-distribution-format` specification defines the archive format.
443425

444426
Integration frontends require that an sdist named
445427
``{NAME}-{VERSION}.{EXT}`` will generate a wheel named
446428
``{NAME}-{VERSION}-{COMPAT-INFO}.whl``.
447429

448-
The new restrictions for sdists built by :pep:`517` backends are:
449-
450-
- They will be gzipped tar archives, with the ``.tar.gz`` extension. Zip
451-
archives, or other compression formats for tarballs, are not allowed at
452-
present.
453-
- Tar archives must be created in the modern POSIX.1-2001 pax tar format, which
454-
uses UTF-8 for file names.
455-
- The source tree contained in an sdist is expected to include the
456-
``pyproject.toml`` file.
457-
458-
459430
History
460431
========
461432

‎source/specifications/source-distribution-format.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ Source trees
2828
A *source tree* is a collection of files and directories -- like a version
2929
control system checkout -- which contains a :file:`pyproject.toml` file that
3030
can be used to build a source distribution from the contained files and
31-
directories. :pep:`517` and :pep:`518` specify what is required to meet the
32-
definition of what :file:`pyproject.toml` must contain for something to be
33-
deemed a source tree.
31+
directories. The :ref:`[build-system] table <pyproject-build-system-table>`
32+
specifies the build system configuration, and :ref:`build-system-interface`
33+
defines how tools use it to build source distributions and wheels.
3434

3535
.. _source-distribution-format-sdist:
3636

0 commit comments

Comments
 (0)