graphrecords-pyo3-interop
Interoperability layer for passing GraphRecords types between independent PyO3 extension modules.
Overview
PyO3's #[pyclass] stores type objects in static storage, meaning each compiled extension module gets its own copy. When two separate PyO3 extensions try to share a type like GraphRecord, Python sees them as distinct types, breaking compatibility (PyO3#1444).
This crate provides a workaround by serializing GraphRecord to bytes (via bincode) when crossing extension boundaries, allowing external Rust-based Python extensions to accept and return GraphRecord objects from the main graphrecords package.
Key Components
PyGraphRecord- A wrapper aroundGraphRecordimplementing PyO3'sFromPyObjectandIntoPyObjecttraits via binary serialization- Type Re-exports - Common Python binding types (
PyNodeIndex,PyEdgeIndex,PyGroup,PyAttributes, etc.)
Usage
use PyGraphRecord;
use *;