What’s new in h5py 3.16

New features

  • Pre-built packages on PyPI are now built with HDF5 2.0 (PR 2750)

  • h5py now marks itself compatible with free-threading Python (PR 2702, PR 2745). There are tests for this (PR 2761), but there may still be bugs. Be cautious about relying on this in critical code.

  • Support for storing NumPy complex numbers in HDF5 files using C99 complex number datatypes (PR 2694). This feature is available with HDF5 library 2.0 or above, so long as the compiler and the build platform implement the relevant C99 features.

    h5py will still convert NumPy complex numbers into an HDF5 compound datatype by default, preserving the behaviour from earlier versions. See Complex numbers for how to use the new datatypes.

  • New attributes filter_ids and filter_names to provide more precise information on the filters set up for a dataset (PR 2792). See Filter pipeline.

  • New h5py.Group.get() arguments to configure external links access properties: elink_mode, elink_swmr and elink_locking (PR 2751).

  • Pre-built Mac & Windows packages on PyPI now bundle zlib 1.3.2 (PR 2808).

Breaking Changes and Deprecations

  • Creating a dataset with neither data nor dtype specified is deprecated. We plan to make this an error in h5py 4.0. Use dtype='f4' to keep the current default (which is different from NumPy’s default).

  • h5py.config().read_byte_strings is deprecated. This has no effect since h5py 3.0, and we plan to get rid of it in 4.0.

Bug fixes

  • Indexing datasets with an array or list of indices is now much faster when selecting many indices (PR 2603).

  • Fixed a memory leak involving the object registry (PR 2783).

  • Fix selecting parts of a multi-dimensional dataset with a boolean array corresponding to the first dimension (PR 2769).

  • Correctly raise errors when trying to write data to a zero-sized dataset or a zero-sized slice (PR 2729).

  • When creating a dataset, the dtype= parameter can now be a TypeID object from the low-level API.

  • Various fixes for safe usage from multiple threads (PR 2795, PR 2794, PR 2764).

  • Trying to store region references in a dataset for object references now raises TypeError instead of discarding information (PR 2790). See Object and Region References for more about references.

  • A list of reference objects can be used to create a dataset (PR 2790).

  • Fix getting filter details for the scaleoffset filter (PR 2781).

  • Better error message when attempting to slice a dataset with None or np.newaxis (PR 2731).

  • Pre-built Windows packages on PyPI now bundle a recent version of zlib (PR 2730).

  • Avoid replacing arr.shape, which will break in some future version of NumPy (PR 2728).

  • Closing files should be slightly faster after a redundant call was removed (PR 2801)

Exposing HDF5 functions

  • H5Scombine_select, H5Smodify_select, and H5Sselect_copy (PR 2603).

Building h5py

  • Fix building against pre-release versions of NumPy (PR 2758).

  • Fix some compiler warnings (PR 2784, PR 2791).

  • The package metadata now requires mpi4py 4.0.0 for MPI builds on Python <= 3.12 (PR 2799). This works around an issue building older mpi4py with recent versions of setuptools. If you are building from source yourself, it may still work with mpi4py 3.x.