PEP 518: Clarify how tools should treat the absence of things

This commit is contained in:
Brett Cannon 2019-12-13 15:27:42 -08:00 committed by GitHub
parent 8b373d0bfd
commit 1542941b34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 15 deletions

View File

@ -173,21 +173,13 @@ community at the moment, build tools are expected to use the example
configuration file above as their default semantics when a configuration file above as their default semantics when a
``pyproject.toml`` file is not present. ``pyproject.toml`` file is not present.
Tools should not require the existence of the ``[build-system]`` Tools should not require the existence of the ``[build-system]`` table.
table. A ``pyproject.toml`` file may be used to store configuration A ``pyproject.toml`` file may be used to store configuration details
details other than build-related data and thus lack a other than build-related data and thus lack a ``[build-system]`` table
``[build-system]`` table legitimately. It is up to the tool to decide legitimately. If the file exists but is lacking the ``[build-system]``
how to handle this case. Potential options are: table then the default values as specified above should be used.
If the table is specified but is missing required fields then the tool
1. Act as if the ``pyproject.toml`` file does not exist. should consider it an error.
2. Assume the table exists with the default values specified above.
While subtle, there is a difference in these two options depending on
whether the existence of a ``pyproject.toml`` file has special
significance to the tool (e.g. pip currently triggers build isolation
for a project when a ``pyproject.toml`` file is found). If help is
desired in choosing an option for a tool then this PEP suggests the
second option to help people move over to ``pyproject.toml`` files.
tool table tool table