{"id":15117204,"url":"https://github.com/mgd020/mjml-python","last_synced_at":"2026-04-10T00:25:53.264Z","repository":{"id":65851193,"uuid":"548876564","full_name":"mgd020/mjml-python","owner":"mgd020","description":"A python library for MJML - a framework that makes responsive-email easy","archived":false,"fork":false,"pushed_at":"2024-03-16T22:13:30.000Z","size":36,"stargazers_count":30,"open_issues_count":2,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-17T00:28:14.752Z","etag":null,"topics":["email","mjml","python","responsive"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mgd020.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://www.buymeacoffee.com/mgd020"]}},"created_at":"2022-10-10T10:20:31.000Z","updated_at":"2024-05-08T19:28:53.000Z","dependencies_parsed_at":"2024-09-26T01:55:02.461Z","dependency_job_id":null,"html_url":"https://github.com/mgd020/mjml-python","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.125,"last_synced_commit":"005092e623fd9e8b2639877c89825893a1895a13"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgd020%2Fmjml-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgd020%2Fmjml-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgd020%2Fmjml-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mgd020%2Fmjml-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mgd020","download_url":"https://codeload.github.com/mgd020/mjml-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234462189,"owners_count":18837279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["email","mjml","python","responsive"],"created_at":"2024-09-26T01:45:51.907Z","updated_at":"2025-09-27T22:32:11.415Z","avatar_url":"https://github.com/mgd020.png","language":"Python","readme":"# mjml-python\n\nCompile MJML at runtime without an external Node service/process. It is a Python wrapper for [MRML](https://github.com/jdrouet/mrml) (Rust port of [MJML](https://github.com/mjmlio/mjml)).\n\n## Why\n\nFrom [MRML](https://github.com/jolimail/mrml#why):\n\n\u003e A Node.js server rendering an MJML template takes around 20 MB of RAM at startup and 130 MB under stress test. In Rust, less than 1.7 MB at startup and a bit less that 3 MB under stress test. The Rust version can also handle twice as many requests per second.\n\nAll of that is without considering http transaction cost when using a  node service or process.\n\n## How\n\nInstall from [PyPI](https://pypi.org/project/mjml-python/):\n\n```sh\npip install mjml-python\n```\n\nImport `mjml2html` and pass a string to compile: \n\n```py\nfrom mjml import mjml2html\n\nhtml = mjml2html(\n    '''\n    \u003cmjml\u003e\n      \u003cmj-body\u003e\n        \u003cmj-section\u003e\n          \u003cmj-column\u003e\n            \u003cmj-image width=\"100px\" src=\"/assets/img/logo-small.png\"\u003e\u003c/mj-image\u003e\n            \u003cmj-divider border-color=\"#F45E43\"\u003e\u003c/mj-divider\u003e\n            \u003c!-- Say hello to the user --\u003e\n            \u003cmj-text font-size=\"20px\" color=\"#F45E43\" font-family=\"Open Sans\"\u003eHello World\u003c/mj-text\u003e\n          \u003c/mj-column\u003e\n        \u003c/mj-section\u003e\n         \u003cmj-section\u003e\n          \u003cmj-column\u003e\n            \u003cmj-social font-size=\"15px\" icon-size=\"30px\" mode=\"horizontal\"\u003e\n              \u003cmj-social-element name=\"facebook\" href=\"https://mjml.io/\"\u003e\n                Facebook\n              \u003c/mj-social-element\u003e\n              \u003cmj-social-element name=\"google\" href=\"https://mjml.io/\"\u003e\n                Google\n              \u003c/mj-social-element\u003e\n              \u003cmj-social-element  name=\"twitter\" href=\"https://mjml.io/\"\u003e\n                Twitter\n              \u003c/mj-social-element\u003e\n            \u003c/mj-social\u003e\n          \u003c/mj-column\u003e\n        \u003c/mj-section\u003e\n      \u003c/mj-body\u003e\n    \u003c/mjml\u003e\n    ''',\n    disable_comments=True,\n    social_icon_origin=\"https://example.com\",\n    fonts={\n        \"Open Sans\": \"https://fonts.googleapis.com/css?family=Open+Sans:300,400,500,700\",\n        \"Ubuntu\": \"https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700\",\n    })\n```\n\n**Example using Django templates**\n\n```py\nfrom django.core.mail import send_mail\nfrom django.template.loader import render_to_string\nfrom mjml import mjml2html\n\ncontext = {'foo': 'bar'}\ntext_message = render_to_string('my_text_template.txt', context)\nhtml_message = mjml2html(render_to_string('my_mjml_template.mjml', context))\nsend_mail(\n    'Subject here',\n    text_message,\n    'from@example.com',\n    ['to@example.com'],\n    fail_silently=False,\n    html_message=html_message,\n)\n```\n\n**Options**\n\n`mjml-python` supports the following options:\n\n| Name                 | Type                           | Default value | Comment                                                                          |\n|----------------------|--------------------------------|---------------|----------------------------------------------------------------------------------|\n| `disable_comments`   | `bool`                         | `False`       | Strip comments out of rendered HTML                                              |\n| `social_icon_origin` | `str \\| None`                  | `None`        | Custom URL origin for social icons. Icon name is appended (e.g. `facebook.png`). |\n| `fonts`              | `dict[str, str] \\| None`       | `None`        | Fonts imported in the HTML rendered by MJML.                                     |\n| `include_loader`     | `Callable[[str], str] \\| None` | `None`        | Fetch the included template using the path attribute.                            |\n\n*Notes* :\n\n- When `fonts` option is set to `None`, the following default fonts will be used: \n  ```py\n  {\n      \"Open Sans\": \"https://fonts.googleapis.com/css?family=Open+Sans:300,400,500,700\",\n      \"Droid Sans\": \"https://fonts.googleapis.com/css?family=Droid+Sans:300,400,500,700\",\n      \"Lato\": \"https://fonts.googleapis.com/css?family=Lato:300,400,500,700\",\n      \"Roboto\": \"https://fonts.googleapis.com/css?family=Roboto:300,400,500,700\",\n      \"Ubuntu\": \"https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700\",\n  }       \n  ```\n\n## Development\n\nWith [Nix](https://nixos.org/): \n\n```sh\nnix-shell\n```\n\nWith Python 3.7+, Rust and Cargo installed:\n\n```sh\npython3 -m venv env\nsource env/bin/activate\npip install -r requirements.txt\nmaturin develop\npython -m unittest\n```\n","funding_links":["https://www.buymeacoffee.com/mgd020"],"categories":["Tools","Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgd020%2Fmjml-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgd020%2Fmjml-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgd020%2Fmjml-python/lists"}