Live data from Hacker News

BlackSheep: Fast ASGI web framework for Python

github.com

31–40 of 49 posts

Re: BlackSheep: Fast ASGI web framework for Python

#31

Nobody seems to be asking why Python doesn't have the equivalent of Go's net/http. I think Django is justified given how powerful it is, but these micro-frameworks are ridiculous.

It's not production ready but, Python has had http.server for a long, long, long time.

https://docs.python.org/3/library/http.server.html#module-ht...

Re: BlackSheep: Fast ASGI web framework for Python

#32
post #21

Are there any good alternatives to gunicorn out there that don't require async? We're not ready to migrate everything to async, but gunicorn's forking model is blowing up on macOS 15.

FastAPI uses uvicorn which is ASGI, but you can choose to implement endpoints as either async or sync. I have implemented servers using both styles. Very pleasant to work with, and everything is type hinted, which is a must for me in any serious Python project.

You don't want to use uvicorn with synchronous views though or you're limited to a single request in flight.

If for some reason you need to mix sync/async views (maybe during a migration) you can use uvicorn as a gunicorn worker type, and run multiple workers. But your async views will still scale much better.

Re: BlackSheep: Fast ASGI web framework for Python

#34

I was trying to see the value of this as well, but I don't know Python well enough. Maybe there is no ASGI for python? And I assume Python cannot handle it's own HTTP server (using threads, similar to Javalin's virtual threads)? I always cringe when a programming language needs to find another solution/language to handling its processes. I understand why you will need a load balancer, but for small, simple projects,…

There is plenty. FastAPI, Starlite and Flask are all ASGI. Yes, Python has its own ASGI HTTP Servers, Uvicorn and Hypercorn are two most common. I agree, I'm not sure what this project aims to fix over other more established projects.

Starlite rebranded to Litestar btw, to avoid confusion with Starlette. It’s really nice too.

Re: BlackSheep: Fast ASGI web framework for Python

#35
post #16

Earlier quoted context omitted.

I have just recently been looking into this. What would you normally reach for when doing templating?

HTML-based templating is toxic to a codebase, especially django templating. It is untyped, impossible to compile and trust, and it's horrible to maintain. Use React and JSX (TSX, to be more specific). NextJS does good quality SSR, use that if you want an app that is also usable without JS. Anybody not in that ecosystem /right now/ is going to be lagging behind by so much in velocity and capability, and will get eaten…

This simply isn't true.

I see the velocity, but high magnitude doesn't mean that you're going the right direction.

Re: BlackSheep: Fast ASGI web framework for Python

#37

Feels like an in-between library that I'm not sure has a great fit in the current Python BE environment. It's not as batteries-included as Django, primarily because Django's the incumbent and the ecosystem is vast. It's not as modular and independent as Flask, which it's taking a lot of inspiration from. It doesn't seem to bring enough to the table to be flat out better all-rounder than FastAPI. I'm quite unsure wher…

FastAPI also supports dependency injection.

Was quoting the library's docs.

I've actually used FastAPI's DI, which is a nice convenience. It didn't feel as a big selling point, again, due to this being Python. Wrapping up your own DI is near trivial, and barely feels like a pattern.

Thanks for pointing that out, I didn't even realize last night how weak of a selling point this is, even.

Re: BlackSheep: Fast ASGI web framework for Python

#38
post #16

Earlier quoted context omitted.

I have just recently been looking into this. What would you normally reach for when doing templating?

HTML-based templating is toxic to a codebase, especially django templating. It is untyped, impossible to compile and trust, and it's horrible to maintain. Use React and JSX (TSX, to be more specific). NextJS does good quality SSR, use that if you want an app that is also usable without JS. Anybody not in that ecosystem /right now/ is going to be lagging behind by so much in velocity and capability, and will get eaten…

I agree that HTML templating is toxic. But there are other ways, like htpy or htmy etc. Basically server side HTML rendering. This is what makes me interested in focused frameworks like this.

Re: BlackSheep: Fast ASGI web framework for Python

#39

Earlier quoted context omitted.

HTML-based templating is toxic to a codebase, especially django templating. It is untyped, impossible to compile and trust, and it's horrible to maintain. Use React and JSX (TSX, to be more specific). NextJS does good quality SSR, use that if you want an app that is also usable without JS. Anybody not in that ecosystem /right now/ is going to be lagging behind by so much in velocity and capability, and will get eaten…

This simply isn't true. I see the velocity, but high magnitude doesn't mean that you're going the right direction.

Like jumping off a building and bragging about how fast you're going.

Re: BlackSheep: Fast ASGI web framework for Python

#40
I enjoy building frameworks and libraries for fun, so kudos to you for that. At first glance, BlackSheep seems to combine the aspects of Flask, Django, and FastAPI. However, I’m a bit skeptical about its ability to coexist alongside them. The one feature I believe could drive the success of the next Python framework is the ability to operate in nogil mode.
Post reply on HN