Skip to content
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

Exposing Zarr backend internals as semi-public API #3851

Closed
jhamman opened this issue Mar 9, 2020 · 3 comments · Fixed by #3897
Closed

Exposing Zarr backend internals as semi-public API #3851

jhamman opened this issue Mar 9, 2020 · 3 comments · Fixed by #3897
Labels
topic-backends topic-zarr Related to zarr storage library

Comments

@jhamman
Copy link
Member

jhamman commented Mar 9, 2020

We recently built a prototype REST API for serving xarray datasets via a Fast-API application (see #3850 for more details). In the process of doing this, we needed to use a few internal functions in Xarray's Zarr backend:

from xarray.backends.zarr import (
    _DIMENSION_KEY,
    _encode_zarr_attr_value,
    _extract_zarr_variable_encoding,
    encode_zarr_variable,
)
from xarray.core.pycompat import dask_array_type
from xarray.util.print_versions import get_sys_info, netcdf_and_hdf5_versions

Obviously, none of these imports are really meant for use outside of Xarray's backends so I'd like to discuss how we may go about exposing these functions (or variables) as semi-public (advanced use) API features. Thoughts?

cc @rabernat

@rabernat
Copy link
Contributor

rabernat commented Mar 9, 2020

Shouldn't this be solved by the entry points refactor of the backends? In the future, I imagine that the zarr backend for xarray will not live in xarray but rather in some third-party package. That package could expose all of these functions as public API.

@jhamman
Copy link
Member Author

jhamman commented Mar 9, 2020

Yes, this is one (probable) path. I wanted to document that we were using these private API functions in an effort to highlight their usefulness and to document their off-piste use.

@TomNicholas TomNicholas added topic-backends topic-zarr Related to zarr storage library labels Mar 11, 2020
@shoyer
Copy link
Member

shoyer commented Mar 13, 2020

The imports from xarray.backends.zarr all seem pretty reasonable to me. We could make those semi-public if you like. Of course, ideally the way to write netCDF style data would be codified in some third-party convention, not inside xarray.

I don't think it's a good idea to reuse the imports from xarray.core.pycompat or xarray.util.print_versions. I would just fork that code into your project rather than importing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-backends topic-zarr Related to zarr storage library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants