Live data from Hacker News

BlackSheep: Fast ASGI web framework for Python

github.com

11–20 of 49 posts

Re: BlackSheep: Fast ASGI web framework for Python

#11

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,…

ASGI, and WSGI before it are standard interfaces for python web traffic.

it allows you to write an application (or in this case a framework) and have it work with multiple application webservers. I don’t know if java has an equivalent, but imagine if you could switch from tomcat to something else without changing any application code.

Re: BlackSheep: Fast ASGI web framework for Python

#12

What is the plus value vs a 'classical' equivalent like FastAPI ?

So as far as I can tell, this is basically a more modern Flask. It pulls in design lessons from FastAPI, but it's still more batteries included such as templating (jinja2) and authentication. Neat, but tbh I am very bearish on Python's future beyond APIs - templating html in Python is a terrible idea for anything larger than a hobby site, when you can have an API-first app with a React+Typescript frontend. And if you…

For Django, there's also django-bridge. This lets you build React apps that are backed by Django views/routing. You can also use Django's built-in authentication and forms which isn't easy with APIs.

Re: BlackSheep: Fast ASGI web framework for Python

#13
post #4

Earlier quoted context omitted.

Python has had threaded, multiprocessing and such web servers for 20 years now e.g. in the form of Apache's mod_wsgi. The async movement is recent, and optional in Python. There are benefits for async, but obvious downsides line coloured functions.

There is no true function colouring in Python. You can do `asyncio.run(async_function())` inside almost any sync function, or provide your own async shim.

"async def" is literally function colouring

Re: BlackSheep: Fast ASGI web framework for Python

#14

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,…

from the README:

> BlackSheep belongs to the category of ASGI web frameworks, so it requires an ASGI HTTP server to run, such as uvicorn, or hypercorn.

but uvicorn and hypercorn are both Python libraries

so no need to cringe

Re: BlackSheep: Fast ASGI web framework for Python

#15

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,…

ASGI, and WSGI before it are standard interfaces for python web traffic. it allows you to write an application (or in this case a framework) and have it work with multiple application webservers. I don’t know if java has an equivalent, but imagine if you could switch from tomcat to something else without changing any application code.

it's been a while ( 25-30 years ) but i think that was the whole point of Java servlets. Tomcat was the reference implementation but there were other application servers out there with more features that, in theory, you just upload your war file to and the application runs. I think one was named Glassfish but it's been a while...

Re: BlackSheep: Fast ASGI web framework for Python

#16

What is the plus value vs a 'classical' equivalent like FastAPI ?

So as far as I can tell, this is basically a more modern Flask. It pulls in design lessons from FastAPI, but it's still more batteries included such as templating (jinja2) and authentication. Neat, but tbh I am very bearish on Python's future beyond APIs - templating html in Python is a terrible idea for anything larger than a hobby site, when you can have an API-first app with a React+Typescript frontend. And if you…

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

Re: BlackSheep: Fast ASGI web framework for Python

#17
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 where I'd use it instead of one of those 3.

From searching through the documentation and trying to find it out, the primary "secret sauce" seems to be Dependency Injection, quite a hard sell for a Python framework.

Re: BlackSheep: Fast ASGI web framework for Python

#19

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.

I’ve started using Granian[0] recently with good results.

[0] https://github.com/emmett-framework/granian

Post reply on HN