Live data from Hacker News

FastHTML – Modern web applications in pure Python

fastht.ml

171–180 of 229 posts

Re: FastHTML – Modern web applications in pure Python

#171
post #98

Whoah, this comment section is surreal. People really aren't bothered by the propensity for runtime errors in python? How slow it is? That it has no good features for managing complexity in large codebasea? The fact that abstractions like these pretty much always break, or at some point you want to do something more outside of the box, and you have to put in a monumental effort? I'm working on a Django+graphQL app an…

Can you expand on the features you need for managing complexity in large code bases? We’ve built a few APIs which serve millions of users without any problems and with very low latency with FastAPI, and so far we’re very happy with the choice.

Static typing (that is actually sound, strict, and enforced by default) with support for interfaces. Just generally a language that doesn't incentivizes using strings and dictionaries for everything. A language that has actual separation and implementation hiding, rather than the convention of using underscores and praying that no one touches it.

Static analysis is pretty much impossible for large python codebases. IntelliJ does not understand a single shit about the codebase I'm working on and I find myself having to ctrl+f instead of being able to shift click, etc. There is simply such a thing as "too dynamic".

Python was designed for quick scripts and pseudocode mockup prototypes. There's a bunch of bullshit strapped onto it nowadays but there's no escaping the roots of the design of python. It's not a good fit for large software or software nor software that needs to be reliable. Sure, with _enough effort and discipline_ you can bla bla bla. I'm not interested in that. I'm interested in working smarter, not harder.

Re: FastHTML – Modern web applications in pure Python

#173
I have been reading about these kinds of projects for some time, and even prototyped my own a while back, but one question that keeps popping up is - all these python abstractions over how html and js and dom interact tend to be extremely leaky. So, as soon as you go beyond the simple todo example, you need to manage BOTH the standard browser model and the abstraction model in your head, and all the funny ways in which they interact. Do these kinds of libraries prove useful for people beyond their authors (who have a good mental model of a framework in their head anyway because they are developing it)?

Re: FastHTML – Modern web applications in pure Python

#174

Earlier quoted context omitted.

No. It's not in the spec, and in almost 30 years of web development, this might be the first time I've ever seen someone use a closing tag for it.

It's also not a tag, but an SGML (?) directive (specifically a https://en.wikipedia.org/wiki/Document_type_definition ) and so it is in fact invalid to produce a closing tag.

https://stackoverflow.com/q/23005510/3896300

Re: FastHTML – Modern web applications in pure Python

#175

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…

Another Python framework agnostic project is ReactPy. [0]

[0]: https://github.com/reactive-python/reactpy

Re: FastHTML – Modern web applications in pure Python

#176
post #19

Earlier quoted context omitted.

1. The conda recommendation is in the JS App Walkthrough documentation page: > A Python package manager: we recommend conda or pip 2. Makes sense! Something like sqlalchemy/alembic would be cool for PostgreSQL support. 3. Ah, this is interesting. Will read up on the different ASGI implementations. I had just assumed that having LLM workloads, async or not, on your main web server would be a problem (memory and/or i/o…

I possibly misunderstand your q3 -- if so apologies. You shouldn't generally run your AI model directly on your web server, but instead run it on a dedicated server. Or just use an inference service like Together, Fireworks, Lepton, etc (or use OpenAI/Anthropic etc). Then use async on the web server to talk to it. Thanks for pointing our the JS app walkthru mention - I'll update that to remove conda; we don't have ha…

I've added fasthtml (and its dependencies) to conda-forge, so it's available in conda/mamba now.

Re: FastHTML – Modern web applications in pure Python

#177

Sorry, but I hate server-side "helper" functions that generate HTML. For one thing it's never the same as what eventually gets shown on the page. 99.9% of the time you're missing attributes when needs to be hacked around. Debugging is a nightmare. Refactoring is hell. And css programmers have no clue what to do with this. Maybe I'm missing something here. Why not a templating engine?

> Why not a templating engine?

They are awkward to use, usually have a foreign syntax of its own and scale poor with dynamic languages (in terms of ability, not speed). But I also think this solution here is not that good either. It's ok for small stuff or purely tag-based output, but if you have many parameters, it becomes ugly really fast.

We've used those HTML-generators 20 years ago, and they were not really popular. I still use this still for bland XML today. But I can't see this scaling well for a complex website. Maybe there are some more features I've not seen in the documentation, but otherwise I think they should step up some more gears for this. But on the other side, I guess you are not forced to use the helper-functions. At the end they are probably just strings shoved around, so you can use whatever template-engine or string-generator you prefer.

Re: FastHTML – Modern web applications in pure Python

#179

Earlier quoted context omitted.

No. It's not in the spec, and in almost 30 years of web development, this might be the first time I've ever seen someone use a closing tag for it.

It's also not a tag, but an SGML (?) directive (specifically a https://en.wikipedia.org/wiki/Document_type_definition ) and so it is in fact invalid to produce a closing tag.

HTML5's HTML syntax is no longer SGML-based. It's still invalid but no longer because of anything related to SGML; now it's simply because the HTML5 spec says so.

Re: FastHTML – Modern web applications in pure Python

#180

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

I am really interested in the comparison of PHP vs. the hundreds of templating engines used in other languages.

PHP security issues (which may have been fixed in recent versions for all I know!) aside, is there anything that these modern frameworks can do that PHP cannot?

If one argues by corporate authority as done elsewhere in this thread. Facebook used PHP, so clearly it scales (probably much better than Python).

If anyone knows a resource (including books) that explores this topic in depth, I'd very much appreciate a link.

Post reply on HN