Live data from Hacker News

FastHTML – Modern web applications in pure Python

fastht.ml

131–140 of 229 posts

Re: FastHTML – Modern web applications in pure Python

#131
post #119
post #64

Earlier quoted context omitted.

Yes htpy is nice! Other interesting examples of functional HTML include Elm-html (Elm), hiccl (Common Lisp), hiccup (Clojure), Falco.Markup (F#), Lucid (Haskell), and dream-html (OCaml). FastHTML's system, called "FastTag" (FT) is a bit of a mashup of all of them plus some extra bits. I seriously considered just using htpy actually -- but in the end decided I preferred something a little different. I've wondered abou…

Thanks for making FastHTML, it is great to see more Python tooling that embraces Python for generating HTML. What made you build FastTag instead of going with htpy? I am the author of htpy and any feedback would be very welcome!

I wrote a few things with each of FT and htpy, and looked at the resulting code -- I felt like the htpy approach was slightly less neat personally. htpy has the benefit that '.' and '#' can have special meanings, but the downside of needing to use both __getitem__ and __call__. I didn't feel like that was a tradeoff I wanted to make. I actually originally wrote FT for a different purpose (XML for language model input) so id and class attributes weren't of any interest at all at that time!

Also, I was able to implement FT using just 2 lines of code -- it felt like a very natural data structure that was a good fit with Python.

Having said all that, I think htpy is really nifty and elegant. :D

Re: FastHTML – Modern web applications in pure Python

#132

Frameworks like this are really next-gen, but I wish people would think in terms of the bigger Python ecosystem and not just their own framework. This is about the fifth web framework which are not compatible with each other: Streamlit, ReactPy, FastHTML, Dash, Shiny, etc.. I created a truly reusable Python component framework which is just a a string generation library and can be used for ANY existing Python web fra…

Most Python web apps implement WSGI, and so can absolutely be used together. Just mount them on top of each other. Wanna use both Flask 'n Django? Go for it! Unfortunately, that's the backend story.

On the frontend, things are a little less consistent.

Re: FastHTML – Modern web applications in pure Python

#136

People do all kinds of crazy useless things just in order not to do it the proper way in PHP.

While I've been a PHP hater most of my life, as I get older I start appreciating its simplicity. I still think it's a terrible language, but I would not be surprised if it went through a revival period simply because everything else has so much more unneeded complexity.

Re: FastHTML – Modern web applications in pure Python

#137
post #24

First, I welcome any project that enriches a software ecosystem, and this project no doubt does just that. However, I have two points which will deter me from using this (or any python->html/js framework) in a commercial production project: 1. It silos front end development in Python world. It might be great if your entire team are and always will be Python devs, but what happens when you want dedicated from end deve…

That's always the problem with these things. You can no longer leverage the bigger ecosystem (e.g. just copy HTML templates from libraries), and I can probably count on no fingers the number of decent designers I've met who knew python. So as soon as you want to grow your team you'll end up with a split.

Still, for projects that are only likely to stay small it might be fun. But then you'll have to remember how it works after coming back from your day job that uses a more mainstream framework.

Re: FastHTML – Modern web applications in pure Python

#138

Frameworks like this are really next-gen, but I wish people would think in terms of the bigger Python ecosystem and not just their own framework. This is about the fifth web framework which are not compatible with each other: Streamlit, ReactPy, FastHTML, Dash, Shiny, etc.. I created a truly reusable Python component framework which is just a a string generation library and can be used for ANY existing Python web fra…

But I cant use this instead of jinja?

yes you can

Re: FastHTML – Modern web applications in pure Python

#140
post #123

Frameworks like this are really next-gen, but I wish people would think in terms of the bigger Python ecosystem and not just their own framework. This is about the fifth web framework which are not compatible with each other: Streamlit, ReactPy, FastHTML, Dash, Shiny, etc.. I created a truly reusable Python component framework which is just a a string generation library and can be used for ANY existing Python web fra…

At the risk of being ignorant/heretical: Why use this over "raw" templating (e.g. jinja2) at this point?

I’ve switched back to writing server-based code from writing React SPA. Text-based templates (I use jinja2) is my least favorite part of that.

It’s modeled after Django templates circa 2005, and that was designed with an idea that designers will write those templates, that they are not code.

I’m doing all this for 18 years, it was always programmers who wrote template code.

Why then we have such things as filters, in addition to functions? Untyped macros. Formatting template code is a struggle. Include tags are the worst.

The only thing I fear with regard to all these component libraries is performance. I actually wrote a PoC myself for such a library, but didn’t bring it to production quality.

Post reply on HN