skillfed

mjml-python

A Python wrapper for MRML (Rust port of MJML).

mjml-python v1.4.1 452.3K downloads/30d#6,582 on PyPI108
Permissive license Active released

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-python

uv

uv add mjml-python

poetry

poetry add mjml-python

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyProgramming Language :: Rust

Tags

mjml email template compilerrender mjml to html pythonemail template enginemjml without nodejsresponsive email buildermjml html conversionemail markup language
email-templatesmjmlrust-binding

More HTML packages