Metadata-Version: 2.1
Name: pytempl
Version: 0.1.0
Summary: DSL for writing HTML user interfaces in Python.
Home-page: https://github.com/pytempl/pytempl
License: BSD-2-Clause
Author: Saurabh Ghanekar
Author-email: ghanekarsaurabh8@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: typing-extensions (>=4,<5)
Project-URL: Documentation, https://github.com/pytempl/pytempl
Project-URL: Repository, https://github.com/pytempl/pytempl
Description-Content-Type: text/markdown

# PyTempl

Build HTML user interfaces in Python.

## Introduction

PyTempl is a DSL that lets you build HTML components as Python objects, offering a clean, component-based approach that avoids the complexities of traditional templating engines. Create reusable components that generate HTML fragments to build complex views, pages, or even entire web applications, all within your Python workflow.


## Getting Started

**Installation:**

```bash
pip install pytempl  
```

**Simple Example:**

```python
from pytempl.tags import H1, Div, P
from pytempl import render

page = Div(_class="container")(
    H1()("My Awesome Page"),
    P()("This is a paragraph of text.")
)

print(render(page))
```

This will output neatly formatted HTML.

**Advanced Example: Dynamic Content and Components**

```python
from pytempl.tags import Li, Span, Ul
from pytempl import render

items = ["apple", "banana", "cherry"]
item_list = Ul()(Li()(item) for item in items)

name = "Alice"
greeting = Span()(f"Hello, {name}!")

print(render(Div()(greeting, item_list)))
```

This demonstrates creating dynamic content and nesting components.  The output will be an HTML `<div>` containing a greeting and the unordered list of fruits.

## License

This project is licensed under the [BSD-2-Clause License](LICENCE.md)

