Skip to content
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

Fix the default ordering of dicts and add support for sorting keys #103

Merged
merged 1 commit into from
Jul 31, 2020

Conversation

sdispater
Copy link
Member

Resolves #93

This PR fixes an issue where the order of the original dict was not preserved when dumping it.

It also adds the ability to tell TOMLKit to sort keys when dumping by passing sort_keys=True to dumps().

@codecov-commenter
Copy link

codecov-commenter commented Jul 31, 2020

Codecov Report

Merging #103 into master will decrease coverage by 0.08%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #103      +/-   ##
==========================================
- Coverage   91.80%   91.71%   -0.09%     
==========================================
  Files          11       11              
  Lines        2391     2391              
==========================================
- Hits         2195     2193       -2     
- Misses        196      198       +2     
Impacted Files Coverage Δ
tomlkit/api.py 98.71% <100.00%> (ø)
tomlkit/items.py 88.14% <100.00%> (ø)
tomlkit/parser.py 96.26% <0.00%> (-0.28%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3e6a2a7...5721f88. Read the comment docs.

@sdispater sdispater merged commit c0d6f3f into master Jul 31, 2020
@sdispater sdispater deleted the fix-dump-order branch July 31, 2020 09:44
@sdispater sdispater mentioned this pull request Jul 31, 2020
capuanob pushed a commit to capuanob/tomlkit that referenced this pull request Mar 1, 2023
Fix the default ordering of dicts and add support for sorting keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serializing OrderedDict (and dict in Python 3) does not preserve order
2 participants