Readit News logoReadit News
paveldedik commented on Show HN: Web Development with Htmx, Type-Guided Components, Pure Python   getludic.dev/docs/... · Posted by u/paveldedik
pbronez · a year ago
It would be nice to have a “next page” button at the bottom of the documentation pages, so you can read straight through without popping back up to the ToC.
paveldedik · a year ago
Thank you very much, really good advice here.
paveldedik commented on Ludic: New framework for Python with seamless Htmx support   github.com/paveldedik/lud... · Posted by u/paveldedik
TylerE · a year ago
That's a totally different presentation though. The ludic home page never mentions that there is an existing function/data type! It just goes straight into the definition of Link without giving any context to someone who doesn't know what htmx is. There is nothing to tell a naive reader that this isn't how you'd do this in a production app.
paveldedik · a year ago
Thank you for the feedback, I need to improve the home page a lot. I thought I should make it as brief as possible so that people don't need to read long essays to quickly understand what it is about. But at the same time, presenting all the necessary information in a short text seems hard.
paveldedik commented on Ludic: New framework for Python with seamless Htmx support   github.com/paveldedik/lud... · Posted by u/paveldedik
zelphirkalt · a year ago
Is there any chance you are considering moving towards structured data as HTML, as in SXML, instead of putting things into fstrings?
paveldedik · a year ago
Well, I would like it if the solution supported standard Python typing. Here I can create a "component" that expects a specific type of the first child and a specific type of the second child. I would probably have to use a separate tool for some kind of type-checking the SXML or something.

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

paveldedik commented on Ludic: New framework for Python with seamless Htmx support   github.com/paveldedik/lud... · Posted by u/paveldedik
rmbyrro · a year ago
I don't know, every time I see people sneaking html into Python feels weird and wrong to me...
paveldedik · a year ago
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.
paveldedik commented on Ludic: New framework for Python with seamless Htmx support   github.com/paveldedik/lud... · Posted by u/paveldedik
sesm · a year ago
By React-like component approach, do you mean using functions instead of templating language?
paveldedik · a year ago
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 it, and React is a completely different framework. I didn't know how to describe the framework in just a few sentences but wanted to somehow. I might change the description at some point.

I still don't know how useful the framework is, I am playing around with it and I like it. Who knows what other people think, though.

// edit - code block don't work here, removed code sample.

paveldedik commented on Ludic: New framework for Python with seamless Htmx support   github.com/paveldedik/lud... · Posted by u/paveldedik
paveldedik · a year ago
I've been working on a lightweight framework called Ludic that focuses on web development using Python, htmx.org, and a somewhat React-like component approach. It leverages Starlette for performance and the latest Python 3.12 typing features.

Interested in feedback!

* Docs: https://ludic.readthedocs.io/ * Code: https://github.com/paveldedik/ludic/ * Examples: https://github.com/paveldedik/ludic/tree/main/examples

u/paveldedik

KarmaCake day159March 12, 2024View Original