xsdata-pydantic is a plugin for xsdata that generates Pydantic models from XML Schema (XSD) documents. It provides a code generator producing Python classes with Pydantic v1 or v2 support, data binding, and serialization. The current version is 24.5, compatible with Python >=3.8 and xsdata >=22.10. Release cadence is irregular.
pip install xsdata-pydanticVerified import paths — ran on the pinned version, not inferred.
Install the plugin, generate Pydantic models using xsdata CLI with the extension, then parse and serialize XML data.
Use 'from xsdata_pydantic import PydanticV1Extension' and pass it as the extension.
Use XmlSerializer from xsdata to serialize to XML, or convert to dict/list manually.
Upgrade to Python 3.9 or later.