skillfed

dicttoxml

Converts a Python dictionary or other native data type into a valid XML string.

dicttoxml v1.7.16 2.3M downloads/30d#3,167 on PyPI385
Copyleft 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) Abandoned released

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 dicttoxml

uv

uv add dicttoxml

poetry

poetry add dicttoxml

Installing 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

dict to xml conversionpython dictionary xml serializationdata structure to xmljson to xml converterxml generation from python objects
serializationxml-generation

More Markup packages