Untangle
Converts XML to Python objects
Install / Use
/learn @stchris/UntangleREADME
untangle
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
- Converts XML to a Python object.
- Siblings with similar names are grouped into a list.
- Children can be accessed with
parent.child, attributes withelement['attribute']. - You can call the
parse()method with a filename, an URL or an XML string. - Substitutes
-,.and:with_<foobar><foo-bar/></foobar>can be accessed withfoobar.foo_bar,<foo.bar.baz/>can be accessed withfoo_bar_bazand<foo:bar><foo:baz/></foo:bar>can be accessed withfoo_bar.foo_baz
Installation
With pip:
pip install untangle
Usage
(See and run <a href="https://github.com/stchris/untangle/blob/main/examples.py">examples.py</a> or this blog post: Read XML painlessly for more info)
import untangle
obj = untangle.parse(resource)
resource can be:
- a URL
- a filename
- an XML string
Running the above code and passing this XML:
<?xml version="1.0"?>
<root>
<child name="child1"/>
</root>
allows it to be navigated from the untangled object like this:
obj.root.child['name'] # u'child1'
Development
untangle uses uv for builds and virtualenv management:
$ uv sync
Run tests:
$ uv run pytest
Run linter:
$ uv run ruff check .
Run formatter checks:
$ uv run ruff format --check
Run type hint checks:
$ uv run ty check .
Changelog
see CHANGELOG.md
Related Skills
node-connect
349.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
109.7kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
109.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
349.7kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
