No project description provided
Project description
VDOM
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file vdom-1.0.0.tar.gz
.
File metadata
- Download URL: vdom-1.0.0.tar.gz
- Upload date:
- Size: 21.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.9.9 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 953d33c0b5cc6e7fec57b350c18bfd31b40439b88671661b6f86f77a42a5aeab |
|
MD5 | c1a8045db1a6259b92c244263ae61e30 |
|
BLAKE2b-256 | c32f78f3c937c76d96d66dfca461529bbd22c2478146733b749d88eee35e0c55 |
File details
Details for the file vdom-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: vdom-1.0.0-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.9.9 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c57cacb34842c9bf1bde6206e2015876be6f5f3eceead8d167556a9e0acc4faf |
|
MD5 | 8f88867b4579cbb99d7ca3e7db26603e |
|
BLAKE2b-256 | bab6d3d3ebefdb0a6bd50358e8ede6f106ca370f4e873996d4090032ee49c42d |