Pyfory is the Python implementation of Apache Fory™ — a versatile serialization framework.
It works as a drop‑in replacement for pickle**/**cloudpickle, but with major upgrades:
- Features: Circular/shared reference support, protocol‑5 zero‑copy buffers for huge NumPy arrays and Pandas DataFrames.
- Advanced hooks: Full support for custom class serialization via __reduce__, __reduce_ex__, and __getstate__.
- Data size: ~25% smaller than pickle, and 2–4× smaller than cloudpickle when serializing local functions/classes.
- Compatibility: Pure Python mode for dynamic objects (functions, lambdas, local classes), or cross‑language mode to share data with Java, Go, Rust, C++, JS.
- Security: Strict mode to block untrusted types, or fine‑grained DeserializationPolicy for controlled loading.
[link] [comments]









English (US) ·