Closed mishamsk closed 1 year ago
Would you like to add such a case to the tests since you mentioned it? forgot to pull latest changes, so naturally it didn't work for dataclasses in my branch.
now pulled and rebased. added a test + added a README
@mishamsk Thank you for contribution, I'm merging it now.
glad to help!
@mishamsk
I just realised that I was wrong. Config options are not propagated to inner dataclasses by design, and the tests didn't show it because two dictionaries with different key order are equal. I created the pull request to fix the tests.
@Fatal1ty ouch. sorry. my bad!
Hi,
Thought this is small enough to directly open a PR and see if you would support this feature.
What: add a
sort_keys
option forBaseConfig
which would efficiently generate serialization code such that keys are sorted on creation (which in many cases will make much heavier encoder approach unnecessary).What's missing:
Rationale: I am using key sort (via
__post_serialize__
hook) a lot in order to maintain stable serialized view of my objects (those pesky trees). This would make it more efficient (depending on how classes are defined of course).