I'm personally always confused with those batteries-included frameworks like Django, FastAPI and similar. Sure, they might be easier for a beginner to quickly whip up a simple Web site/app, but in my experience as your requirements grow they quickly start getting in your way. Starting with more flexible initial components (e.g. Starlette) and adding batteries (SQLAlchemy, Jinja2, HTMX...) as needed allows for a sensi…
FastHTML – Modern web applications in pure Python
201–210 of 229 posts
Re: FastHTML – Modern web applications in pure Python
#202One thing I'm dying to see is a Python template engine that builds to WASM. This is the killer feature of C# for me right now. Blazor removes any need for me to ever touch React or JavaScript ever again. I think if done as a stand alone template engine, then every web framework could benefit from it, including this one. I just might have to research.
Might not be exactly what you're talking about, but Shiny for Python compiles to WASM, so that you can deploy stand-alone https://shiny.posit.co/py/docs/shinylive.html
Re: FastHTML – Modern web applications in pure Python
#203Is it possible to inject custom JS wherever I want in the app? Also, is the generate html/css/javascript readable as the application scale up?
Re: FastHTML – Modern web applications in pure Python
#204Re: FastHTML – Modern web applications in pure Python
#205Earlier quoted context omitted.
This is html building not js. It’s not any more verbose, in fact slightly less because no need for closing tags. Main difference is parens instead of angle brackets. Now you can use tools. I do prefer lower case callables but that’s a minor nitpick, and “htpy” and other libs can do that.
Yes, it is HTML, and it loses all the benefits of HTML, by adding complexity of code and loss of structure. I'm uncomfortable with HTML and JS obfuscated by Python like that. I'm not using the word "verbose" as a character count comparison, but as an overall feel of weight when I see such code. It just takes me back to Java Swing, or ExtJS in the JavaScript world. It's not bad if it's the only way to describe an inte…
Python is one of the most popular languages and easy to read. People are more resilient than given credit.
I tend to agree with your closing comment about over abstraction in general, however you may have forgotten that a Jinja/html template is an abomination of conflicting concepts.
I’m more worried about the rest of this framework to be honest. :-D
Re: FastHTML – Modern web applications in pure Python
#206I'm personally always confused with those batteries-included frameworks like Django, FastAPI and similar. Sure, they might be easier for a beginner to quickly whip up a simple Web site/app, but in my experience as your requirements grow they quickly start getting in your way. Starting with more flexible initial components (e.g. Starlette) and adding batteries (SQLAlchemy, Jinja2, HTMX...) as needed allows for a sensi…
Re: FastHTML – Modern web applications in pure Python
#207Python is fast compared to something? Maybe fast enough to generate HTML.
Python is glue, used to call and integrate other faster languages. Most of what is done with Python is calling fast C and C++ code. Back in ancient times, a software project I was working in, failed, precisely because of Python performance with the Zope framework, it was too slow to render a webpage that required more than a few interesting calculations. Today the language is almost the same, but computers have a tho…
Yes, it’s glue. True for Ruby, PHP, Perl as well.
I just think it’s disingenuous to associate the word “fast” with anything implemented with it, granted that C is 70 times faster than it. I mean, me saying it’s slow compared to C is less hyperbolic than saying it’s fast.
And I think Python is perfectly adequate for plenty of use cases, so is PHP, so is Ruby. I like to be mean to JavaScript, but even that is fine for web dev.
Re: FastHTML – Modern web applications in pure Python
#208Frameworks 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…
Thank you for saying this. Having to dabble with streamlit at work, I am very disappointed in those kind of solutions, where the moment you venture off the happy path, you are on your own. Any kind of integration or extension needs you to be aware of streamlit's internals. For example, there is no built-in way to open a folder picker AFAIK.
Re: FastHTML – Modern web applications in pure Python
#209Hi Jeremy, congratulations for the launch and the website looks very nice indeed. I am honestly mostly interested in your reason, to mix HTML/CSS generation into the Python code. Disclaimer, I am very biased towards separation of concern and like my backend just returning JSON/XML/whatever data and a templating system. Of course this increases the ramp-up time to learn a framework, but then it is IMHO very powerful,…
I'm a big fan of Locality of Behavior (LoB): https://htmx.org/essays/locality-of-behaviour/ . I don't think this need be incompatible with SoC. But even if you did think so, I believe that it's better to have everything in one language as much as possible, with the simplest possible specification of marshalling over network boundaries. My view is that hypermedia is a better way to do both of these things. (I think HT…
HTML templating does have one very nice benefit though: there’s a seamless path between designing and iterating on a static HTML template (which renders in the browser) and then sprinkling in the dynamic bits on top of that.
If you start with fairly complex markup in the initial design, I’m imagining it could be tedious to rewrite the whole thing in Python. Or is there some tooling that can help with this?
Re: FastHTML – Modern web applications in pure Python
#210We have 75 comments and no one has mentioned the awesome domain name? c'mon :D really excited for this project. I hope it catches on. It has some really nice ideas in it, like all the stuff jeremy does!