Skip to main content

VDOM

Code style: black

Why use VDOM

  • 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.

Check out the power of VDOM

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:

Now Incredibly Declarative

Can you believe we wrote this in Python?

What will you create next?


Getting started

Install the Python package

pip install vdom

Usage

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.

Documentation

Contribute to VDOM

Developer install from source code

git clone https://github.com/nteract/vdom
cd vdom
pip install -e .

Contributing Guidelines and Releases

We follow these Contributing Guidelines.

For contributors helping with creating releases, the [RELEASING.md] document outlines the process.

Find out more about nteract

Take a look at the nteract website to see other projects that we are working on.

Release files for vdom 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vdom 1.0.0
File Size Uploaded
vdom-1.0.0.tar.gz 21.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vdom 1.0.0
File Interpreter ABI Platform
vdom-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 43.5 kB

Release files / vdom-1.0.0.tar.gz

Download URL vdom-1.0.0.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
953d33c0b5cc6e7fec57b350c18bfd31b40439b88671661b6f86f77a42a5aeab
BLAKE2b-256 checksum
How to use checksums
c32f78f3c937c76d96d66dfca461529bbd22c2478146733b749d88eee35e0c55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.9.9 Darwin/22.3.0

Release files / vdom-1.0.0-py3-none-any.whl

Download URL vdom-1.0.0-py3-none-any.whl
Size 22.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c57cacb34842c9bf1bde6206e2015876be6f5f3eceead8d167556a9e0acc4faf
BLAKE2b-256 checksum
How to use checksums
bab6d3d3ebefdb0a6bd50358e8ede6f106ca370f4e873996d4090032ee49c42d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.9.9 Darwin/22.3.0

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.6

2 release files

0.5

3 release files

0.4

3 release files

0.3

3 release files

0.2

1 release file

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page