Skip to content

Regression: 3rd party backends are not discovered with xarray==0.20.0 #5930

Closed
@ashwinvis

Description

@ashwinvis

What happened:
I am a library developer for pymech and I added a (unreleased) xarray backend following the documentation and rioxarray's implementation. This works with xarray==0.19.0, but with the xarray==0.20.0 it no longer works. Could someone clarify what has changed?

What you expected to happen:

Backends can be discovered while using xr.open_dataset(...) with or without using the engine= keyword argument.

Minimal Complete Verifiable Example:

Since pymech's xarray backend is unreleased, I will demonstrate it via rioxarray:

#test.py
from xarray.backends import plugins

print("engines =", plugins.list_engines())
plugins.get_backend("rasterio")
$ pip install xarray==0.19.0 rioxarray
$ python test.py
engines = {'rasterio': <rioxarray.xarray_plugin.RasterioBackend object at 0x7f7adca15d00>, 'store': <xarray.backends.store.StoreBackendEntrypoint object at 0x7f7adca647c0>}

$ pip install xarray==0.20.0
$ python test.py
engines = {'store': <xarray.backends.store.StoreBackendEntrypoint object at 0x7fd99138efa0>}
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/venv/lib/python3.9/site-packages/xarray/backends/plugins.py", line 164, in get_backend
    raise ValueError(
ValueError: unrecognized engine rasterio must be one of: ['store']

Anything else we need to know?:

Environment:

Output of xr.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.9.7 (default, Oct 10 2021, 15:13:22)
[GCC 11.1.0]
python-bits: 64
OS: Linux
OS-release: 5.10.75-1-lts
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: C
LOCALE: (None, None)
libhdf5: None
libnetcdf: None

xarray: 0.20.0
pandas: 1.3.4
numpy: 1.21.3
scipy: None
netCDF4: None
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: 1.2.10
cfgrib: None
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: None
cartopy: None
seaborn: None
numbagg: None
fsspec: None
cupy: None
pint: None
sparse: None
setuptools: 57.4.0
pip: 21.2.3
conda: None
pytest: None
IPython: 7.29.0
sphinx: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions