Live data from Hacker News

Ludic: New framework for Python with seamless Htmx support

github.com

31–40 of 107 posts

Re: Ludic: New framework for Python with seamless Htmx support

#31
post #13

I wrote a library a little while ago which is intended to be the simplest possible expression of this idea: https://github.com/j4mie/hotmetal/ The core implementation is only 85 lines of Python, and has no imports at all, so works nicely on minimal/alternative Pythons like Micropython. I'm using it on a medium-sized side project and it's shockingly productive compared to string templates. I don't think anyone is usin…

This looks really neat. One suggestion is that in your readme, show the webpage output with your examples. It’s hard to image exactly what the page will look like just looking at the hotmetal python code

Re: Ludic: New framework for Python with seamless Htmx support

#32
I have been working on a (currently half-baked) similar project:

- https://github.com/abilian/webbits>

Inspirations for the idea of generating HTML code from Python:

- https://www.yattag.org/>

- https://tylerbakke.github.io/MarkupPy/>

- https://github.com/michaeljones/packed>

- https://github.com/twidi/mixt/>

- https://github.com/byteface/domonic>

- https://pypi.org/project/hyperpython/>

- https://pypi.org/project/PyHTML/>

- https://github.com/jviide/htm.py>

- https://viewdom.readthedocs.io/>

- https://github.com/pcarbonn/fast_html>

- https://github.com/sanic-org/html5tagger>

- https://github.com/j4mie/hotmetal/>

Re: Ludic: New framework for Python with seamless Htmx support

#33
post #17
post #9

Earlier quoted context omitted.

How have you been burned? What kind of bugs did you have, and in what way was it difficult to debug?

Here's a bug I ran into with Python async: https://stackoverflow.com/q/78036302/265521 I've written about 200 lines of Python async code in total, so to run into a bug like that so soon was not encouraging. I suspect it's just not a very popular feature and so it doesn't get a lot of use and debugging. And it's Python so it really needs a lot of ton of real world use to detect bugs. Anyway I'm not going to waste my t…

It’s pretty easy to make a mistake like that with any concurrency framework. I can tell you stories about all the cases where in Java it was “use ExecutorService and… done” but it is so easy to get it wrong there.

Re: Ludic: New framework for Python with seamless Htmx support

#34

Nice release! This looks good, docs look really nice too. I'd use HTMX anywhere I can to improve a basic HTML site. One word of warning for people considering HTMX though – it's not a framework, it's an appliance. In my experience with it, I ran into problems integrating with HTMX very quickly. Drop it into your project, use the HTML attributes, and it'll be great. However if you need custom Javascript, HTMX provides…

I think those are all good points, but do cringe a little at the idea that "to add your own JavaScript you'll want React". Seems like a lot to bring in if you're really just wanting to add some JavaScript.

Re: Ludic: New framework for Python with seamless Htmx support

#35
post #13

I wrote a library a little while ago which is intended to be the simplest possible expression of this idea: https://github.com/j4mie/hotmetal/ The core implementation is only 85 lines of Python, and has no imports at all, so works nicely on minimal/alternative Pythons like Micropython. I'm using it on a medium-sized side project and it's shockingly productive compared to string templates. I don't think anyone is usin…

Cool idea. I had a similar one a few weeks ago, with this additional idea of turning this into a "real" templating language (e.g. by adding a special construct for conditionals, looping, variables, macro expansion...).

Re: Ludic: New framework for Python with seamless Htmx support

#38
post #13

I wrote a library a little while ago which is intended to be the simplest possible expression of this idea: https://github.com/j4mie/hotmetal/ The core implementation is only 85 lines of Python, and has no imports at all, so works nicely on minimal/alternative Pythons like Micropython. I'm using it on a medium-sized side project and it's shockingly productive compared to string templates. I don't think anyone is usin…

Your project looks great and I like the fact you can use it with MicroPython.

I've also been working on a library with a similar idea:

https://github.com/SamDudley/neat-html

It's still a work in progress so an example might be better to look at:

https://github.com/SamDudley/neat-html/blob/main/examples/fo...

I was inspired by some JavaScript libraries that I've used in the past:

- https://github.com/jorgebucaran/hyperapp

- https://github.com/hyperhype/hyperscript

There is also a working integration with Django that enables the use of neat-html as a template backend, however it isn't up on GitHub yet.

I find the space of HTML generation libraries which can leverage the power of Python, really interesting.

Re: Ludic: New framework for Python with seamless Htmx support

#39
Call me traumatized by the Web framework wars, but this seems like the path back to some of the issues that HTMX is trying to solve.

There is a strong developer instinct to "simplify through complexity". That is, to stuff down so much functionality and saw off all edges in an effort to hide complexity. "Let's expose a simple interface that will allow devs to do everything they want to do."

It starts with good intentions and initially provides some improvements in productivity. But it continues to evolve to the point of untenability: the complexity starts to ooze out and become a thing to manage, but with abstractions that make it more difficult; the framework becomes so opinionated that it begins to stifle; performance issues are introduced as we drift farther from the metal.

We continue to try to solve with newer constructs and abstractions, frequently introducing more issues. Eventually, it comes full circle ("hey, let's add SSR!"), and we're again looking for another solution. One that's simpler.

Then the cycle starts over again.

I think there is an inflection point with all of these things, wherein whatever perceived productivity gains are had by pushing more functionality into the framework quietly begins the path to regression. I don't exactly know where it is, but I would bet that it happens far sooner than we suspect.

So, I kind of like HTMX where it is, in spirit and implementation. Whatever additional productivity I can pick up via helper functionality and reuse is something I believe there is value in devs doing on their own, for their individual use cases and preferences. There's a tendency to think "well why reinvent the wheel? Let's make it a framework". I've come to believe that impulse is somewhat pernicious in its effect. Ultimately we're going to have to write our own code at some point. I'd suggest that we're better off doing it much sooner than frameworks encourage.

Re: Ludic: New framework for Python with seamless Htmx support

#40

Nice release! This looks good, docs look really nice too. I'd use HTMX anywhere I can to improve a basic HTML site. One word of warning for people considering HTMX though – it's not a framework, it's an appliance. In my experience with it, I ran into problems integrating with HTMX very quickly. Drop it into your project, use the HTML attributes, and it'll be great. However if you need custom Javascript, HTMX provides…

I think those are all good points, but do cringe a little at the idea that "to add your own JavaScript you'll want React". Seems like a lot to bring in if you're really just wanting to add some JavaScript.

Ha, fair point. I don't mean so much that for any JS you'd want to bring in React, but more that something like that will likely be needed to manage a codebase of any scale.

My context here is a mostly server-side application using HTMX, where I wanted to add a few small bits of additional client-side code. I tried to do it without any libraries but rapidly realised that Jquery would simplify things a lot, and managed to do ok with that, but was still fighting HTMX throughout, and I ended up with a lot of poorly managed local state quite quickly. It doesn't take much complexity to need some better form of state management, and something like React provides some direction there, but of course there are other options, my point was only really to say that HTMX will not do any of this for you, and may get in the way depending on what you need to do.

Post reply on HN