- Write Declarative Pythonic layouts.
- Create headings, prose, images, and more common user interface items with user-friendly declarative statements.
- Render the layout in Jupyter frontends, such as nteract and JupyterLab.
- Serialize the layout for rehydration and later use in your web app.
Create layouts by writing and running Python code. Let's see an example below to create and display a heading, styled prose, and a GIF:
from IPython.display import display
from vdom.helpers import h1, p, img, div, b
display(
div(
h1('Our Incredibly Declarative Example'),
p('Can you believe we wrote this ', b('in Python'), '?'),
img(src="https://media.giphy.com/media/xUPGcguWZHRC2HyBRS/giphy.gif"),
p('What will ', b('you'), ' create next?'),
)
)
Voila!
Your example created a layout and served it below:
Can you believe we wrote this in Python?
What will you create next?
pip install vdom
First, import vdom.helpers
for headings, text, and images:
from vdom.helpers import h1, p, img, div, b
Create a layout using the VDOM helpers in Python code. Here's an example code layout block:
my_pretty_layout = div(
h1('Our Incredibly Declarative Example'),
p('Can you believe we wrote this ', b('in Python'), '?'),
img(src="https://media.giphy.com/media/xUPGcguWZHRC2HyBRS/giphy.gif"),
p('What will ', b('you'), ' create next?'),
)
To display the layout, use IPython's display method:
from IPython.display import display
display(my_pretty_layout)
The full example, including rendered output, is found above.
git clone https://github.com/nteract/vdom
cd vdom
pip install -e .
We follow these Contributing Guidelines.
For contributors helping with creating releases, the [RELEASING.md] document outlines the process.
Take a look at the nteract website to see other projects that we are working on.