meld3

raw JSON →
2.0.1 verified Fri May 01 auth: no python deprecated

Unmaintained templating system used by old versions of Supervisor. Current version is 2.0.1. No recent releases; the project is effectively deprecated.

pip install meld3
error ModuleNotFoundError: No module named 'meld3'
cause meld3 is not installed, or trying to import from a virtual environment where pip install did not run.
fix
Run pip install meld3
error AttributeError: module 'meld3' has no attribute 'parse_xml'
cause Old code using import meld3 and calling meld3.parse_xml, but parse_xml is a top-level function.
fix
Use from meld3 import parse_xml instead.
deprecated meld3 is effectively unmaintained and deprecated. It is only used internally by old versions of Supervisor. Consider switching to alternatives like Jinja2 or Tempita.
fix Replace with Jinja2 or another modern templating engine.
gotcha meld3 parses XML templates and uses Genshi-like attribute directives (py:attrs, py:content, etc.). It does NOT support Genshi's full syntax; only a limited subset.
fix Use only the documented directives: py:content, py:attrs, py:replace, py:if, py:for, py:strip.

Parse an XML template with Genshi-like directives and render it with context data.

from meld3 import parse_xml
template = '<html xmlns:py="http://genshi.edgewall.org/"><body><h1 py:content="title">Title</h1></body></html>'
tree = parse_xml(template)
tree.expand({'title': 'Hello, World!'})
result = tree.write()
print(result)