-
Notifications
You must be signed in to change notification settings - Fork 0
bpo-40059: tomllib #2
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
Conversation
|
Hey @encukou and @hauntsaninja ! The tomllib PEP is obviously not accepted yet, but I had some spare time so integrated Tomli to the stdlib. Here's the results. I made minimal docs already too. I've included all Tomli's tests, which means almost 1MB of test data. @encukou perhaps you can tell if this is too much for a single cpython module? EDIT: The Files changed tab of this PR on GitHub kills my browser (probably due to the amount of test files). Here's a link to it but with test data filtered: https://github.com/hukkin/cpython/pull/2/files?file-filters%5B%5D=.h&file-filters%5B%5D=.md&file-filters%5B%5D=.py&file-filters%5B%5D=.rst&file-filters%5B%5D=No+extension&show-viewed-files=true |
hauntsaninja
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome!
encukou will be able to give you better advice about tests, but I believe for zoneinfo and importlib.metadata some tests with extra deps or fixtures exist outside the CPython code base.
|
Ah, here's the notification I missed. Sorry for that! |
|
Thanks a lot for the review @merwok ! I'll have a closer look a bit later. I think some of the comments have to do with the fact that I tried to minimize the steps needed to take to go from Tomli (backport) to tomllib (stdlib) in order to minimize maintenance effort. Perhaps that's not something I should do though? |
|
I wouldn't worry about the extra comments, if they simplify maintaining
|
|
I was not thinking of the backport! Then I agree with Petr, except for the license text. |
Doc/library/tomllib.rst
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
load wants a binary stream but loads a text string?
If this is intentional, it may be worth pointing out here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Closing in favour of python#31498 |
Steps taken
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.rst