python-server-sdk icon indicating copy to clipboard operation
python-server-sdk copied to clipboard

ASGI/Asyncio Support

Open dusty-phillips opened this issue 4 years ago • 16 comments

Is your feature request related to a problem? Please describe.

As far as I can tell, this SDK won't work with asyncio or asgi services due to the use of threading locks and queue.queue. This is preventing us from using it across all of our newer services.

Describe the solution you'd like

I'd like to see an async-first implementation where the launch darkly task is running in the background on the same event loop.

Describe alternatives you've considered

I'd also consider using the existing threaded mechanism, but provide async functions that don't rely on locks and the synchronous queue to request features when necessary.

I've considered wrapping the ld sdk in another thread and connecting it with async tasks using an asyncio.queue.

I've considered switching to a different feature flag provider.

Additional context

Is it possible I'm missing a different library? I was shocked to see that there was no asyncio first class citizen in the documentation in 2021, but maybe it hasn't been publicized yet.

dusty-phillips avatar Aug 18 '21 17:08 dusty-phillips

Async support has been requested before and it is certainly something we may add in the future, but as you can probably imagine, that would amount to a total rewrite of the SDK due to how concurrency is used throughout the code. The Python SDK codebase is older than many of the other SDKs, and was mostly written before async was available. Unfortunately I can't provide a time frame for this.

eli-darkly avatar Aug 18 '21 18:08 eli-darkly

Any update on this? ASGI and Async support is becoming ubiquitous at this point. My team is considering using LD but ASGI support is a hard requirement as we are using FastAPI.

JBogossianKH avatar Apr 05 '22 14:04 JBogossianKH

Sorry, there isn't an update. We understand that it's a desirable feature, but we haven't been able to prioritize a full rewrite of this SDK ahead of other projects. I'll mention your comment to the team since we do keep track of the level of customer interest.

eli-darkly avatar Apr 05 '22 17:04 eli-darkly

Any updates?

prussyuval avatar Jul 04 '22 15:07 prussyuval

@prussyuval No, there aren't any updates. I promise that we will post a comment here on this issue as soon as there is anything to say; that's the whole reason why we've left the issue open, so people can subscribe to it (and can see that it's already been requested).

eli-darkly avatar Jul 11 '22 17:07 eli-darkly

Any update?

rememberlenny avatar Jan 24 '23 20:01 rememberlenny

Yes, very interested in this too for python.

tom-hpe-hancock avatar Feb 24 '23 16:02 tom-hpe-hancock

we are stuck too :-(

mabreuortega avatar Jul 03 '23 17:07 mabreuortega

Any updates?

Juanito98 avatar Oct 24 '23 21:10 Juanito98

@eli-darkly @eplusminus @keelerm84 @keelerm84 No update for more than a year :worried:. Do you guys have any updates?

dor1202 avatar Oct 26 '23 07:10 dor1202

I'm wondering if this is not a huge concern for async python based on how launchdarkly is architected. As I understand based on the LD docs, evaluating a flag should not be a blocking I/O call. Instead, the client has a local copy of the flag values and evaluation is a very fast operation. If so, it shouldn't be an issue for async code, right? I'm not an expert here, so would appreciate if any of the maintainers could comment on this.

rolyv avatar Feb 06 '24 20:02 rolyv

@rolyv They are doing sync requests in separate threads for streaming part of API

nikitagromov avatar Sep 18 '24 12:09 nikitagromov

This really needs to be a priority now. Hardly writing any synchronous code anymore. Even Django is heading mostly to async if you want support for websockets or channels. Any bot related stuff is all based on asyncio. This should be a priority.

adambirds avatar Nov 27 '24 02:11 adambirds

Do you have updates?

jcunhafonte avatar Mar 06 '25 10:03 jcunhafonte