pyxsdata-core¶
Blazing-Fast Native Rust XML Deserializer for Python
Accelerating dataclasses and Pydantic v2 with PyO3 & quick-xml
What is pyxsdata-core?¶
pyxsdata-core is a dedicated native acceleration library written in Rust using PyO3 and quick-xml. It delivers high-throughput XML deserialization for Python by bypassing the traditional DOM allocation, intermediate node wrapping, and generic Python event pumps used by standard XML parsers.
Instead, pyxsdata-core compiles Python class introspection into an in-memory Rust schema registry. As XML tokens stream through quick-xml's zero-copy pull parser, Rust directly instantiates Python dataclass and Pydantic v2 objects via the CPython C-API at rates exceeding 300,000 objects per second.
flowchart LR
A[XML Document / Bytes] --> B[quick-xml Tokenizer]
B --> C[Rust Schema Registry]
C -->|Direct PyO3 C-API Call| D[Python dataclasses / Pydantic v2]
style C fill:#f96,stroke:#333,stroke-width:2px
Key Highlights¶
- Extreme Performance:
- ~311,000 objects/sec for Pydantic v2 models (7.7x faster than pure Python).
- ~290,000 objects/sec for standard dataclasses (9.5x faster than pure Python, 15x faster than legacy
xsdata). - Native Pydantic v2 & Dataclass Support: Works seamlessly with both standard library
@dataclassmodels andpydantic.BaseModelschemas without configuration shims. - Zero Intermediate DOM Allocation: No
xml.etree.Element,lxml.etree.Element, or intermediate event queues created during the parse pass. - Precompiled Multi-Platform Wheels: Ready-to-use binaries on Linux (x86_64, aarch64), macOS (Apple Silicon, Intel), and Windows (x64) for Python 3.12+.
- Drop-in Acceleration for
pyxsdata: PowersCoreXmlParserandCoreEventHandlerinpyxsdata[core].
At a Glance¶
Documentation Guide¶
- 5-Minute Quickstart: Learn how to deserialize XML into Python models in seconds.
- Installation: Wheel availability, pip/uv installation, and building from source.
- Performance & Benchmarks: Detailed throughput numbers, flamegraphs, and comparative graphs.
- Architecture & Design: Deep dive into the Rust schema engine and PyO3 C-API integration.
- Integration with pyxsdata: How
pyxsdatausespyxsdata-coreas a high-speed engine. - Python API Reference: Complete signature documentation for all exported functions and classes.