Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The canonical doc link was already merged (slightly out-of-order), but this change should "true it up".
As a packaging PEP, several of the checklist items are blank as not-applicable.
PEP 123: Mark Final
)Status
changed toFinal
(andPython-Version
is correct)canonical-doc
directive(or
canonical-pypa-spec
for packaging PEPs,or
canonical-typing-spec
for typing PEPs)@pfmoore, there's only one thing which I learned during implementation and which I think is worth sharing. I do not think it's material to the PEP itself, but it is something which might impact future discussions.
There's a callout in the PEP and the spec doc about not doing more validation than you need to, in order to allow multiple tools and tool versions to coexist even if the spec evolves in the future.
In Python, this is very easy to support -- load the TOML data, but only read sections as you need them. In Rust, by contrast, when I went to contribute to the
pyproject.toml
parser, I found that it would have required entirely reworking the way thatpyproject.toml
is treated.That parser is eagerly loading and validating the whole
pyproject.toml
file, as it's just a better fit for the language. In retrospect, it seems obvious that the "natural fit" for reading a datastructure from TOML or JSON in less dynamic languages is to construct a tree of strict types and load the data into those types.For two reasons, I didn't try to rewrite the Rust parser. (1) I'm a Rust novice, so I'm not confident I could do it well without more time to learn. (2) I'm not sure that the Rust consumers would actually want a lazy data model for
pyproject.toml
in the first place.So that's the one place where the implementations deviated from the PEP a little -- a
SHOULD
which is not being followed uniformly. I don't think the PEP itself needs any change.But if anyone makes the assumption that a user of
pyproject.toml
isn't reading the whole file, it's worth knowing that the Rust tools are.📚 Documentation preview 📚: https://pep-previews--4213.org.readthedocs.build/