To install IDOM and a default implementation for all features:

pip install idom[stable]

For a minimal installation that lacks implementations for some features:

pip install idom

For more installation options see the Extra Features section.


IDOM also supplies a Flake8 Plugin to help enforce the Rules of Hooks

Extra Features

Optionally installable features of IDOM. To include, them use the given “Name” from the table below:

pip install idom[NAME]




Default implementations for all IDOM’s features


Utilities for testing IDOM using Selenium


Sanic as a Layout Server


FastAPI as a Layout Server


Tornado as a Layout Server


Flask as a Layout Server


Python Language Extension for writing JSX-like syntax


All the features listed above (not usually needed)

Python Language Extension

IDOM includes an import-time transpiler for writing JSX-like syntax in a .py file!

# dialect=html
from idom import html

message = "hello world!"
attrs = {"height": "10px", "width": "10px"}
model = html(f"<div ...{attrs}><p>{message}</p></div>")

assert model == {
    "tagName": "div",
    "attributes": {"height": "10px", "width": "10px"},
    "children": [{"tagName": "p", "children": ["hello world!"]}],

With Jupyter and IPython support:

%%dialect html
from idom import html
assert html(f"<div/>") == {"tagName": "div"}

That you can install with pip:

pip install idom[dialect]


  1. Import idom in your application’s

  2. Import with a # dialect=html header comment.

  3. Inside import html from idom

  4. Run python from your console.

So here’s the files you should have set up:


The contents of should contain:

import idom  # this needs to be first!
import your_module

While should contain the following:

# dialect=html
from idom import html
assert html(f"<div/>") == {"tagName": "div"}

And that’s it!

How It Works

Once idom has been imported at your application’s entrypoint, any following modules imported with a # dialect=html header comment get transpiled just before they’re executed. This is accomplished by using Pyalect to hook a transpiler into Pythons import system. The HtmlDialectTranspiler implements Pyalect’s Transpiler interface using some tooling from