Conversation
pfmoore
approved these changes
Jan 18, 2025
Member
Agreed, this is perfectly fine - tools are expected to do what's best for their use case when dealing with a SHOULD in a spec. If it's a problem to consumers that the rust library pre-validates everything, that's a usability matter for the library in question to deal with, and doesn't impact the spec directly. |
hugovk
approved these changes
Jan 18, 2025
Member
hugovk
left a comment
There was a problem hiding this comment.
Thank you, and congratulations on shepherding your first PEP all the way to the finish line! 🎉
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)Statuschanged toFinal(andPython-Versionis correct)canonical-docdirective(or
canonical-pypa-specfor packaging PEPs,or
canonical-typing-specfor 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.tomlparser, I found that it would have required entirely reworking the way thatpyproject.tomlis treated.That parser is eagerly loading and validating the whole
pyproject.tomlfile, 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.tomlin the first place.So that's the one place where the implementations deviated from the PEP a little -- a
SHOULDwhich 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.tomlisn't reading the whole file, it's worth knowing that the Rust tools are.📚 Documentation preview 📚: https://pep-previews--4213.org.readthedocs.build/