msgspec-xml
XML Serialization/Deserialization using msgspec.
Installation
pdm add msgspec-xml
Usage
from decimal import Decimal
from typing import Annotated
from msgspec import Struct
from msgspec_xml import decode, encode, Attribute, Value, Wrapper
class Price(Struct):
currency: Annotated[str, Attribute()]
cost: Annotated[Decimal, Value()]
class Book(Struct, rename="pascal"):
title: str # Implied Element class
prices: Annotated[list[Price], Wrapper(wrapper="Prices", tag="Price")]
book = Book(
title="Example Book",
prices=[
Price(currency="USD", cost=Decimal("3.99")),
Price(currency="GBP", cost=Decimal("1.51")),
],
)
xml = encode(book)
# <Book>
# <Title>Example Book</Title>
# <Prices>
# <Price currency="USD">3.99</Price>
# <Price currency="GBP">1.51</Price>
# </Prices>
# </Book>
decoded = decode(xml, type_=Book)
assert decoded == book
Socials
Metadata
Release files for msgspec-xml 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| msgspec_xml-0.4.0.tar.gz | 88.0 kB | Without provenance | Details for msgspec_xml-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| msgspec_xml-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for msgspec_xml-0.4.0-py3-none-any.whl |
Total release size: 95.4 kB
Release files / msgspec_xml-0.4.0.tar.gz
| Download URL | msgspec_xml-0.4.0.tar.gz |
|---|---|
| Size | 88.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2aad36a8957499e2cbd895a581a0cd826974c3703c8b516f52488edf340b90ad
|
|
BLAKE2b-256 checksum How to use checksums |
ad38bb88a221ab5ea710ba2c5cce771737b21d71333029a637efeb96b34a3d30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / msgspec_xml-0.4.0-py3-none-any.whl
| Download URL | msgspec_xml-0.4.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2b06b1930b96513e892bc7fbaeaf3ef65512fe9ccfa764597be9b11ac268f29
|
|
BLAKE2b-256 checksum How to use checksums |
5bdf3567189383f56a8c6419d288601dee6da653af5e394add0356f82929d7c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for msgspec-xml 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.