# untangle
**Repository Path**: mirrors_stchris/untangle
## Basic Information
- **Project Name**: untangle
- **Description**: Converts XML to Python objects
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 0
- **Created**: 2022-01-07
- **Last Updated**: 2026-07-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# untangle
[](https://github.com/stchris/untangle/actions)
[](https://pypi.python.org/pypi/untangle)
[Documentation](http://readthedocs.org/docs/untangle/en/latest/)
* Converts XML to a Python object.
* Siblings with similar names are grouped into a list.
* Children can be accessed with `parent.child`, attributes with `element['attribute']`.
* You can call the `parse()` method with a filename, an URL or an XML string.
* Substitutes `-`, `.` and `:` with `_` `` can be accessed with `foobar.foo_bar`, `` can be accessed with `foo_bar_baz` and `` can be accessed with `foo_bar.foo_baz`
## Installation
With pip:
```bash
pip install untangle
```
## Usage
(See and run examples.py or this blog post: [Read XML painlessly](http://pythonadventures.wordpress.com/2011/10/30/read-xml-painlessly/) for more info)
```python
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
```
allows it to be navigated from the `untangle`d object like this:
```python
obj.root.child['name'] # u'child1'
```
## Development
`untangle` uses [uv](https://docs.astral.sh/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