et-xmlfile
An implementation of lxml.xmlfile for the standard library
This package has a good security score with no known vulnerabilities.
Community Reviews
Functional but minimal: lacks polish for standalone developer experience
The documentation is sparse at best. You'll find yourself reading the source code or relying on lxml's documentation to understand usage patterns. Type hints are absent, meaning no IDE autocomplete guidance and no mypy validation—surprising for a 2024 release. Error messages are basic standard library exceptions without helpful context about what went wrong in your XML structure.
In practice, it does what it promises: write XML incrementally with low memory overhead. But the DX feels like an afterthought. You're mostly on your own figuring out the correct element nesting, context manager usage, and method chaining patterns. It works well once you understand it, but getting there requires trial and error.
Best for: Projects needing memory-efficient XML generation without external dependencies, especially when migrating from lxml.
Avoid if: You need strong type safety, comprehensive documentation, or are new to incremental XML writing patterns.
Functional but bare-bones XML streaming with minimal guidance
The documentation is essentially non-existent beyond basic docstrings. There's no official guide explaining when to use xmlfile() vs element() context managers, how namespace handling works, or best practices for streaming large datasets. You'll spend time reading the source code or relying on openpyxl's usage (the main consumer of this library) as implicit documentation. Error messages are minimal - you get standard Python exceptions without helpful context about what went wrong in your XML structure.
For day-to-day use, it does what it claims but feels like an internal dependency that was extracted rather than a public API designed for broad consumption. Type hints are present but basic. IDE support works but you won't get helpful completion suggestions for the actual XML writing workflow.
Best for: Projects needing memory-efficient XML generation with pure Python and no external dependencies, especially when migrating from lxml.
Avoid if: You need comprehensive documentation, rich error messages, or are new to incremental XML writing patterns.
Minimal XML streaming library with limited error handling and validation
From a security perspective, the library is concerning. There's minimal input validation - it doesn't sanitize tag names or attribute values, making it trivial to generate malformed XML if you're not careful with user input. Error messages can expose internal state and file paths. The library doesn't implement any protections against XML billion laughs or entity expansion attacks (though it's write-only, so read-side attacks don't apply). There's no documentation on secure usage patterns or input sanitization recommendations.
The dependency footprint is minimal (standard library only), which is good for supply chain risk. However, the project has sparse documentation, limited maintenance activity, and no visible CVE response process. For generating trusted XML where you control all inputs, it works fine. For anything involving user data or requiring XML schema validation, you'll need additional defensive layers.
Best for: Generating XML files in trusted environments where all input data is already validated and sanitized.
Avoid if: You need to process user-supplied data, require XML validation, or need comprehensive error handling for production systems.
Sign in to write a review
Sign In