Coder Social home page Coder Social logo

afcarl / vdom Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nteract/vdom

0.0 0.0 0.0 166 KB

๐ŸŽ„ Virtual DOM for Python

Home Page: https://github.com/nteract/vdom/blob/master/docs/mimetype-spec.md

License: BSD 3-Clause "New" or "Revised" License

Python 31.62% Jupyter Notebook 68.38%

vdom's Introduction

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.

vdom's People

Contributors

betatim avatar captainsafia avatar carreau avatar elgalu avatar ellisonbg avatar gnestor avatar ionicabizau avatar jdetle avatar madhu94 avatar menglewis avatar mpacer avatar mseal avatar rgbkrk avatar rmorshea avatar tacaswell avatar tonyfast avatar willingc avatar yuvipanda avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.