Replace toml with tomli w - #973
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #973 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 27 27
Lines 8734 8734
=========================================
Hits 8734 8734 ☔ View full report in Codecov by Harness. |
|
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.



What does this PR do?
Fixes #962
Moves the
tomlextra off the unmaintainedtomlpackage.Reading already preferred the standard library
tomllibwhen available, so the only real dependency ontomlwas writing, plus reading in python 3.10 wheretomllibdoes not exist. The extra now installs:tomli-wfor writing.tomlifor reading, only forpython_version < '3.11'.Changes:
pyproject.toml: thetomlextra requirestomli-w>=1.0.0andtomli>=2.0.1; python_version < '3.11'. The extra name is unchanged._optionals.py:toml_load_availablenow checkstomllibortomli,toml_dump_availablecheckstomli_w, andimport_toml_loads/import_toml_dumpsimport accordingly..pre-commit-config.yaml: dropped thetypes-tomlmypy dependency, sincetomliandtomli-wship their own type hints.Note on behavior:
tomli-wwrites arrays multi-line, wheretomlwrote them inline. So dumping a list now gives:instead of
child2 = [ 3.0, 4.5,]. The output is still valid TOML and parses back to the same value, but it is a visible difference for anyone comparing dumped configs, so it is mentioned in the changelog.Before submitting