Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Downloads/month Build status License Supported Python versions Code coverage ReadTheDocs status

pydantic-xml is a pydantic extension providing model fields xml binding and xml serialization / deserialization. It is closely integrated with pydantic which means it supports most of its features.

Features

  • pydantic v1 / v2 support

  • flexable attributes, elements and text binding

  • python collection types support (Dict, TypedDict, List, Set, Tuple, …)

  • Union type support

  • pydantic generic models support

  • pydantic computed fields support

  • lxml xml parser support

  • xml.etree.ElementTree standard library xml parser support

What is not supported?

Getting started

The following model fields binding:

class Product(BaseXmlModel):
    status: Literal['running', 'development'] = attr()  # extracted from the 'status' attribute
    launched: Optional[int] = attr(default=None)  # extracted from the 'launched' attribute
    title: str  # extracted from the element text


class Company(BaseXmlModel):
    trade_name: str = attr(name='trade-name')  # extracted from the 'trade-name' attribute
    website: HttpUrl = element()  # extracted from the 'website' element text
    products: List[Product] = element(tag='product', default=[])  # extracted from the 'website' element

defines the XML document:

<Company trade-name="SpaceX">
    <website>https://www.spacex.com</website>
    <product status="running" launched="2013">Several launch vehicles</product>
    <product status="running" launched="2019">Starlink</product>
    <product status="development">Starship</product>
</Company>

See documentation for more details.

Metadata

Release files for pydantic-xml 2.0.0a2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydantic-xml 2.0.0a2
File Size Uploaded
pydantic_xml-2.0.0a2.tar.gz 18.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydantic-xml 2.0.0a2
File Interpreter ABI Platform
pydantic_xml-2.0.0a2-py3-none-any.whl Python 3 none any Details

Total release size: 46.1 kB

Release files / pydantic_xml-2.0.0a2.tar.gz

Download URL pydantic_xml-2.0.0a2.tar.gz
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
90fddd97aeeef51b0668ff599464a3d50a6a075adbcad2f33f72a3907dee8b98
BLAKE2b-256 checksum
How to use checksums
93fa87a3a369977cbfce7bdb29fa2cff00763ecc3b5ba2274f2ebadd00ffba7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1041-azure

Release files / pydantic_xml-2.0.0a2-py3-none-any.whl

Download URL pydantic_xml-2.0.0a2-py3-none-any.whl
Size 27.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9366ed77b419bb358d06cdb64b7fb52e47e9d1bd5407cf47b6069f6342dfec63
BLAKE2b-256 checksum
How to use checksums
e47c81914c6e9419bf17ef1b5b40f2ae8eca79ab7e2ba8379544bfe1687a3c12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1041-azure

Release history Release notifications | RSS feed

2.21.0

2 release files

2.20.0

2 release files

2.19.0

2 release files

2.18.0

2 release files

2.17.3

2 release files

2.17.2

2 release files

2.17.1

2 release files

2.17.0

2 release files

2.16.0

2 release files

2.15.0

2 release files

2.14.3

2 release files

2.14.2

2 release files

2.14.1

2 release files

2.13.0

2 release files

2.12.1

2 release files

2.12.0

2 release files

2.11.0

2 release files

2.9.2

2 release files

2.9.1

2 release files

2.9.0

2 release files

2.8.1

2 release files

2.8.0

2 release files

2.7.0

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.4

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

This release

2.0.0a2 This release

2 release files

1.0.0

2 release files

0.7.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page