skillfed

xsdata-pydantic

xsdata pydantic plugin

xsdata-pydantic v24.5 313.2K downloads/30d#7,719 on PyPI89
Permissive license MIT Active released

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-pydantic

uv

uv add xsdata-pydantic

poetry

poetry add xsdata-pydantic

Installing 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

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Code GeneratorsTopic :: Text Processing :: Markup :: XML

Tags

xml to pydantic model generatorjson schema binding pydanticxsd code generationxml parsing with type hintsschema-driven data bindingxml serialization pydanticwsdl to python models
schema-bindingcode-generationxml-json

More Code Generators packages