IDOM is a Python micro-framework that links your web framework of choice to a ReactJS frontend, allowing you to create interactive websites without needing JavaScript!
Following ReactJS styling, web elements are combined into reusable "components". These components can utilize hooks and events to create infinitely complex web pages.
When needed, IDOM can use JavaScript components directly from NPM. Components can also be developed in JavaScript for additional flexibility.
IDOM's ecosystem independent design allows components to be reused across a variety of web frameworks. Pre-existing support is included for many popular Python frameworks, however, any framework with WebSocket support can be adapted to utilize IDOM.
Supported Frameworks | Supported Frameworks (External) |
---|---|
Flask , FastAPI , Sanic , Tornado |
Django , Plotly-Dash , Jupyter |
You'll need a file to define your IDOM components. We recommend creating a components.py
file within your chosen Django app to start out.
from idom import component, html
# Components are CamelCase by ReactJS convention
@component
def HelloComponent(recipient: str):
return html.h1(f"Hello {recipient}!")
In your Django app's HTML located within your templates
folder, you can now embed your IDOM component using the component
template tag. Within this tag, you will need to type in your dotted path to the component function as the first argument.
Additonally, you can pass in keyworded arguments into your component function. For example, pay attention to how the function definition for HelloComponent (in the previous example) accepts a 'recipient' argument.
{% load idom %}
<!DOCTYPE html>
<html>
<body>
{% component "django_project.example_app.components.HelloComponent" recipient="World" %}
</body>
</html>
Follow the links below to find out more about this project.
- Try it Now - Check out IDOM in a Jupyter Notebook.
- Documentation - Learn how to install, run, and use IDOM.
- Community Forum - Ask questions, share ideas, and show off projects.