Repository navigation
Releases
Releases · shivasankarka/hdf5-mojo
hdf5-mojo v0.3.0 is out!
This release brings the API much closer to h5py: a single create_dataset with keyword options, more dtypes, N-D I/O, and richer attributes and iteration.
Highlights
- More dtypes: int16, uint16, uint32, uint64, float16. Unsigned 32/64-bit datasets are now identified correctly
when reopened. - h5py-style create_dataset: one call takes fillvalue, chunks, maxshape, compression, compression_opts, shuffle,
fletcher32 and track_order. The chunk shape is guessed when chunking is implied but chunks is omitted.
create_dataset_chunked and create_dataset_filtered still work. - N-D I/O: readdtype and read_slice now work for any rank, not just 1D/2D. New read_direct and write_direct
read or write an existing NDArray, for the whole dataset or a List[Slice] selection.
items(), values() and get_value() via the new AttrValue (as_scalar[dtype], as_array[dtype]). - Iteration and ordering: for name in file, for name in group and for name in attrs now work. track_order=True on
File, create_group and create_dataset lists members and attributes in creation order. The default stays name
order, like h5py. - File: now Copyable, with with File(path, mode) as f: support. It closes when the last copy is destroyed, so a
forgotten close() no longer leaks the handle. - Also: len(dset), Dataset.nbytes(), File.create_dataset_with_data(name, NDArray), and H5Object.group()/dataset()
work on temporaries.
Fixes
- read_scalar on an array attribute now raises instead of reading past a one-element buffer.
- All compiler warnings are fixed in the library, tests and demo.
Requirements: Mojo >=1.2.0,<2, HDF5 >=2.1, NuMojo v0.12.0.
Not yet supported:
- strings, bool, enum, compound and complex types
- strided or fancy indexing
- visit, move, copy and links
- dimension scales, virtual datasets, SWMR and MPI
HDF5-bindings v0.2.0
The new of hdf5-mojo: h5py-style HDF5 bindings for Mojo, now with chunking, compression, array-like slicing, and a wider set of supported dtypes.
Highlights
- Chunked & resizable datasets - create_dataset_chunked, maxshape (with unlimited dimensions via -1), and rank-correct resize().
- Built-in filters - gzip compression, shuffle, and fletcher32 checksums via create_dataset_filtered, plus metadata accessors (compression(), shuffle(), filter_names(), etc.).
- Array-like I/O - hyperslab, rectangular slice (read_slice/write_slice, including List[Slice]), and point (read_point/write_point) access on datasets.
- Scalar datasets - explicit create_scalar_dataset/read_scalar/write_scalar, plus h5py-style empty-tuple indexing: dset[()] / dset[()] = value.
- New dtypes - int8 and uint8 are now supported for datasets and attributes, with correct signed/unsigned disambiguation on reopen.
- get_opt(name) on Group/File - non-raising lookup (Optional[H5Object]) mirroring h5py's get(name, default=...) fallback behavior.
- Fill values across contiguous, chunked, and scalar datasets.
- NumPy-flavored backend - array reads/writes now use NuMojo's NDArray under the hood.
- Group.values() for listing member objects, not just names.
- CI on Linux and macOS (GitHub Actions), plus a formatting check.
Rewritten API reference covering the full current surface, and a documented list of known limitations.
Known limitations
No int16/uint16/uint32/uint64, bool, or string types yet; no fancy indexing or multi-block hyperslab selections; no links/traversal (visit, soft/hard/external links); no alternate file drivers, dimension scales, virtual datasets, SWMR, or parallel HDF5. See the README for the full list.
HDF5-bindings v0.1.0
v0.1.0 (Initial release)
Summary
- This first release provides high-level HDF5 bindings for Mojo that let you read and write HDF5 files via a clean, ergonomic API that wraps the HDF5 C library.
- The library is intended for scientific-computation workflows and is designed so you can use the high-level
H5FileandNDArraytypes for most tasks without touching the low-level FFI.
Highlights
- High-level API:
H5Filefor file I/O andNDArrayfor shaped, heap-allocated arrays. - Read support: automatic shape discovery for 1‑D and 2‑D datasets and reading scalar attributes.
- Write support: create files and write 1‑D and 2‑D datasets (row-major) and
require_groupto safely create nested groups. - Automatic HDF5 discovery via
$CONDA_PREFIX(pixi-managed), with optional explicitlib_pathoverride. - Examples included:
examples/read_sample_api.mojo(recommended) andexamples/read_sample_bindings.mojo(low-level).
What’s included in v0.1.0
- High-level Mojo API:
H5File,NDArray(inhdf5/api.mojo) - Low-level FFI wrapper:
HDF5Libbindings (inhdf5/bindings.mojo) - Examples and a small bundled
sample_data.h5 - Installation via
pixi.tomlusing pixi-backend (Checkout README.md) - Supported DType mappings for the common numeric types (
DType.float64,DType.float32,DType.int32,DType.int64)
Known limitations / important notes
- This is an initial, somewhat rough implementation, the API will be refined to be more idiomatic and closer to Python’s
h5py. NDArrayis a simple heap-allocated shaped array now; it will be replaced in future releases with the richerNDArrayfrom NuMojo.write_1d/write_2dwill not overwrite existing datasets, you must choose a new path or recreate the file.- The library defaults to
$CONDA_PREFIX/lib/libhdf5.dylibon macOS (set by pixi). Pass an explicitlib_pathif your HDF5 library is elsewhere.
Roadmap (next items)
- Align the API more closely with
h5pyfor familiarity and ergonomics. - Add a NuMojo-backed array backend for richer numerical operations and interoperability.
- Add examples and tests :)
Acknowledgements
- Huge thanks to the HDF5 maintainers — this project exists because of their work.