--- id: dict2xml version: "1.7.8" license: MIT license_treatment: permissive maintenance: aging --- # dict2xml — Small utility to convert a python dictionary into an XML string License: permissive · Maintenance: aging · Downloads: 1.1M/mo ## What it is and what it does dict2xml is a lightweight utility that serializes Python dictionaries into XML strings. It takes a dictionary as input and produces formatted XML output with control over element wrapping, indentation, and newline handling. The library offers a simple functional interface via dict2xml() and a more flexible Converter class for advanced use cases like custom key sorting, self-closing tags for specific values, and control over how arrays are wrapped. The package has no external runtime dependencies, making it quick to install and integrate. It supports Python 3.5+ and has been in production use since 2012. Key limitations include no support for XML attributes, custom data type hooks, or XML declarations—it focuses on straightforward dictionary-to-XML conversion for data serialization tasks. Use it for: - Serialize application configuration dictionaries to XML for legacy systems or interoperability. - Convert API response data structures into XML format for downstream processing or storage. - Generate XML reports or data exports from Python data structures in batch jobs. - Transform nested Python objects into XML for SOAP or XML-RPC communication. - Export structured data from Python applications to XML-based workflows or tools. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Converts Python dictionaries into XML strings with configurable formatting, wrapping, and tag behavior. Yes. The package is lightweight, dependency-free, stable, and carries no known vulnerabilities. Install it if you need straightforward dictionary-to-XML conversion. Skip it if you require XML attributes, namespaces, or CDATA handling—those are documented limitations, not bugs. ## Install pip install dict2xml uv add dict2xml poetry add dict2xml ## Installing dict2xml Before you install: No runtime dependencies and a pure-Python wheel distribution make installation straightforward. The package is aging (last release 212 days ago) but remains actively maintained; the repository is not archived and the codebase is stable. License in practice: MIT license permits commercial use, modification, and distribution with minimal restrictions, making it suitable for most projects. Quickstart: from dict2xml import dict2xml data = {'a': 1, 'b': [2, 3]} result = dict2xml(data, wrap="root", indent=" ") Verify before relying: - Whether the package handles deeply nested structures or very large dictionaries without performance degradation. - Support for XML namespaces, attributes, or CDATA sections beyond what the description explicitly covers. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 1.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags dictionary to xml conversion, python dict xml serialization, convert dict to xml string, xml generation from python, dict xml formatter, python data to xml, xml-serialization, data-conversion [View on SkillFed](https://skillfed.io/packages/dict2xml) · [View on PyPI](https://pypi.org/project/dict2xml/)