PEP 621: Try to simplify the motivation section (#1469)

This commit is contained in:
Brett Cannon 2020-06-26 11:12:38 -07:00 committed by GitHub
parent a973470384
commit 1fa2817f5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 30 deletions

View File

@ -20,42 +20,34 @@ Abstract
======== ========
This PEP specifies how to write a project's `core metadata`_ in a This PEP specifies how to write a project's `core metadata`_ in a
``pyproject.toml`` for packaging-related tools to consume. ``pyproject.toml`` file for packaging-related tools to consume.
Motivation Motivation
========== ==========
Up until now, all tools in the Python community had their The key motivators of this PEP are:
own unique way for users to specify the `core metadata`_ for their
project. This is unfortunate as the metadata itself is standardized
at a lower level for when build back-ends record this information in
e.g. a wheel file. It means users must learn a specific way to specify
something for whichever build back-end they choose. Unfortunately a
`survey of tools`_ both in the Python community and outside of it
showed that there was very little in the way of consistent agreement
on how to record project metadata.
This lack of standardization becomes a form of lock-in for build - Encourage users to specify core metadata statically for speed,
back-ends. When migration requires learning a new set of terms and a ease of specifying, and deterministic consuming
way to record metadata, it makes transitioning to another tool - Provide a tool-agnostic way of specifying the metadata for ease of
cumbersome. That leads to less innovation in the packaging ecosystem learning and transitioning between build back-ends
as people are less likely to try out other approaches. - Allow for more code sharing between build back-ends for the
"boring parts" of a project's metadata
A single format makes specifying project metadata easier to learn. As This PEP does **not** attempt to standardize all possible metadata
things currently stand, one must find a tutorial for the appropriate required to build a wheel, only the metadata covered by the
build back-end when it comes to learning how to record metadata. This `core metadata`_ specification which are very common across projects
leads to duplicated effort in teaching and debugging: when trying to and would stand to benefit from being static and consistently
help users, you must find out which build back-end they are using and specified. This means build back-ends are still free and able to
hope you are familiar with that tool. innovate around patterns like how to specify the files to include in a
wheel. There is also an included escape hatch for users and build
back-ends to use when they choose to partially opt-out of this PEP
(compared to opting-out of this PEP entirely, which is also possible).
Finally, this PEP makes core metadata for projects statically defined. This PEP is also not trying to change the underlying `core metadata`_
By being statically defined, metadata can be read more quickly and in any way. Such considerations should be done in a separate PEP which
easily than if it were dynamically calculated. Tools which read may lead to changes or additions to what this PEP specifies.
and write metadata can do so without worrying about which build
back-end the user specified the metadata for. Statically defined
metadata is also more secure, since it does not require code execution
to gather, and is guaranteed to be deterministic.
Rationale Rationale
@ -66,7 +58,7 @@ The design guidelines the authors of this PEP followed were:
- Define as much of the `core metadata`_ as reasonable - Define as much of the `core metadata`_ as reasonable
- Define the metadata statically with an escape hatch for those who - Define the metadata statically with an escape hatch for those who
want to define it dynamically want to define it dynamically
- Use familiar names where it made sense, but be willing to use more - Use familiar names where it makes sense, but be willing to use more
modern terminology modern terminology
- Try to be ergonomic within a TOML file instead of mirroring how - Try to be ergonomic within a TOML file instead of mirroring how
tools specify metadata at a low-level tools specify metadata at a low-level
@ -94,7 +86,7 @@ Tools MUST specify fields defined by this PEP in a table named
defined by this PEP. For tools wishing to store their own settings in defined by this PEP. For tools wishing to store their own settings in
``pyproject.toml``, they may use the ``[tool]`` table as defined in ``pyproject.toml``, they may use the ``[tool]`` table as defined in
:pep:`518`. The lack of a ``[project]`` table implicitly means the :pep:`518`. The lack of a ``[project]`` table implicitly means the
build tool will dynamically provide all fields. build back-end will dynamically provide all fields.
``name`` ``name``
'''''''' ''''''''