-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Refactor backends to separate writers from readers #10771
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
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 looks great, thanks!
Would it make sense to rename |
Maybe, but I actually kind of think It would make more sense to me to only keep the code in the But I was afraid of making such a drastic changes in this one PR in case it breaks things (potentially in external libraries that should not be importing these things, but probably are anyway), so I kept this PR to changes that I thought would be less likely to cause any issues. cc'ing @max-sixty who I bet would have an opinion on this too 😄 (ref #10089) |
An in-between is to make the change to make xarray have an improved layout, and keep api.py for a bit, importing everything from the other files with a very obnoxious warning that this is deprecated and going away soon. |
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.
Nice!
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.
looks great!
(no strong view on the api
vs readers
etc!)
…/xarray into refactor-datatree-io
* handle changes in pydata/xarray#10771 * remove split_every line as that will go in a follow-up PR * attempt to satisfy myppy
This refactor deals with a few related code structure issues:
core/datatree_io.py
exists totally separate from the rest of thebackends
codebackends/api.py
mixes code for opening data (which are truly part of the backend engines system) with code for saving data (which are not)backends/api.py
contains code that is not actually part of the public APIMy changes instead move all code that has to do with writing out into a new
backends/writers.py
file. This means we can deletecore/datatree_io.py
, and everything in newbackends/api.py
is now actually public API.There should be no functional changes, I'm just moving things around to separate concerns and organise better.
I'm open to better suggestions for names for the
writers.py
file.Note this refactor is arguably the first step of #5954.