Description
When serving a dataset using ds.rest.serve() and accessing the /info endpoint, an internal server error occurs due to an unexpected keyword argument region passed to extract_zarr_variable_encoding(). This appears to be caused by an incompatibility with the latest xarray version (2025.7.1).
To Reproduce
import xarray as xr
import xpublish
ds = xr.tutorial.open_dataset(
"air_temperature",
chunks=dict(lat=5, lon=5),
)
ds.rest.serve()
Then, request:
Expected behavior
The /info endpoint should return metadata about the dataset without error.
Actual behavior
The server responds with HTTP 500 and the traceback shows:
TypeError: extract_zarr_variable_encoding() got an unexpected keyword argument 'region'
Full traceback
...
File "xpublish/utils/zarr.py", line 202, in create_zmetadata
encoding = extract_zarr_variable_encoding(
dvar,
zarr_format=ZARR_FORMAT,
region=tuple([SimpleNamespace(start=None, stop=None) for _ in da.shape]),
)
TypeError: extract_zarr_variable_encoding() got an unexpected keyword argument 'region'
Environment
The response of /versions API
{
"python": "3.13.5 | packaged by conda-forge | (main, Jun 16 2025, 08:27:50) [GCC 13.3.0]",
"python-bits": 64,
"OS": "Linux",
"OS-release": "6.15.5-arch1-1",
"Version": "#1 SMP PREEMPT_DYNAMIC Sun, 06 Jul 2025 11:14:36 +0000",
"machine": "x86_64",
"processor": "",
"byteorder": "little",
"LC_ALL": "None",
"LANG": "en_US.UTF-8",
"LOCALE": "en_US.UTF-8",
"libhdf5": "1.14.6",
"libnetcdf": "4.9.2",
"xarray": "2025.7.1",
"zarr": "3.0.10",
"numcodecs": "0.16.1",
"fastapi": "0.116.0",
"starlette": "0.46.2",
"pandas": "2.3.1",
"numpy": "2.3.1",
"dask": "2025.5.1",
"uvicorn": "0.35.0"
}
Additional context
This appears to be a compatibility issue with newer versions of xarray, where extract_zarr_variable_encoding() no longer accepts a region parameter. Possibly related to upstream API changes in xarray.
When send request to /zarr/*, the same error.
Description
When serving a dataset using ds.rest.serve() and accessing the /info endpoint, an internal server error occurs due to an unexpected keyword argument region passed to extract_zarr_variable_encoding(). This appears to be caused by an incompatibility with the latest xarray version (2025.7.1).
To Reproduce
Then, request:
Expected behavior
The
/infoendpoint should return metadata about the dataset without error.Actual behavior
The server responds with HTTP 500 and the traceback shows:
Full traceback
Environment
The response of
/versionsAPI{ "python": "3.13.5 | packaged by conda-forge | (main, Jun 16 2025, 08:27:50) [GCC 13.3.0]", "python-bits": 64, "OS": "Linux", "OS-release": "6.15.5-arch1-1", "Version": "#1 SMP PREEMPT_DYNAMIC Sun, 06 Jul 2025 11:14:36 +0000", "machine": "x86_64", "processor": "", "byteorder": "little", "LC_ALL": "None", "LANG": "en_US.UTF-8", "LOCALE": "en_US.UTF-8", "libhdf5": "1.14.6", "libnetcdf": "4.9.2", "xarray": "2025.7.1", "zarr": "3.0.10", "numcodecs": "0.16.1", "fastapi": "0.116.0", "starlette": "0.46.2", "pandas": "2.3.1", "numpy": "2.3.1", "dask": "2025.5.1", "uvicorn": "0.35.0" }Additional context
This appears to be a compatibility issue with newer versions of xarray, where extract_zarr_variable_encoding() no longer accepts a region parameter. Possibly related to upstream API changes in xarray.
When send request to
/zarr/*, the same error.