[python] structured concurrency & trio? #3464
Replies: 5 comments 5 replies
-
Hi @thearchitector :) To be fair I'm not a python professional and I'll wait for additional and better input from the other in the team. But a few points - But I'm not sure everyone here will be familiar with those, especially considering that each team member has proficiency with a bunch of languages, but not with all. I think it would be very beneficial if you can bring more information, pros and cons, adoption, users needs, how it was handled in other projects etc. Besides that, few general points. At the moment, python sync is under development. So there's a current major work on python, and i think that further changes will need to be slowed down for a bit. The general rule is to not break compatibility. I would ask, that as part of the information we would love to see, to have an idea if such change can be overloaded, or to be optional, as opposed to complete rewrite. Our priorities are strongly derived from community input. |
Beta Was this translation helpful? Give feedback.
-
I also realized, after having given up the first time, that there is a way of using Trio sans the structural paradigms. Obviously you give up on most/all of the benefits, but doing so could be a more viable interm move that still allows the client to be used in user's legitimately structural applications (like my immediate use case). I threw a draft PR up here. |
Beta Was this translation helpful? Give feedback.
-
Sorry for the response delay. In recovery mode. Will answer as soon as I'm back on my legs. But something that might be missing conceptually in your approach. Glide is not the same as other clients. There's just one connection in use, in most cases, and you shouldn't close it, but reuse it. The option i see valid for that case is to create, similar to the Transaction object, and also for the transaction object, a command object, in which you can do: |
Beta Was this translation helpful? Give feedback.
-
The argument holds less ground from a feature perspective when taken only in-and-of-itself, that's definitely true. a transaction concept where someone is a lot closer to the actual calls seems like a stronger argument for adopting a structural approach in a more clear-cut manner. i could get behind that |
Beta Was this translation helpful? Give feedback.
-
closing as it is a task in progress. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'd love for python GLIDE to support the Trio async runtime. I started porting it over, but have run into some fairly fundamental complications resulting from the fact that the current python wrapper is pretty firmly rooted in unstructured concurrency (free-floating tasks, no strict cleanups or closures, etc.)
That is to say, I'm wondering what the general attitude toward breaking API changes is. I'm a pretty firm believer in structured concurrency and the benefits it provides in terms of state and error management, and would gladly do the work to migrate the client to it, but it would naturally result in a pretty drastic change in how the client can be used. Namely, and uncompromisingly, from:
to this, and all the downstream structural changes it implies in users' codebases:
As more and more libraries adopt an async-agnostic approach with AnyIO (FastAPI, Starlette, httpx, etc.), I'd be a bit bummed for this library to not be compatible with that trend.
Beta Was this translation helpful? Give feedback.
All reactions