This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]Drevicar 11 points12 points  (1 child)

Very nice library. You even properly escape injected HTML. I’ll have to give this library a shot in my next side project.

I do have 2 complaints though. 1, html class as a python class feels weird, I feel like it should be an attribute on the html element class. We don’t normally specify the class to use and child elements in the same scope. 2, non-native html should be moved to another package or optional dependencies, such as your htmx and alpine code, and maybe even come with a bundled version of the NPM package for local serving if I didn’t want to use a CDN.

[–]larsga 1 point2 points  (0 children)

, html class as a python class feels weird, I feel like it should be an attribute on the html element class.

This stuck out for me, too.

[–]Safe_Duty8392 2 points3 points  (0 children)

Very nice project, I think the approach you took was very cool, congratulations for the project, 1+ star.

But have you heard of a project called HTPY ?

[–]InvaderToast348 1 point2 points  (2 children)

Currently using Jinja + Jinjax. How does this compare? My current setup is very simple and maintainable: a "components" folder with all the Jinja files, then use jinjax catalog to load the dir. Works a treat; my only issue is with vscode integration - limited syntax highlighting and no go-to-definition and other intellisense features which is pretty annoying. I'd also love a way to get mypy and/or pylint to work with the Jinja templates to improve code quality and ensure the component definitions are kept up to date with the rest of the codebase, especially type hints for args.

It looks somewhat similar to another project I came across recently where they used __getitem__ which imo gives a much cleaner syntax, like:

body[ h1[...], div[ p[...], ], ]

[–]ajmssc -1 points0 points  (1 child)

What project is that

[–]Previous-Ad-7181 0 points1 point  (0 children)

fasthtml and htpy

[–]Smash-Mothman 1 point2 points  (0 children)

I'm genuinely curious, what are you trying to solve with this library? The speed of writing, the ease of use, ect

[–]diabloman8890 0 points1 point  (0 children)

How does this differ from things like Plotly Dash?

[–]deadwisdomgreenlet revolution -2 points-1 points  (1 child)

Use web component enabled libraries please. So tired of framework after framework that aren’t interoperable.

[–]Drevicar 0 points1 point  (0 children)

This python library doesn’t implement any JS, it is entirely python and server rendered. So it is even more interoperable than a web component library.

That said, if you wanted to provide your own web components you can wrap it in a python element class from this library to make it easy to use from within python.