xml-python is a library for making Python objects from XML, designed to parse XML nodes using decorated functions. Last updated in January 2021 (v0.4.3), the project appears to be unmaintained with no public documentation beyond its minimal PyPI description.
Install & Compatibility
Where this runs
tested against v0.4.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.4MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
from xml_python import Builder
from xml_python import Element
from xml_python import ElementTree
This quickstart demonstrates how to define a Python object that maps to an XML structure using `xml-python`'s decorator-based parsing. It defines a `MyNodeObject` class and a `parse_root` function decorated to handle the 'root' XML tag, extracting data from its 'title' and 'text' child nodes.
from xml_python import xml_objects
xml_data = """
<root>
<title>This is a title</title>
<text>This is some text</text>
</root>
"""
# Define a Python class to represent your XML structure
class MyNodeObject(xml_objects.XMLObject):
pass
# Use a decorator to associate the parser function with the 'root' tag
@xml_objects.node_parser(MyNodeObject, 'root')
def parse_root(parser, node):
# Extract data from child nodes
parser.title = node.find('title').text
parser.text = node.find('text').text
# Parse the XML string into the Python object
root_object = xml_objects.parse_string(xml_data)
print(f"Parsed Title: {root_object.title}")
print(f"Parsed Text: {root_object.text}")
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.