mjml
Python implementation for MJML - a framework that makes responsive-email easy
What it is and what it does
mjml is an unofficial Python port of the MJML markup language, a framework designed to simplify writing responsive emails. It translates MJML (an XML-like dialect) directly to HTML without needing Node.js or a JavaScript runtime. The package is implemented in pure Python and can be used either as a library (via the mjml_to_html function) or as a command-line tool.
The library was created to avoid deploying Node.js in production and to sidestep the security audit burden of the 220+ npm packages required by the official JavaScript implementation. It trades some feature completeness for a lightweight, Python-native alternative: it handles basic components like images, tables, and groups, but does not yet implement all MJML features (minification, beautification, validation). It is actively maintained and deployed in light production scenarios.
Use it for:
- Generate responsive email HTML from MJML templates in a Python web application without Node.js overhead.
- Build email templates programmatically using MJML markup in Django or Flask projects.
- Convert MJML files to HTML via CLI for integration into build pipelines or batch email generation.
- Avoid the security and dependency audit burden of npm packages by using a pure-Python email template engine.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts MJML (a markup language for responsive emails) to HTML without requiring Node.js, using pure Python.
Yes, if you need to generate responsive emails from MJML templates in Python and want to avoid Node.js. The package is actively maintained, has low install friction, carries a permissive MIT license, and has no known vulnerabilities. Be aware that it implements a subset of MJML features and lags behind the JavaScript version; check the documentation to confirm your required components are supported before committing to production use.
Install
mjml on PyPI
pip
pip install mjmluv
uv add mjmlpoetry
poetry add mjmlInstalling mjml
Before you install
Low friction: pure Python wheel with five common dependencies (beautifulsoup4, jinja2, dotmap, docopt-ng, typing_extensions). Actively maintained with recent releases; last commit 2026-03-30.
License in practice
MIT license (permissive) — you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install mjml
from mjml import mjml_to_html
with open('foo.mjml', 'rb') as mjml_fp:
result = mjml_to_html(mjml_fp)
html: str = result.html
Requires Python 3.9 or later.
Verify before relying
- Feature parity with the JavaScript mjml v4 implementation — the description notes the Python version lags behind and lacks minification, beautification, and validation.
- Which MJML components are currently implemented beyond 'Hello World', images, tables, and groups.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — beautifulsoup4, dotmap, docopt-ng, jinja2, typing_extensions |
| Maintenance | actively maintained — 230 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 465,237/month — #6,510 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mjml-0.12.0-py3-none-any.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
django-mjmlProvides a Django template tag that compiles…
permissive · top 15,000 on PyPI
mjml-pythonCompiles MJML email templates to HTML at…
permissive · top 15,000 on PyPI
mrmlConverts MJML (a markup language for responsive…
unclear · top 5,000 on PyPI
brancaBranca generates HTML and JavaScript pages from…
permissive · top 5,000 on PyPI
emailsBuild and send HTML and plain-text emails with…
permissive · top 15,000 on PyPI
markdown2Converts Markdown text to HTML using a fast,…
permissive · top 5,000 on PyPI
html5taggerGenerates HTML5 markup programmatically using…
permissive · top 5,000 on PyPI
mailjet-restA Python wrapper for the Mailjet Email API that…
permissive · top 5,000 on PyPI
jsminMinifies JavaScript code by removing…
permissive · top 5,000 on PyPI
vbuildCompiles Vue single-file components (*.vue) to…
permissive · top 15,000 on PyPI