encode / starlette

The little ASGI framework that shines. 🌟
https://www.starlette.io/
BSD 3-Clause "New" or "Revised" License
10.31k stars 949 forks source link

Who uses Trio? #2661

Closed Kludex closed 3 months ago

Kludex commented 3 months ago

Hi there,

I'm creating this issue to find out how many developers are actually using Starlette with Trio.

If you use trio, can you please give a 🚀, and comment here? If you use AsyncIO, please give a 🎉 .

rafalkrupinski commented 3 months ago

I thought you meant it rhetorically ;)

adriangb commented 3 months ago

For what it's worth I like using anyio regardless of if we support Trio or not. The APIs are much nicer than plain asyncio.

rafalkrupinski commented 3 months ago

You do realise that anyio calls sniffio for every single call

adriangb commented 3 months ago

Not really. But how is that consequential? Are you worried about performance?

adriangb commented 3 months ago

cc @Zac-HD

rafalkrupinski commented 3 months ago

Some people are. httpx is just refactoring to allow loop impl to be pluggable - anyio/asyncio/trio anyio is also about to introduce means to lock a loop implementation.

adriangb commented 3 months ago

httpx is just refactoring to allow loop impl to be pluggable - anyio/asyncio/trio

Isn't that... the whole point of anyio? I'm obviously missing context so sorry if I am misunderstanding but my first impression is that it sounds like reinventing the wheel.

If those calls are an such a big issue, maybe those concerned should make an issue on the anyio issue tracker? It seems like the kind of thing that can easily be cached.

rafalkrupinski commented 3 months ago

Isn't that... the whole point of anyio?

Seems to be a common misconception

If those calls are an such a big issue, maybe those concerned should make an issue on the anyio issue tracker?

like this one?

It seems like the kind of thing that can easily be cached.

Well they say it can't be cached in general case, since you might be running both trio and asyncio loops at the same time, so your code that uses anyio could run under either of them at any given time in the same runtime.

What's being implemented is you can make a pinky promise to anyio that you run only one kind event loop in your app, and it will crash if you break it.