9 ms·
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 o
by adamredwoods 2y ago
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, I like to contain things.
- miohtama 2y agoPython 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.
- LudwigNagasena 2y agoThere 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.
- anentropic 2y ago"async def" is literally function colouring
- jna_sh 2y ago> And I assume Python cannot handle it's own HTTP server (using threads, similar to Javalin's virtual threads)? ASGI is an Interface standard, not an implementation in another language. The AGSI compliant servers that Blacksheep recommends are both written in Python.
- runjake 2y agoNitpick: If you're going to use ASGI with Flask, consider using Quart[1] instead[2], which aims to be Flask with better async. 1. https://quart.palletsprojects.com/en/latest/ https://quart.palletsprojects.com/en/latest/ 2. https://flask.palletsprojects.com/en/stable/async-await/#async-await https://flask.palletsprojects.com/en/stable/async-await/#asy...
- stackskipton 2y agoThere 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.
- paiute 2y agoIt has dependency injection
- intalentive 2y agoStarlite rebranded to Litestar btw, to avoid confusion with Starlette. It’s really nice too.
- dec0dedab0de 2y agoASGI, 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.
- chasd00 2y agoit'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...
- anentropic 2y agofrom 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