Skip to content

Import h5netcdf.core to use EnumType - #10779

Merged
dcherian merged 6 commits into
pydata:mainfrom
maxrjones:update-import
Oct 27, 2025
Merged

Import h5netcdf.core to use EnumType #10779
dcherian merged 6 commits into
pydata:mainfrom
maxrjones:update-import

Conversation

@maxrjones

Copy link
Copy Markdown
Contributor

This PR fixes an import issue with h5netcdf.core.EnumType. Recent Python versions require explicit submodule imports, so import h5netcdf followed by h5netcdf.core.EnumType fails because the core submodule isn't automatically loaded. This was causing pickling issues with NetCDF4 files (xref developmentseed/titiler-multidim#97).

(see also, zarr-developers/zarr-python#3473 for a bug caused by the same behavior)

@maxrjones

Copy link
Copy Markdown
Contributor Author

@kmuehlbauer would you be willing to provide some advice here? The min-deps CI check is failing because EnumType was only added in h5netcdf/h5netcdf#226 (released in v1.6.4), whereas https://github.com/pydata/xarray/blob/main/ci/requirements/min-all-deps.yml lists h5netcdf=1.3 as the oldest supported version. But, I think versions older than 1.6.4 wouldn't work with the h5netcdf backend since #9509 given the use of this new feature. I'm not sure if you'd rather add a workaround for older versions or bump the minimum supported version.

@kmuehlbauer

Copy link
Copy Markdown
Contributor

@maxrjones EnumType was released with h5netcdf 1.4.0 in October 2024.

@kmuehlbauer

Copy link
Copy Markdown
Contributor

This is also mentioned in a comment in the #9509 PR.

Maybe you need to conditionally import depending on version? I can have a closer look tomorrow.

Comment thread xarray/backends/h5netcdf_.py Outdated
@maxrjones

Copy link
Copy Markdown
Contributor Author

@maxrjones EnumType was released with h5netcdf 1.4.0 in October 2024.

ah, ok thanks for this clarification. It seems we're close, but not quite to the 12 month mark for minimum dependencies

@maxrjones maxrjones changed the title Import EnumType from h5netcdf.core directly Import h5netcdf.core to use EnumType Sep 23, 2025

@kmuehlbauer kmuehlbauer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @maxrjones , I've made a mental note, to not forget to remove this in October.

@kmuehlbauer kmuehlbauer added the plan to merge Final call for comments label Oct 21, 2025
@dcherian
dcherian merged commit dcd6b0c into pydata:main Oct 27, 2025
33 of 37 checks passed
@maxrjones
maxrjones deleted the update-import branch October 28, 2025 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants