xsdata-pydantic
xsdata pydantic plugin
What it is and what it does
xsdata-pydantic bridges XML/JSON schema definitions and pydantic's type system. It uses xsdata to parse XSD, WSDL, and DTD schemas, then generates pydantic BaseModel classes that represent the document structure. Once generated, you can parse XML or JSON into typed Python objects and serialize them back, gaining IDE autocomplete, runtime validation, and type checking throughout your workflow.
The package is typically used in two phases: first, run the xsdata CLI to generate model files from a schema; then, import those models and use XmlParser or serializers from xsdata-pydantic.bindings to read and write documents. It's designed for developers who work with structured data formats and want the safety and ergonomics of pydantic's validation without manually writing model classes.
Use it for:
- Parse RSS/Atom feeds or SOAP responses into typed objects with validation.
- Generate Python models from enterprise WSDL or XSD files for API integration.
- Serialize Python dataclasses back to XML with schema-aware structure and attributes.
- Build data pipelines that consume JSON or XML from external sources with type safety.
- Validate incoming XML documents against a schema before processing in your application.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates pydantic models from XML and JSON schemas, then parses and serializes XML/JSON documents as typed Python objects using those models.
Yes. Low install friction, active maintenance, no known vulnerabilities, permissive MIT license, and broad Python version support. Solves a real problem for anyone working with XML schemas or WSDL in Python and wanting pydantic's validation and type safety. Suitable for production use.
Install
xsdata-pydantic on PyPI
pip
pip install xsdata-pydanticuv
uv add xsdata-pydanticpoetry
poetry add xsdata-pydanticInstalling xsdata-pydantic
Before you install
Low friction install with only pydantic and xsdata as runtime dependencies. Actively maintained with recent commits and support for current Python versions.
License in practice
MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions.
Quickstart
pip install xsdata-pydantic
from xsdata_pydantic.bindings import XmlParser
parser = XmlParser()
result = parser.parse(open('document.xml'), Rss)
print(result.channel.item[0].title)
Requires xsdata CLI to generate pydantic models from XSD/WSDL schemas first; Python 3.8 or later.
Verify before relying
- Whether generated models handle deeply nested or recursive schema structures reliably.
- Performance characteristics when parsing very large XML or JSON documents.
- Compatibility with all pydantic v2 features and validation modes.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — pydantic, xsdata |
| Maintenance | actively maintained — 828 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 313,198/month — #7,719 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: xsdata_pydantic-24.5-py3-none-any.whl
Keywords: xsd, wsdl, schema, dtd, binding, xml, json, dataclasses, generator, cli, pydantic
Tags
More Code Generators packages
Proto Plus wraps protocol buffers to provide…
permissive · top 1,000 on PyPI
CythonCython is a source code translator that…
permissive · top 1,000 on PyPI
asttokensAnnotates Python abstract syntax trees with the…
permissive · top 1,000 on PyPI
beartypeBeartype is a runtime type checker that…
permissive · top 1,000 on PyPI
llvmlitellvmlite provides a lightweight Python binding…
permissive · top 1,000 on PyPI
astorastor converts Python abstract syntax trees…
permissive · top 5,000 on PyPI
pydantic-xmlPydantic-xml adds XML serialization and…
permissive · top 5,000 on PyPI
xsdataxsdata generates Python dataclasses from XML…
permissive · top 5,000 on PyPI
PyXB-XPyXB-X generates Python classes from XMLSchema…
permissive · top 15,000 on PyPI
xml-pythonConverts XML documents into Python objects,…
copyleft · top 5,000 on PyPI
xmlschemaValidates XML documents against XSD schemas and…
permissive · top 5,000 on PyPI
dydanticDynamically generates Pydantic models from JSON…
permissive · top 5,000 on PyPI
py-avro-schemaGenerates Apache Avro schemas from Python…
permissive · top 15,000 on PyPI
pydantic-factoriesGenerates mock data objects that conform to…
permissive · top 15,000 on PyPI
pydantic_yamlPydantic-YAML adds YAML serialization and…
permissive · top 5,000 on PyPI