Skip to content

vdom 0.4

Compare
Choose a tag to compare
@rgbkrk rgbkrk released this 03 Oct 22:55
· 140 commits to main since this release

Write declarative layouts in Python, today! πŸŽ‰

pip install vdom

Use positional arguments for children instead of arrays

You can now write:

div(
    h1('Woohoo'),
    p('it works')
)

Instead of:

div([
    h1('Woohoo'),
    p('it works')
])

keyword arguments should come after the positional arguments.

Now with more helpers!

All the standard DOM elements are importable from vdom.helpers (#15)

from vdom.helpers import div, span, p, meter

def happiness(level=90):
  smiley = "πŸ˜ƒ"
  percent = level / 100.
    
  if(percent < 0.25):
    smiley = "☹️"
  elif(percent < 0.50):
    smiley = "😐"
  elif(percent < 0.75):
    smiley = "πŸ˜€"

    
  return span(
      p('Happiness ', smiley),
      meter(level, min=0, low=25, high=75, optimum=90, max=100, value=level)
  )

Documentation

We've started off some light documentation of how to use vdom, and we would welcome more examples from you.

Under the hood

Basic tests are set up to ensure you can use vdom in python2 and python3.