mjml-python is a Python implementation and wrapper around the high-performance Rust MJML engine MRML. It allows compiling MJML markup into responsive HTML without requiring a Node.js runtime, external API calls, or subprocesses. The current version is 0.12.0. Releases are published as needed, often reflecting updates to the underlying MJML standard or significant bug fixes.
pip install mjmlVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the core functionality: importing `mjml2html` and passing an MJML string to it. The function returns a `Result` object containing the compiled HTML and any potential errors.
Upgrade to Python 3.9 or newer (e.g., `python -m pip install --upgrade python` if using pyenv, or use a newer system Python). Alternatively, pin `mjml<0.12.0` for older Python versions.
Always install `mjml` directly via `pip install mjml` without pinning `css-inline` to ensure compatible versions are pulled. If issues arise, check your `pip freeze` output for `css-inline` version conflicts.
Upgrade to `mjml==0.11.0` or newer immediately via `pip install --upgrade mjml`.
If you need to remove comments, use the `disable_comments=True` option when calling `mjml2html(mjml_string, disable_comments=True)`.
Install the package using pip: `pip install mjml`.
Ensure you are calling the `mjml2html` function: `from mjml import mjml2html; html = mjml2html(...)`.
Ensure you are on a supported operating system and architecture. For Windows, ensure the Visual C++ Redistributable is installed. Try reinstalling with verbose output to check for build errors: `pip install mjml --verbose`.