Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

jviide/htm.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

htm.py Tests PyPI

A Python version of developit/htm - JSX-like syntax in plain JavaScript Python.

Documentation

The main documentation of this module is located at https://jviide.github.io/htm.py/.

Installation

$ pip3 install htm

Usage

from htm import htm

@htm
def html(tag, props, children):
    return tag, props, children

a = 1
b = {"bar": 100}
c = "span"
d = "world"

html("""
  <div foo={a+2} ...{b}>
    <{c}>Hello, {d}!<//>
  </div>
""")
# ('div', {'foo': 3, 'bar': 100}, [('span', {}, ['Hello,', 'world', '!'])])

Development

To install locally:

$ pip install -e .

If you want to run tests and build the Sphinx docs and their examples...that runs into a problem with hyperpython's transitive dependencies. Thus:

$ pip install toolz
$ pip install sidekick
$ pip install -e .[docs]

Running Tests

$ python3 -m unittest discover -s tests

Building Docs

Documentation is available in the docs directory. First install the dependencies then build the docs:

$ pip install -e .[docs]
$ cd docs
$ sphinx-build -b html . _build

License

This library is licensed under the MIT license. See ./LICENSE.