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: