dicttoxml
Converts a Python dictionary or other native data type into a valid XML string.
What it is and what it does
dicttoxml is a lightweight serializer that takes Python data structures—dicts, lists, tuples, sets, and primitive types—and produces well-formed XML output. It automatically wraps output in an XML declaration and root element, though both can be customized or omitted. The library supports type attributes on elements (which can be disabled), handles datetime objects by converting them to ISO format, treats None as empty XML elements, and provides options for custom root names, encoding specification, and unique ID generation. It has no external dependencies and installs as a pure Python wheel.
The package is straightforward for simple dict-to-XML tasks but is no longer maintained. It works reliably for its core purpose—converting Python objects to XML strings with configurable formatting—but will not receive updates for new Python versions or edge cases. It is best suited for projects that need basic serialization without the overhead of heavier XML libraries and can tolerate a frozen feature set.
Use it for:
- Convert API responses (e.g., JSON fetched from a URL) into XML format for downstream systems that require it.
- Serialize application configuration stored as Python dicts into XML files for consumption by other tools.
- Generate XML snippets for embedding in larger XML documents without writing manual string concatenation.
- Transform Python data structures into XML for data interchange with legacy systems or services.
- Create XML test fixtures from Python dictionaries in unit tests.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts Python dictionaries and other native data types into valid XML strings, handling nested structures, type attributes, and custom root elements.
Yes, if you need simple dict-to-XML conversion and can accept an unmaintained package. The core functionality is stable and has no known vulnerabilities. The copyleft license (GPLv2) is a hard blocker if you cannot open-source your code. For new projects, consider whether a maintained alternative better suits your long-term needs, but for isolated, low-risk use cases, dicttoxml remains functional.
Install
dicttoxml on PyPI
pip
pip install dicttoxmluv
uv add dicttoxmlpoetry
poetry add dicttoxmlInstalling dicttoxml
Before you install
No runtime dependencies and low install friction. However, the package is abandoned—last release was 2022-12-23 and no commits since then. It remains functional for its narrow scope but will not receive bug fixes or maintenance.
License in practice
Licensed under GNU General Public License Version 2, a copyleft license. If you distribute software using dicttoxml, you must make your source code available under the same license terms.
Quickstart
pip install dicttoxml
from dicttoxml import dicttoxml
xml = dicttoxml({'key': 'value'})
print(xml)
Requires Python 3.6 or later; Python 2.x is no longer supported.
Verify before relying
- Whether the package handles edge cases in modern Python versions (3.10+) given its abandoned status since 2022.
- Performance characteristics on very large or deeply nested data structures.
Package facts
| License | GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and… (full text in the JSON record) (copyleft) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,330 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,280,129/month — #3,167 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: dicttoxml-1.7.16-py3-none-any.whl
Tags
More Markup packages
PyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
markdown-it-pyA Python markdown parser that converts markdown…
permissive · top 100 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
et-xmlfileet_xmlfile writes large XML files with minimal…
permissive · top 1,000 on PyPI
tomlkitParses and edits TOML files while preserving…
permissive · top 1,000 on PyPI
docstring-parserParses Python docstrings in ReST, Google,…
permissive · top 1,000 on PyPI
dicttoxml2Converts Python dictionaries and native data…
copyleft · top 15,000 on PyPI
json2xmlConverts JSON data to XML format via Python…
permissive · top 15,000 on PyPI
jxmleaseConverts XML to Python data structures (lists,…
permissive · top 15,000 on PyPI
untangleConverts XML documents into Python objects with…
permissive · top 15,000 on PyPI
xmltodictConverts XML to Python dictionaries and back,…
permissive · top 1,000 on PyPI
javapropertiesReads and writes Java .properties files in both…
permissive · top 5,000 on PyPI
attrdictProvides dictionary-like objects that allow…
permissive · top 5,000 on PyPI
xmlformatterFormats and compresses XML documents by…
permissive · top 15,000 on PyPI
xmljsonConverts XML documents to Python dictionaries…
permissive · top 5,000 on PyPI
http-sfvParses and serializes HTTP Structured Field…
permissive · top 15,000 on PyPI