xo-umbrella2/xo-pyarena
Roland Conybeare 03a542b4dd
Some checks failed
cmake-docker / cmake-build (clang, clang++) (push) Failing after 13m12s
cmake-docker / cmake-build (gcc, g++) (push) Failing after 13m7s
CI / smoke-test (push) Has been cancelled
xo-cmake: generate python module #includes [HYGIENE]
2026-09-13 12:00:21 -04:00
..
cmake xo-pyarena: new subsystem, pybind xo-arena [PYBIND] 2026-09-06 23:55:32 -04:00
include/xo/pyarena xo-pyarena: wrap MemorySizeInfo directly [REFACTOR] 2026-09-10 09:35:42 -04:00
src/pyarena xo-cmake: generate python module #includes [HYGIENE] 2026-09-13 12:00:21 -04:00
.gitignore xo-pyarena: new subsystem, pybind xo-arena [PYBIND] 2026-09-06 23:55:32 -04:00
CMakeLists.txt standalone pybind subsystems make xo-python [PYBIND] [BUILD] 2026-09-07 19:46:43 -04:00
README.md move python extensions into xo namespace [REFACTOR] 2026-09-13 11:51:33 -04:00

python bindings for c++ arena allocator (xo-arena)

Exposes xo-arena's configuration types to python: ArenaConfig, AllocHeaderConfig, and the AllocHeader word the latter describes.

Getting Started

build + install dependencies

build + install

$ cd xo-pyarena
$ mkdir build
$ cd build
$ INSTALL_PREFIX=/usr/local  # or wherever you prefer, e.g. ~/local
$ cmake \
    -DCMAKE_MODULE_PATH=${INSTALL_PREFIX}/share/cmake \
    -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} \
    -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} ..
$ make
$ make install

Examples

From an umbrella build, xo-python puts every xo pybind module on PYTHONPATH:

$ .build/xo-python
>>> import xo.arena as mm
>>> mm.ArenaConfig(name="scratch", size=64*1024)
<ArenaConfig name='scratch' size=65536 hugepage_z=2097152 store_header_flag=False debug_flag=False>
>>> mm.AllocHeaderConfig()
<AllocHeaderConfig tseq_bits=24 age_bits=8 size_bits=32 guard_z=0>

See xo-pyfacet/examples/flywheel_pretty.py for these configs in use.