Skip to main content

A easy-to-use pure python HTML template engine

Project description

Documentation Status

Rattle.py is a pure python templating library for html. And this library has no special notation like Django or Jinja. For example:

<html>
    <head>
        <title>Hello, Rattle.py!</title>
    </head>
    <body>
        <h1 class="heading">Hello, Rattle.py!</h1>
    </body>
</html>

The above HTML equals to below Python code with rattle.py:

greeting = "Hello, Rattle.py!"
with html() as html:
  with head():
    with title():
      text(greeting)
  with body():
    with h1(className="heading"):
      text(greeting)

# show as HTML
print(html)

And then, you can also make reusable components by yourself:

def greet(name):
  with node("div", className="greet-wrapper") as component:
    with node("h1"):
      text(f"Hello, {name}=san")
    with node("button", className="ok-btn"):
      text("ok!")
  return component

# and using:
with greet("User"): pass

Enjoy!

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

rattlepy-0.0.5a1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

rattlepy-0.0.5a1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file rattlepy-0.0.5a1.tar.gz.

File metadata

  • Download URL: rattlepy-0.0.5a1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.19.4 CPython/3.6.5

File hashes

Hashes for rattlepy-0.0.5a1.tar.gz
Algorithm Hash digest
SHA256 4c94b0bceca0dd1c75a50cba8d6944fe0f5f25f52d29ca1edf9ebe1469b55f18
MD5 801ef64ae6fc5cc51ba6156809787008
BLAKE2b-256 4fdf29f14c7213ccb5fafd9b62e6f0b07fd85e7a4313ac7193bab1c4eb271b45

See more details on using hashes here.

File details

Details for the file rattlepy-0.0.5a1-py3-none-any.whl.

File metadata

  • Download URL: rattlepy-0.0.5a1-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.19.4 CPython/3.6.5

File hashes

Hashes for rattlepy-0.0.5a1-py3-none-any.whl
Algorithm Hash digest
SHA256 1261199b55807d21f6b69fb7e766c0f4968792a678ebc2e7f66669c71c37e341
MD5 e02fafeb790c6b8bbd9ac9bcc7c5a117
BLAKE2b-256 f09cf7ec472c1a46893b2d8ca07a3226d3a7bf6a0654c79a781fa7da06e3d748

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page