I don't know, every time I see people sneaking html into Python feels weird and wrong to me...
Yeah, I understand that. Now that Python 3.12 has better support for f-strings, I thought there might be a way to make it possible. But I am still not sure it will work. There is a pretty weird hack to make f-strings work while avoiding the possibility of rendering unsafe user input.
Ludic: New framework for Python with seamless Htmx support
11–20 of 107 posts
Re: Ludic: New framework for Python with seamless Htmx support
#12Earlier quoted context omitted.
By React-like component approach, do you mean using functions instead of templating language?
I think it is somewhat similar to React, for example, you can create a Link component like you can see in the README.md Now you can use it in f-strings, and well, other components. The idea from the beginning was to integrate it with htmx.org, so to me, it feels kind of similar when you are writing endpoints using these "components". But I understand why you are raising this question, I also didn't know how to name i…
Re: Ludic: New framework for Python with seamless Htmx support
#13https://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 using it except me, though.
Re: Ludic: New framework for Python with seamless Htmx support
#14Disclaimer: Not my code, just an example I found.
Re: Ludic: New framework for Python with seamless Htmx support
#15I don't know, every time I see people sneaking html into Python feels weird and wrong to me...
Do you feel the same about sneaking html into javascript? Just curious if it's a Python-specific objection.
https://github.com/paveldedik/ludic/blob/main/examples/click...
It's the kind of thing that looks very cool and concise in small examples, but tends to become a nightmare when you are working on larger projects.
Re: Ludic: New framework for Python with seamless Htmx support
#16Earlier quoted context omitted.
I think it is somewhat similar to React, for example, you can create a Link component like you can see in the README.md Now you can use it in f-strings, and well, other components. The idea from the beginning was to integrate it with htmx.org, so to me, it feels kind of similar when you are writing endpoints using these "components". But I understand why you are raising this question, I also didn't know how to name i…
Is there any chance you are considering moving towards structured data as HTML, as in SXML, instead of putting things into fstrings?
BTW in Rust, you can create macros, that is something I like a lot as you can see in yew framework - https://yew.rs/docs/getting-started/build-a-sample-app#updat... - you can write HTML which probably are typed. Python doesn't have anything like that, I don't know about any other way to do this.
// edit typo
Re: Ludic: New framework for Python with seamless Htmx support
#17I’ve been burned by ASGI and asynchronous python so much in the past, I wouldn’t touch it again even if someone paid me for it. It’s prone to bugs, hard to debug and for little benefit.
How have you been burned? What kind of bugs did you have, and in what way was it difficult to debug?
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 time debugging Python internals so I just switched to Deno.
Re: Ludic: New framework for Python with seamless Htmx support
#18Re: Ludic: New framework for Python with seamless Htmx support
#19One 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 little in the way of an integration path (the lifecycle events are basic), and nothing in the way of structure, and can even get in the way in places where its lifecycle causes issues in the lifecycle of whatever you're adding. To add your own Javascript you'll almost certainly want Jquery or React/Svelte/etc, and with the latter you'll get interactions between their lifecycles.
If you're using it entirely via the HTML API, and you're happy to accept that sometimes it won't do something, you'll be fine. If you're looking to add units of more complex client-side functionality in places, try prototyping with it to make sure it works well, it didn't for me.