PUG ( web template engine ) for Python šŸ

Hi,

Iā€™ve discover haml and pug [1] ( both web template engine )

Itā€™s totally Pytonic ! ( and make even more sense to use it with python rather than JS :face_vomiting: )

Iā€™ve look, if it exist for Python, but so far, Iā€™ve found only

The first, only convert pug into another template :confused:
The second, didnā€™t pass the alpha version.
The third, require dependence, not maintained etcā€¦ \

So I didnā€™t found a Python package that could do haml/pug to html directly, without too much dependenceā€¦

For example:

From

html
  head title Example for Python discuss
  body
    h1 Hello world
    p This is a paragraph.

To

<html>
  <head>
    <title>Example for Python discuss</title>
  </head>
  <body>
    <h1>Hello world</h1>
    <p>This is a paragraph.</p>
  </body>
</html>

Do you know if such thing exist ?
If not, I will build my own (FLOSS). ( Iā€™m open to any advice to do so :slight_smile: )

Thanks


  1. Pug is a template engine heavily influenced by Haml and implemented with JavaScript :face_vomiting: for Node.js ā†©ļøŽ

Iā€™ve used PUG templates for many years but fairly recently FastHTML appeared with FT Components which gave me a huge ā€œah-hahā€ moment and realize it is much better to create HTML ā€œtemplatesā€ directly in my favored Python language and tooling. Another option is htpy.

Thanks @bulletmark for the sharing.

both use a nested syntax and pug use (like python) a indented syntaxā€¦

So if there no indented alternative to pug for Python, Iā€™ll made it myself :slight_smile: