Repository navigation
Conversation
This pull request removes OrderedDict from files in io.ascii. The files are: core.py , daophot.py , ecsv.py , fastbasic.py , ipac.py and test_read.py. The OrderedDicts are normal dictionaries now.
for more information, see https://pre-commit.ci
Applying @dhomeier suggested changes defining sort_keys as False instead of default_flow_style
for more information, see https://pre-commit.ci
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
|
If it's building on top of a draft PR I suggest drafting this one too ! |
|
@MridulS - the change to
|
Woops, did not see that! I guess OrderedDict needs to be there. I don't think it is going away from CPython anytime soon. The only main gain here would be the performance gain. Vanilla dict is supposed to be much more efficient than OrderedDict |
I haven't done profiling but I would be a bit surprised if |
Yeah I was thinking more about Table wide usage of OrderedDict, like in |
There was a problem hiding this comment.
I'm good with all the cosmology changes so long as the resulting files adhere to the ECSV standard!
|
@MridulS - I was poking around the code and wondered about an idea to use |
|
With the changes above, you should also revert the changes that add |
| # datatype: | ||
| # - {name: name, datatype: string} | ||
| ... | ||
| # meta: !!omap |
There was a problem hiding this comment.
What does this mean for people with older ESCV files with this !!omap though? Will their files no longer load with this patch? I think this was discussed before elsewhere but I don't have time to dig it up right now.
There was a problem hiding this comment.
Yeah removing that was a bad idea 😅
This is continued in #16250 (closing this PR).
Description
This builds on top of #15496, the commit 085fcd0 has the changes to make the tests happy. One is changing the
MetaDatadefault factory to adictinstead ofOrderedDictand other (more controversial) one is to change the YAML representation of the dump. From what I gather the main reason for the failure was the addition of theomaptags which are added by custom astropy dumpers/loaders forOrderedDictand not for a normal pythondict.But this is a breaking change as it does change the YAML representation, so if someone reads an old serialized object it will be read in a normal dictionary and not a ordered dict. If we do tweak the representation we should get rid of the custom logic for handling ordereddicts in
AstropyDumper/Loader.This also forces all the dictionary objects to preserve insertion order in the YAML output, which wasn't guaranteed before.
I think it may make sense to do
astropy/tablein this PR too to make sure everything is in one place.Fixes #