Skip to content

Python Bindings (hipopy)

hipopy provides full Python access to the HIPO4 library via pybind11, with NumPy and Awkward Array integration.

Installation

Dependencies

Package Required Purpose
pybind11 Yes C++/Python bridge (build time)
numpy Yes Array interface
awkward No Ragged array support (read_bank)

Building

pip install pybind11 numpy
meson setup build -Dpython_bindings=true
ninja -C build

Verifying

import hipopy
print(hipopy.Schema)  # <class 'hipopy._hipo.Schema'>

Module Structure

hipopy/
  __init__.py       # Re-exports, HipoFile, open()
  _hipo.so          # C++ extension module (pybind11)
  _awkward.py       # read_bank() - Awkward Array integration
  _batch.py         # read_columns() - flat NumPy batch reading

Type Mapping

HIPO Type Character C++ Type NumPy dtype Python Type
Byte B int8_t int8 int
Short S int16_t int16 int
Int I int32_t int32 int
Float F float float32 float
Double D double float64 float
Long L int64_t int64 int

Features

  • Full library coverage -- all C++ classes available from Python
  • NumPy integration -- zero-copy and copy array access for bank columns
  • Awkward Array support -- ragged per-event arrays via read_bank()
  • Batch reading -- flat concatenated arrays via read_columns()
  • High-level API -- hipopy.open() context manager for easy iteration
  • Multi-file -- Chain, InputSource, and Fusion for multi-file workflows
  • Expression parsing -- Parser for math expressions and row filtering

Next Steps