Live data from Hacker News

Ludic: New framework for Python with seamless Htmx support

github.com

61–70 of 107 posts

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

#61
post #14

I encourage anyone looking to do htmx to consider Kotlin and it's excelent kotlinx-html DSL. Lets you do stuff like this: https://github.com/corlaez/kotlin-htmx/blob/master/src/main/... Disclaimer: Not my code, just an example I found.

I second this. kotlinx-html is poorly documented and has a couple quirks, but is fantastic. As I've been building one of my current projects, I've also been building a framework based on jooq + kotlinx.html + javalin + htmx + flowbite (+kotlinjs for a few fancy bits, e.g. the charting library). Aside from tailwind, you end up with a fully typed and compiler-checked application end to end, i.e. no magic strings to be seen. I'm exclusively using HX-Retarget, so the backend is in charge of where things land, meaning that the frontend can do things like:

   div {
      onClick(loadItems)
   } 
I don't know whether I'll ever actually get it in good enough shape to release, but I do plan to blog about how some of the tricks I've found it fitting it together. One thing I definitely need to do before anybody looks at it is clean up how routes and targets are managed.

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

#62

I wish someone would sponsor development of HTMX support via NginX or Apache2 modules. That way you don't have to go to python, php, java, etc... to get HTMX support. You would just enable the module, configure a few things and let it rip. Kinda like server side includes in Apache2.

Can you explain what you mean? htmx is client-side, so you don't need server-side includes. Just host HTML snippets on your web server and let htmx stitch them together in the browser. I'm not sure where you want the web server to play a role?

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

#63

Generating `HTML` from lisps has poisoned any other approach for me, see for example https://www.neilvandyke.org/racket/html-writing/ , https://reagent-project.github.io/ , and https://edicl.github.io/cl-who/

That's very nice, I wonder if we can write a sort of dsl for this in python.

Airium is close: https://gitlab.com/kamichal/airium

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

#64
post #4

I don't know, every time I see people sneaking html into Python feels weird and wrong to me...

Until you try it out and realize the benefits! - Type safe HTML: you get an exception instead of malformed HTML - Truly reusable components: any Python web framework, component packages are truly reusable in any other projects. I never seen this with template engines. - Huge productivity boost: not even close! No hunting for templates, no jumping between files, everything is in Python functions. - Composable elements…

Insightful summary. Thx.

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

#65
post #63

Earlier quoted context omitted.

That's very nice, I wonder if we can write a sort of dsl for this in python.

Airium is close: https://gitlab.com/kamichal/airium

The problem with this is that it doesn’t map nicely to HTML (or more generally XML) as do s-expressions.

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

#66

I wish someone would sponsor development of HTMX support via NginX or Apache2 modules. That way you don't have to go to python, php, java, etc... to get HTMX support. You would just enable the module, configure a few things and let it rip. Kinda like server side includes in Apache2.

Can you explain what you mean? htmx is client-side, so you don't need server-side includes. Just host HTML snippets on your web server and let htmx stitch them together in the browser. I'm not sure where you want the web server to play a role?

HTMX is a client side JS file which parses the dom and then interprets it in a certain way and then provides some functionality. However the choice whether someone creates the initial html in a SPA context or a full page refresh is up to the developer. Maybe I want to generate the HTML snippets HTMX processes from the server side in PHP/Python and then have HTMX run it's magic on page load.

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

#67

Earlier quoted context omitted.

Can you explain what you mean? htmx is client-side, so you don't need server-side includes. Just host HTML snippets on your web server and let htmx stitch them together in the browser. I'm not sure where you want the web server to play a role?

HTMX is a client side JS file which parses the dom and then interprets it in a certain way and then provides some functionality. However the choice whether someone creates the initial html in a SPA context or a full page refresh is up to the developer. Maybe I want to generate the HTML snippets HTMX processes from the server side in PHP/Python and then have HTMX run it's magic on page load.

Or maybe if the same HTMX logic is put into server side code equivalent which generates , the server side code can generate that extra functionality and only generate the js that is needed eliminating the step of including HTMX on the client side.

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

#69
post #14

I encourage anyone looking to do htmx to consider Kotlin and it's excelent kotlinx-html DSL. Lets you do stuff like this: https://github.com/corlaez/kotlin-htmx/blob/master/src/main/... Disclaimer: Not my code, just an example I found.

I second this. kotlinx-html is poorly documented and has a couple quirks, but is fantastic. As I've been building one of my current projects, I've also been building a framework based on jooq + kotlinx.html + javalin + htmx + flowbite (+kotlinjs for a few fancy bits, e.g. the charting library). Aside from tailwind, you end up with a fully typed and compiler-checked application end to end, i.e. no magic strings to be…

That sounds like a lovely way to develop, what is your blog? So I can watch for your post.

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

#70
post #69

Earlier quoted context omitted.

I second this. kotlinx-html is poorly documented and has a couple quirks, but is fantastic. As I've been building one of my current projects, I've also been building a framework based on jooq + kotlinx.html + javalin + htmx + flowbite (+kotlinjs for a few fancy bits, e.g. the charting library). Aside from tailwind, you end up with a fully typed and compiler-checked application end to end, i.e. no magic strings to be…

That sounds like a lovely way to develop, what is your blog? So I can watch for your post.

Thanks! It's http://smaller.fish. I have a subscribe form at the bottom which I only use for new post announcements (which, as you can see, are pretty infrequent :)).
Post reply on HN