Uh oh!
There was an error while loading. Please reload this page.
Allow using a custom engine class directly in xr.open_dataset - #5033
Conversation
Hello @Illviljan! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-04-15 01:45:12 UTC |
mathause
left a comment
There was a problem hiding this comment.
LGTM. Clever test! I think someone actually working on the backends should merge.
Illviljan
commented
Mar 25, 2021
Maybe @aurghs or @alexamici can take a look as well? |
mathause
commented
Apr 8, 2021
@alexamici ok if we merge this? |
alexamici
commented
Apr 8, 2021
@Illviljan sorry for being late to the party. The first comment is that I see the point of the feature at a theoretical level, but I'm at the third external backend that I'm writing and I didn't miss it. Adding an entrypoint is very easy and works seamlessly during development. Do you have in mind any use case where this is more convenient than adding an entrypoint? WRT the implementation, at the request of @shoyer and @jhamman, we ask backend developers to inherit from |
Uh oh!
There was an error while loading. Please reload this page.
Illviljan
commented
Apr 8, 2021
I simply want to do: fromcustom_backendimportengineds=xr.load_dataset(filename, engine=engine)That is much simpler than having to figure out what the How to register a backend is talking about. Because I'm a user who doesn't have any grand dreams (yet?) of creating public backend modules I therefore don't see the point in having to do all this extra paperwork.
That's not how I read the docs. If this is how we actually want it then some words in it should be replaced with "must" and "requires". But I don't think that should be such a hard requirement when a user insists on using a custom engine this way. I see it as an advanced option where it's the users responsibility to make sure that the
Which is very simple to do, see the test for an example. Subclassing using |
alexamici
commented
Apr 8, 2021
Well, based on the amount of complexity a developer needs to master in order to write the backend, I would consider the registration to be a relatively trivial bit, especially because the syntax is the same as for the well known On one hand I judge the feature to be relatively simple to support in the long long term, on the other hand I still feel that its benefit will be be quite marginal. Therefore I'm still a mild -1.
On this one I can side with you. The initial proposal from @aurghs and myself was to use a This one is a higher lever design decisione, I think @jhamman and @shoyer need to weight in. |
Illviljan
commented
Apr 8, 2021
Making a backend doesn't have to be super difficult either depending if you already have a nice 3rd party module you can thinly wrap to return a Dataset instead of whatever is the default It's funny how different our backgrounds are, I don't think I've had to deal with |
Absolutely agree: https://github.com/corteva/rioxarray/blob/master/rioxarray/xarray_plugin.py (the PR took a grand total of 48 hours from open to merge: corteva/rioxarray#281)
😅 |
I agree. Adding a plugin is not really very difficult, but in some cases could be discouraging especially if you are just exploring how the backends work. |
aurghs
commented
Apr 14, 2021
@Illviljan I see your point, but the subclassing doesn't add too much complexity and for consistency would be better to add a check on the class. |
shoyer
commented
Apr 14, 2021
My perspective:
|
Uh oh!
There was an error while loading. Please reload this page.
kmuehlbauer
commented
Apr 14, 2021
I really like to see this getting merged and I think subclassing isn't a big of a problem. Thanks for working on this. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: keewis <keewis@users.noreply.github.com>
…llviljan/xarray into Illviljan-simpler_backend_load
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Stephan Hoyer <shoyer@google.com>
shoyer
commented
Apr 15, 2021
thanks! |
pre-commit run --all-files