-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please consider pushing tomli into stdlib #141
Comments
Yep, I agree! Also I have no objections to adding Tomli there.
I'm not sure
but yeah generally I don't object me or someone else pushing this forward. |
Adding a module usually requires:
So the process is not just two minutes, but also not impossible! I would suggest that you start by joining the discuss discussion and state that you’re willing to have your module adopted to the standard library. Other people can help make the case for inclusion (not the whole core team is well versed in packaging matters), and maybe offer to be responsible for maintenance. (Note that the whole team collectively maintains the whole of Python, but some modules have dedicated maintainers who know the design and details well, and for a new module it’s expected to have one. In this specific case, as a parser for a specified format, it may be less important that you commit to maintain for the long term, and it is possible that someone who is both in pypa and python-dev will offer to be co-maintainer.) |
Thanks for your insight!
This seems tedious. Any help much appreciated 😄
I can do this.
I can do this.
Will do this anyways to support non EOL Python versions less than the one where stdlib addition happens.
Fair enough.
I've actually been participating for quite some time already. And have stated I'm willing to have the module adopted to the stdlib. If I've understood correctly, one additional obstacle is that since moving from BDFL to steering council, the process for adding/removing modules is not standardized yet, see python/steering-council#92 |
Ah good! Then I think you could send a call for help to write the PEP and make a fork of cpython with tomli added (or maybe not, there is no guarantee that the addition will be accepted).
It’s not really an obstacle: there is a discussion in progress about the process, but that doesn’t mean additions are blocked, just that they use ad-hoc processes. |
If Packages supporting older Python versions could do something like: try:
import toml
except ImportError:
import tomli as toml Also note that there are currently plans to get control of the |
Hello @hukkin ! Happy new year and thank you for tomli and thank you for being so willing to help fill this gap in the Python ecosystem! Over at https://bugs.python.org/issue40059, Brett indicated that the next step would be making a proposal to the SC. I'd love to hear your thoughts :-) Would also appreciate any feedback from @pradyunsg (sorry for the somewhat random tag)! |
FYI: There's a bunch of discussion in https://discuss.python.org/t/adopting-recommending-a-toml-parser/4068. |
Of course there's a 90 post thread that I've missed :-) Thanks for linking that. https://discuss.python.org/t/adopting-recommending-a-toml-parser/4068/84 seems to change Brett's stance to "PEP is necessary", so I can help write up something more formal than my current (discursive and informal) proposal. Not much new in the proposal that's not there in the thread, but might still be a good summary and the anecdotal evidence from grepping open source code might help sell API changes (particularly if we make breaking changes to uiri/toml). Comforting to know that the fallback package names I jotted down have all been suggested :-) |
Awesome work @hauntsaninja ! I added some notes to the gist's comment section and also pinged @gaborbernat there who showed interest in writing a PEP as well. |
Also tagging @encukou as they said they'd be able to co-maintain in the stdlib. I think we've got a pretty good team now. 😸 There's a few major decisions where the PEP must take a side. I assume it's best to plan these out either here or in the PEPs PR and return to https://discuss.python.org with the first draft complete? Here's some decisions that come to mind: A) What to do with future TOML spec versions?
B) Which name?
Option 1. is special because the name is currently in use by https://github.com/uiri/toml so being able to use it requires that pradyunsg is able to claim the name. It also means we have to make breaking changes to the C) Should the standard library be able to dump(s) TOML?
My personal favorites are probably: A2, B1 (if possible, else B3 or B4), and C1. It should be noted that if we choose B1 (use EDIT: I know that @pradyunsg would want to keep write capability and |
It should implement the current spec at v1, could follow minor revisions as bugfixes, and add support for a possible v2 with a separate parser class (or parameters in the existing one if that’s clean and easy). Once in the stdlib, it should keep support for v1 working. |
PRs in the PEP repo aren't a good place for discussion; it's better to only open one when the draft is ready. A) I'd say 2, and handle TOML v2.0.0 when/if it comes. (Maybe it'll never come – just like JSON v2.0 seems unlikely. Or it'll be possible to detect – for example, C) No. The docs should point to B) Using As for the other B) options: |
I've converted my gist to something more PEP sounding, please see: https://github.com/hauntsaninja/peps/blob/toml-pep/pep-9999.rst Note that while I put several things under "rejected ideas", most of them are still on the table. My goal was just phrasing things normatively, not shutting down discussion :-) My answers to questions A, B, C are in the PEP draft, but are: |
FWIW, I think this is incorrect. By using |
Yeah your fork works great! Would be great if you opened a PR to e.g. your own fork's |
hauntsaninja/peps#1 is a PR from toml-pep branch to main, for people to review. Oh oops, totally forgot about the |
Note that @pradyunsg is hoping to get maintainership transfer for |
As mentioned in the Packaging discuss thread and the PEP draft, this would still break users who have pinned versions of the current |
Just to be clear, I will not sponsor write API. In the stdlib there is only one chance to do things right, and there are too many open questions and degrees of freedom around TOML writing.
That is not a good metric, IMO. One of the reasons to use For other questions my views aren't that strong. Is the |
I don't think it's absolutely necessary, and agree that it is a bit like an extension to TOML. I'm fine with not adding it to the stdlib. But my anecdotal experience is that this is extremely valuable to anyone dealing with money, probably science too. The alternative is to use TOML strings for fractional numbers, which isn't that great. When a user sees a TOML float, they don't think "oh that's an IEEE 754 binary64 value", they think "that's a fractional number". Many TOML-facing users are probably not developers, and especially not aware of what a double-precision float is, so I do know that this solves a real-world problem. |
That sounds reasonable.
It would be great to put quotes from such users in the PEP, though. |
I'm confused: why do people have compatibility concerns w.r.t. The only thing that's slightly off is that there's a few too many encoders in the package, which can be dropped and externalized before moving it into the standard library. That is potentially the only disruptive change, and I don't think that's too disruptive. |
If the stdlib and a 3rd party lib shares name you're bound to get weird bugs when they go out of sync with each other 🤔 |
It'll basically be a similar story to how existing backport packages work? There's a PyPI package with the same name for existing standard library packages, like |
uiri/toml predates the would-be stdlib toml module and if a package which depends on uiri/toml is not updated to handle the stdlib module, an |
Based on recent discussion, I've made several updates to the PEP draft. The PEP draft continues to suggest
@encukou I've removed the proposal for adding a write API in the latest draft. Since your chief reservations seem to be around degrees of freedom, I've tried to capture some of the possible design space questions in Appendix B. Please let me know if there's anything important I'm missing.
I tried a couple search terms and that number was representative. The latest PEP draft compares number of files containing "toml.load" + "tomli.load" to "toml.dump" + "tomli_w.dump" and finds a similar ratio (~1300 to ~400).
This is a good question. For now, I've left it in the proposed API, but added a discussion section. I added a TODO in case @hukkin has good examples of user quotes to include, as suggested by encukou. |
@hauntsaninja thanks a lot for taking the effort of writing this up 👏 can you please open a PR to the https://github.com/python/peps 😊 we can get a PEP number on the draft version you have, and keep polishing it with follow-up PRs 😊 I think the current format is through enough that gives a good understanding of what we want to achieve and would allow us to see it rendered on https://www.python.org/dev/peps for better reading experience. (PS. I think for the first round let's not add write API we can always follow it up later with another PEP to extend it, and I imagine the read only API will be less contentious; and that way Petr Viktorin can be the sponsor of the PR). |
I'm quite busy today, but I'll suggest some edits tomorrow. |
If we could retroactively mark uiri/toml releases as incompatible with Of course, this would fly in the face of everything we've been saying about |
And mark everything using the toml library on the new python version broken (if we'd not replicate the toml interface and functionality 100%)? Feels to me not worth it. I think using |
We could find direct dependents and help them transition - it all depends on how much time and effort we're willing to expend and if we think securing the "toml" name is worth it. uiri/toml is abandoned and, realistically, any project which is not able to switch to tomli or the stdlib backport in a year or two years' time, will itself have been abandoned. |
What about all the enterprise projects that we don't have access to? Surely, these companies will not be happy if we generate countless hours of migration for adopting a new Python version. In the enterprise, world projects are rarely abandoned in two years' time. |
IMO, having a good fully-featured TOML library on PyPI as I'd like to avoid repeating the situation where people were assuming @hynek's |
Draft PEP is now visible at https://www.python.org/dev/peps/pep-0680/ |
What's the next step? Should we open a new thread on https://discuss.python.org/c/peps/ ? EDIT: We now have it https://discuss.python.org/t/pep-680-tomllib-support-for-parsing-toml-in-the-standard-library/13040 ! |
Yes, please. Let's open the floor for discussion there and hopefully we get
to no objections in a short time to still make it to 3.11
…On Mon, 10 Jan 2022, 21:22 Taneli Hukkinen, ***@***.***> wrote:
What's the next step? Should we open a new thread on
https://discuss.python.org/c/peps/ ?
—
Reply to this email directly, view it on GitHub
<#141 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFIQPRLUD7SBWLMERRAIWDUVNEZXANCNFSM5H6KPW6A>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
What's the status? Is the PEP ready, or is there still something to hash out? |
The PEP seems ready to me. The only thing I have any concerns about is So now I think it may still be a justified feature. I made a PR to make the PEP acknowledge the use of the word "should": python/peps#2278 |
Yup, agreed that PEP seems ready. My summary of the discuss thread:
|
Thanks @hauntsaninja I think that's a good summary. I'm curious, how do we proceed when we think the PEP is ready? My understanding is the PEP goes to steering council, but how long should the discuss thread be open before that? What deadlines (for PEP acceptance and merging to CPython) do we have for having a realistic chance of being included in Python 3.11? |
Usually it's considered done if no feedback/discussion happened in the last week. |
One more missing thing is a notice to the python-dev list, like https://mail.python.org/archives/list/python-dev@python.org/thread/G4F3ZMCJRWWRSF7O34Z7RPYQQK7QPGB6/ The deadline for merging into 3.11 is the first beta, planned for May 6th. |
Thanks @encukou, let's get the python-dev notice out of our way! And it seems we have plenty time seeing how far we are already (for the curious, we already have a draft PR to CPython). Seeing that I chose to not add my email address to the PEP, and that an email to python-dev will inevitably be archived and publicized, would @hauntsaninja be kind enough to send the email. I've drafted one already so you can copy-paste (or feel free to edit): To: Subject:
Body:
|
I've submitted the PEP for steering council consideration: python/steering-council#104 |
I'm closing this issue seeing that the decision has been made, and Tomli will be in the standard library. A massive thank you to everyone in this thread for the help, reviews, comments, support etc.! And an especially huge thank you to @hauntsaninja for writing the PEP draft. |
Long story short, having a TOML parser in Python stdlib would be great and tomli seems to be the best implementation available right now, so also the best candidate for stdlib. Would you be interested in trying to push it?
The relevant CPython bug is: https://bugs.python.org/issue40059
The text was updated successfully, but these errors were encountered: