mjml-python
A Python wrapper for MRML (Rust port of MJML).
What it is and what it does
mjml-python wraps the MRML Rust engine to compile MJML (Mailjet Markup Language) email templates directly to HTML within Python, eliminating the need for Node.js, external APIs, or subprocess calls. It ships as pre-built wheels for modern Python versions and major platforms, so installation is straightforward on typical systems.
The package provides a single `mjml2html()` function that accepts MJML markup and optional configuration (fonts, comment stripping, custom icon origins, and include loaders for template composition). It's designed for straightforward use cases—render MJML input to production-ready HTML—without exposing the full MRML configuration surface. No runtime dependencies are required beyond Python itself.
Use it for:
- Generate responsive email HTML from MJML templates in Django or Flask applications without spawning Node.js processes.
- Batch-render email templates in data pipelines or background jobs where subprocess overhead or external API latency is unacceptable.
- Embed MJML compilation directly in email-sending workflows, with custom include loaders to fetch templates from databases or HTTP sources.
- Build email template systems where you want MJML's responsive component model but need the performance and memory efficiency of a compiled engine.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Compiles MJML email templates to HTML at runtime using an embedded Rust engine, without requiring Node.js, external APIs, or subprocesses.
Yes, if you need to render MJML templates in Python without Node.js or external services. The package is actively maintained, has no known vulnerabilities, uses a permissive license, and ships pre-built wheels for standard platforms. The medium install friction is acceptable given the elimination of subprocess or API overhead. Not necessary if you're already using a Node.js-based MJML workflow or don't need MJML's specific template syntax.
Install
mjml-python on PyPI
pip
pip install mjml-pythonuv
uv add mjml-pythonpoetry
poetry add mjml-pythonInstalling mjml-python
Before you install
Medium friction due to compiled wheels, but ABI-3 wheels are pre-built for CPython 3.8+ across major platforms (macOS x86_64/arm64, Linux x86_64/aarch64, Windows), so no compilation is required on typical environments. Active maintenance with a recent release.
License in practice
MIT license (permissive) means you can use, modify, and distribute this package with minimal restrictions, provided you include the license notice.
Quickstart
from mjml import mjml2html
html = mjml2html(
'<mj-body><mj-section><mj-column><mj-text>Hello</mj-text></mj-column></mj-section></mj-body>',
disable_comments=True
)
Requires Python 3.8 or later.
Verify before relying
- Whether the embedded Rust engine maintains full compatibility with the official MJML specification across all template features.
- Performance characteristics and memory usage in production workloads compared to the Node.js baseline mentioned in the description.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 45 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 452,303/month — #6,582 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mjml_python-1.4.1-cp38-abi3-macosx_10_12_x86_64.whl; mjml_python-1.4.1-cp38-abi3-macosx_11_0_arm64.whl; mjml_python-1.4.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; mjml_python-1.4.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; mjml_python-1.4.1-cp38-abi3-musllinux_1_2_aarch64.whl; mjml_python-1.4.1-cp38-abi3-musllinux_1_2_x86_64.whl; mjml_python-1.4.1-cp38-abi3-win_amd64.whl
Tags
More HTML packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
lxmllxml provides Python bindings to libxml2 and…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
MarkdownConverts Markdown text to HTML using a Python…
permissive · top 1,000 on PyPI
mjmlConverts MJML (a markup language for responsive…
permissive · top 15,000 on PyPI
mrmlConverts MJML (a markup language for responsive…
unclear · top 5,000 on PyPI
django-mjmlProvides a Django template tag that compiles…
permissive · top 15,000 on PyPI
htbuilderhtbuilder lets you construct HTML strings using…
permissive · top 15,000 on PyPI
emailsBuild and send HTML and plain-text emails with…
permissive · top 15,000 on PyPI
django-post_officeDjango Post Office queues and sends emails…
permissive · top 15,000 on PyPI
minify-htmlMinifies HTML, JavaScript, and CSS in a single…
permissive · top 5,000 on PyPI
django-sendgrid-v5Provides a Django email backend that sends…
permissive · top 15,000 on PyPI
hyperscriptHyperscript lets you generate HTML markup…
permissive · top 15,000 on PyPI
html5taggerGenerates HTML5 markup programmatically using…
permissive · top 5,000 on PyPI