$npx skillfedfor your agent

pydantic-xml

pydantic xml extension

Worth itPyPI LibrariesReleased Aug 20262.5M downloads / moUnlicensePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pydantic_xml-2.21.1-py3-none-any.whl
v2.21.1 · released 2026-08-08 · Python >=3.8 · 2 runtime deps: pydantic, pydantic-core

Yes. Low install friction, active maintenance, no known vulnerabilities, permissive license, and solid popularity (top 5000 PyPI packages). Install if you need to work with XML in a pydantic-native way; skip only if you have no XML in your project or prefer a different serialization format.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low friction: pure Python wheel with only pydantic and pydantic-core as runtime dependencies.
  • Active maintenance with a release 6 days ago; repository shows steady activity and 255 stars.

License · maintenance · safety

Unlicense (permissive) — Licensed under Unlicense (permissive public domain), so you can use, modify, and distribute freely without restriction or attribution requirement.

last release 2026-08-08 (6 days) · last repo commit 2026-08-08 · 255 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,507,149 downloads/mo, #3,035 on PyPI

Verify before relying

pip install pydantic-xml

from pydantic_xml import BaseXmlModel, attr, element
from typing import List

class Product(BaseXmlModel):
    status: str = attr()
    title: str

class Company(BaseXmlModel):
    trade_name: str = attr(name='trade-name')
    products: List[Product] = element(tag='product')

xml_str = '<Company trade-name="SpaceX"><product status="active">Starship</product></Company>'
company = Company.from_xml(xml_str)
xml_out = company.to_xml()
  • Whether lxml is required or optional; fact sheet lists it as a supported parser but does not clarify if it's a hard dependency.
  • Performance characteristics when handling large XML documents or deeply nested structures.
Same gist for agents: .md · .json

What it is and what it does

Pydantic-xml is a pydantic extension that bridges Python dataclass-like models and XML documents. It lets you declare a pydantic model with fields that map to XML attributes (via `attr()`), child elements (via `element()`), or text content, then automatically serialize instances to XML or deserialize XML back into typed Python objects. The binding is declarative and integrates with pydantic's type system, so you get validation, optional fields, unions, generics, and computed fields all working with XML.

The package supports both pydantic v1 and v2, works with standard library `xml.etree.ElementTree` or the faster lxml parser, and handles Python collection types like List, Dict, Set, and Tuple. It does not support pydantic dataclasses or callable discriminators in unions. Most use cases involve APIs or configuration files where XML is the wire format but you want to work with typed Python objects.

Use it for

  • Parse XML configuration files into typed pydantic models with validation, then serialize changes back to XML.
  • Consume SOAP or XML-based REST APIs by mapping XML responses to pydantic models automatically.
  • Build XML document generators where you define the structure as a pydantic model and serialize instances to XML.
  • Migrate legacy XML-based systems to Python by treating XML as a serialization format for modern typed models.
  • Validate and transform XML data pipelines using pydantic's rich validation and computed field features.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

Low install friction, active maintenance, no known vulnerabilities, permissive license, and solid popularity (top 5000 PyPI packages). Install if you need to work with XML in a pydantic-native way; skip only if you have no XML in your project or prefer a different serialization format.

Install

pydantic-xml on PyPI

Before you install

Low friction: pure Python wheel with only pydantic and pydantic-core as runtime dependencies. Active maintenance with a release 6 days ago; repository shows steady activity and 255 stars.

License in practice

Licensed under Unlicense (permissive public domain), so you can use, modify, and distribute freely without restriction or attribution requirement.

Quickstart

pip install pydantic-xml

from pydantic_xml import BaseXmlModel, attr, element
from typing import List

class Product(BaseXmlModel):
    status: str = attr()
    title: str

class Company(BaseXmlModel):
    trade_name: str = attr(name='trade-name')
    products: List[Product] = element(tag='product')

xml_str = '<Company trade-name="SpaceX"><product status="active">Starship</product></Company>'
company = Company.from_xml(xml_str)
xml_out = company.to_xml()

Verify before relying

  • Whether lxml is required or optional; fact sheet lists it as a supported parser but does not clarify if it's a hard dependency.
  • Performance characteristics when handling large XML documents or deeply nested structures.

Package facts

LicenseUnlicense permissive
Python supportSupports the current Python release >=3.8
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
pydanticpydantic-core
MaintenanceActively maintained 6 days since the last release
Last repo commit
First released
Downloads2,507,149 / month, #3,035 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableFramework :: PydanticFramework :: Pydantic :: 1Framework :: Pydantic :: 2Intended Audience :: DevelopersLicense :: OSI ApprovedLicense :: Public DomainNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTopic :: Text Processing :: Markup :: XMLTyping :: Typed

Evidence: pydantic_xml-2.21.1-py3-none-any.whl

Tags

Capabilities
pydantic xml serializationxml to pydantic modelxml deserialization pythonpydantic xml bindingxml element attribute mappingconvert xml to python objects
Topics
xml-serializationpydantic-extension
PyPI keywords
pydanticxmlserializationdeserializationlxml

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “pydantic xml serialization”

  • pydantic-xmlPydantic-xml adds XML serialization and deserialization to pydantic…
  • xsdata-pydanticGenerates pydantic models from XML and JSON schemas, then parses and…
  • fhir-coreProvides Pydantic V2-based abstract base classes and primitive…

Give your agent the search over MCP, or paste the wish link into any chat.

More Libraries packages

urllib3 Worth it
PyPI · Libraries · released May 2026

urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.

MITpure Python · 3.10+
1.8Bdownloads / mo
requests Worth it
PyPI · Libraries · released May 2026

Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.

Apache-2.0pure Python · 3.10+
1.8Bdownloads / mo
pluggy Worth it
PyPI · Libraries · released May 2025

Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.

Install it if you're building an extensible application or framework.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
python-dateutil Worth it
PyPI · Libraries · released Mar 2024

Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.

Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.

Apache-2.0pure Python
1.2Bdownloads / mo
six With conditions
PyPI · Libraries · released Dec 2024

Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.

MITpure Python
1.2Bdownloads / mo
pytest Worth it
PyPI · Libraries · released Jun 2026

pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.

MITpure Python · 3.10+
1.1Bdownloads / mo

See also xsdata-pydantic · py-serializable · xml-python · PyXB-X · et-xmlfile · py-avro-schema · maec · pyangbind · xsdata · pydantic-scim