Description
xarray 2026.4.0 removed the ability to pass a Dataset as data_vars to the Dataset() constructor (xarray GH11095). This was never intended behavior and silently dropped attrs.
linopy uses this pattern in several places:
expressions.py:287 — xr.Dataset(ds.assign_coords(new_coords))
expressions.py:395 — Dataset(data.transpose(..., TERM_DIM))
expressions.py:2101 — xr.Dataset(data.transpose(..., FACTOR_DIM, TERM_DIM))
model.py:362 — Dataset(value) in the parameters setter
All raise TypeError: Passing a Dataset as data_vars to the Dataset constructor is not supported.
How to reproduce
pip install xarray==2026.4.0
python -c "from linopy import Model; Model()"
Expected behavior
linopy should work with the latest xarray release.
Environment
- linopy: master (36bc106)
- xarray: 2026.4.0
- Python: 3.10+
Description
xarray 2026.4.0 removed the ability to pass a
Datasetasdata_varsto theDataset()constructor (xarray GH11095). This was never intended behavior and silently droppedattrs.linopy uses this pattern in several places:
expressions.py:287—xr.Dataset(ds.assign_coords(new_coords))expressions.py:395—Dataset(data.transpose(..., TERM_DIM))expressions.py:2101—xr.Dataset(data.transpose(..., FACTOR_DIM, TERM_DIM))model.py:362—Dataset(value)in theparameterssetterAll raise
TypeError: Passing a Dataset as data_vars to the Dataset constructor is not supported.How to reproduce
pip install xarray==2026.4.0 python -c "from linopy import Model; Model()"Expected behavior
linopy should work with the latest xarray release.
Environment