bpo-40059: tomllib#31498
Conversation
|
A question: upstream (Tomli) is formatted with Black, using Black's defaults. This means a line length of 88. Should I reformat with line length at 79? |
Sorry, something went wrong.
|
This will need NEWS and "What's new" entries: You can add this to https://github.com/python/cpython/blob/main/.github/CODEOWNERS |
Sorry, something went wrong.
|
Perhaps it'd make sense to include the tomli version used (or even the git commit hash), to make future syncing easier. |
Sorry, something went wrong.
It was previously suggested that I remove Tomli version from the standard library port: hukkin#2 (comment) I plan to include a migration guide in Tomli repository, also including commit hash that tracks what is currently in the stdlib. |
Sorry, something went wrong.
|
Would it be good to mention in the docs why |
Sorry, something went wrong.
|
I should get to the review this week or the next.
No, I don't think that's worth it. And anyway, line length is not the only point where Black disagrees with PEP8 (starting with, like, the whole philosophy).
Let's leave docs improvements to future PRs, so they get a proper discussion and don't delay this PR? |
Sorry, something went wrong.
Co-authored-by: Petr Viktorin <encukou@gmail.com>
encukou
left a comment
There was a problem hiding this comment.
I have a few test nitpicks, but I'm happy to merge this!
Sorry, something went wrong.
|
It seems the failing CI job ( |
Sorry, something went wrong.
|
The alpha 6 release is a bit bumpy and I don't want to destabilize it, so I'm holding off the merge until it's out. |
Sorry, something went wrong.
|
Let's get it in! |
Sorry, something went wrong.
This adds a new standard library module,
tomllib, for parsing TOML. The recently accepted PEP 680 -- tomllib is relevant here.This PR has already seen some review in a PR under my personal fork: hukkin#2 (thanks to @encukou, @merwok, @hauntsaninja, @JelleZijlstra (I hope I'm not forgetting anyone)).
The implementation is based on Tomli which I plan to keep maintaining as a backport for Python versions 3.7, 3.8, 3.9 and 3.10, until finally Python 3.10 goes EOL.
Steps taken (converting
tomlitotomllib)Move everything in
tomli:src/tomlitoLib/tomllib. Excludepy.typed.Remove
__version__ = ...line fromLib/tomllib/__init__.pyMove everything in
tomli:teststoLib/test/test_tomllib. Exclude the following test data dirs recursively:tomli:tests/data/invalid/_external/tomli:tests/data/valid/_external/Create
Lib/test/test_tomllib/__main__.py:Add the following to
Lib/test/test_tomllib/__init__.py:Also change
import tomli as tomllibtoimport tomllib.In
cpython/Lib/tomllib/_parser.pyreplace__fpwithfpand__swiths. Add the/toloadandloadsfunction signatures.Run
make regen-stdlib-module-namesCreate
Doc/library/tomllib.rstand reference it inDoc/library/fileformats.rstedit: For reference, there's one more step – Add
tomllibto Makefile.pre.inhttps://bugs.python.org/issue40059