Python Setup
pyfory provides binary Object Serialization and Row Format. Fory IDL can also
generate Python models and gRPC companions. The package supports Python 3.8 and
later on Linux, macOS, and Windows.
Verify the Toolchain
python --version
python -m pip --version
Object Serialization
Install the released package:
python -m pip install pyfory==1.5.0
Run an xlang round trip:
from dataclasses import dataclass
import pyfory
@dataclass
class User:
name: str
age: pyfory.Int32
fory = pyfory.Fory(xlang=True, ref=True)
fory.register(User, type_id=1)
data = fory.serialize(User("Alice", 30))
decoded = fory.deserialize(data)
print(decoded)
Use xlang mode for cross-language data. Use native mode for Python-only objects, including Python callables and serialization hooks. Continue with the Python guide, configuration, and type registration.
Other Capabilities
- Row Format provides zero-copy field access for trusted analytical data. See Python Row Format.
- Fory IDL and Compiler generates Python models and registration helpers. See Compiler Getting Started and the Python generated-code guide.
- Fory gRPC uses grpcio transports with Fory-encoded messages. See Python gRPC.