Live data from Hacker News

FastHTML – Modern web applications in pure Python

fastht.ml

11–20 of 229 posts

Re: FastHTML – Modern web applications in pure Python

#11
Nice work! I think the Python community definitely needs something like this. The thought never occurred to me to use HTMX w/Python for both server rendered HTML and dynamic behavior in the browser.

I have a few questions for you.

1. Why do you recommend conda or pip and not uv? Is this because the plug and play deployment platforms are configured to use pip?

2. Do you plan to make this “batteries included” like Django? E.g. it looks like currently you have to manage database schema and migrations outside of FastHTML.

3. Perhaps not in scope for this, but it seems to me making LLM API requests in the FastHTML backend could cause some scaling problems since these i/o operations can take a really long time and tie up the same threads required to render web pages. Any thoughts on that?

EDIT: Added third question.

Re: FastHTML – Modern web applications in pure Python

#12

Nice work! I think the Python community definitely needs something like this. The thought never occurred to me to use HTMX w/Python for both server rendered HTML and dynamic behavior in the browser. I have a few questions for you. 1. Why do you recommend conda or pip and not uv? Is this because the plug and play deployment platforms are configured to use pip? 2. Do you plan to make this “batteries included” like Djan…

1. I don't think we mention conda afaict? We suggest pip since it's already available and works fine, and most people are familiar with it. uv works fine too, but we always like to show how to do things the way with the fewest steps and that the most people will already know about.

2. We plan to include batteries in situations where it results in something better than just using some pre-existing project. So for DBs for instance we created Fastlite (a thin wrapper around sqlite-utils) since that particular API works best with FastHTML projects. You can use `transform` for simple migrations BTW. For more complex ones, we're planning to add support for sqlalchemy/alembic and other systems

3. We recommend using async for LLM API requests (which is supported by FastHTML, thanks to ASGI/Uvicorn/Starlette), although you can also use threads. uvicorn supports running multiple workers too. So there's lots of scaling options

Re: FastHTML – Modern web applications in pure Python

#13
Hey, just looking this quickly, the ideal case are for python developers that don't use Flask or Django? I'm a web developer for just 10 years, and I like seeing HTMX being applied, but I don't see why I should consider adopt it.

Maybe I'm not the ideal user, but would like to know from you who do you think this is for.

Re: FastHTML – Modern web applications in pure Python

#15
post #12

Nice work! I think the Python community definitely needs something like this. The thought never occurred to me to use HTMX w/Python for both server rendered HTML and dynamic behavior in the browser. I have a few questions for you. 1. Why do you recommend conda or pip and not uv? Is this because the plug and play deployment platforms are configured to use pip? 2. Do you plan to make this “batteries included” like Djan…

1. I don't think we mention conda afaict? We suggest pip since it's already available and works fine, and most people are familiar with it. uv works fine too, but we always like to show how to do things the way with the fewest steps and that the most people will already know about. 2. We plan to include batteries in situations where it results in something better than just using some pre-existing project. So for DBs…

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), but maybe not. To do date I’ve been moving LLM i/o workloads to background jobs on different machines with Celery, but it’s a bit more work and also makes streaming impossible. I recently did a Qwik + Celery stack for heavy LLM use, but have wanted a pure Python solution.

Thank you!

Re: FastHTML – Modern web applications in pure Python

#16
post #14

does this integrate with django?

This seems like the path to widest adoption. Focus on building an “HTMX component” library and just use Django, and not recreating a less battle tested Django.

Like, just using htpy [1] with Django and some minor component abstraction seems like it might already be a feature complete version of this.

[1] https://htpy.dev/

Re: FastHTML – Modern web applications in pure Python

#19
post #12

Earlier quoted context omitted.

1. I don't think we mention conda afaict? We suggest pip since it's already available and works fine, and most people are familiar with it. uv works fine too, but we always like to show how to do things the way with the fewest steps and that the most people will already know about. 2. We plan to include batteries in situations where it results in something better than just using some pre-existing project. So for DBs…

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 have FastHTML up as a conda lib yet! I also updated it to clarify we're not actually recommending any particular package manager.

Re: FastHTML – Modern web applications in pure Python

#20
post #16
post #14

does this integrate with django?

This seems like the path to widest adoption. Focus on building an “HTMX component” library and just use Django, and not recreating a less battle tested Django. Like, just using htpy [1] with Django and some minor component abstraction seems like it might already be a feature complete version of this. [1] https://htpy.dev/

Both of the co-authors of the popular book series "Two Scoops of Django" are now FastHTML users and contributors, and they tell me that they're able to reduce the complexity of their Django software by quite a lot by rewriting in FastHTML.

Django is fantastic and I'm a big fan, but it's gotten over-complicated in recent years IMO and isn't explicitly designed to work well with HTMX or ASGI. Using it with htpy and htmx is a totally reasonable option for folks that already know Django well, but it's not going to be quite the same thing as using FastHTML.

Post reply on HN