pull_requests: 301866701
This data as json
id | node_id | number | state | locked | title | user | body | created_at | updated_at | closed_at | merged_at | merge_commit_sha | assignee | milestone | draft | head | base | author_association | auto_merge | repo | url | merged_by |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
301866701 | MDExOlB1bGxSZXF1ZXN0MzAxODY2NzAx | 3166 | closed | 0 | [Feature] Backend entrypoint | 2443309 | In this PR, I'm experimenting with using the entrypoints package to support 3rd party backends. This does not attempt to solidify the API for what the store is, I feel like that should happen in a second PR. Here's how it would work... In @rabernat's `xmitgcm` package, there is a `_MDSDataStore` that inherits from `xarray.backends.common.AbstractDataStore`. To allow reading `mds` datasets directly in `xarray.open_dataset`, `xmitgcm` would add the following lines to its `setup.py` file: ```python setup( ... entry_points={ 'xarray.backends': [ 'mds = xmitgcm.mds_store:_MDSDataStore', ... ] } ) ``` Xarray would then be able to discover this backend at runtime and users could use the store directly in `open_dataset` calls like this: ```python ds = xr.open_dataset('./path/to/file.mds', engine='mds', backend_kwargs={...}) ``` *Note: I recognize that `xmitgcm.open_mdsdataset` has a bunch of other user options that I'm likely ignoring here but this is meant just as an illustration.* Now a list of caveats and things to consider: 1. I have only done this for `open_dataset`, not for `to_netcdf`. We may want to consider more generic serialization method that allows for plug-able writers. 1. `open_dataset` has some special handling for some readers (lock and group selection, file-like objects, etc.). We should work toward moving as much of that logic into the Store objects as possible. 1. We should decide what to do when a 3rd party plugin conflicts with an existing backend. For example, someone could include an entrypoint with the key of `netcdf4`. --------------------------------- - [x] Partially closes #1970 - [ ] Tests added - [ ] Fully documented, including `whats-new.rst` for all changes and `api.rst` for new API | 2019-07-28T23:01:47Z | 2021-01-12T16:41:23Z | 2021-01-12T16:41:23Z | 06fd387f3b59cf7065a54bb6423371f53734bb44 | 0 | 4fb4bb9db6c9762a7223bc9165d27bafd1d945ad | 7bf9df9d75c40bcbf2dd28c47204529a76561a3f | MEMBER | 13221727 | https://github.com/pydata/xarray/pull/3166 |
Links from other tables
- 1 row from pull_requests_id in labels_pull_requests