[FEATURE] Add asyncio support
Problem Statement The Python SDK uses synchronous IO through the requests library today. With Python's threading model, it is not possible to write performant, parallelizable applications using the SDK without some form of non-blocking IO, in which many requests could be made concurrently.
Proposed Solution Asyncio support should be added to the Python SDK. One possibility would be to introduce an AsyncWorkspaceClient and AsyncAccountsClient where methods on these clients are async.
Additional Context ...
Can we please consider using AnyIO[1] rather than asyncio? This would allow the user to decide what async library to use (asyncio or trio currently).
[1] https://anyio.readthedocs.io/en/latest/
@judahrand anyio is not part of standard library, so it is not really considered.
@nfx requests is also not part of the standard library but is used. If you're going for a zero dependency package why not use urllib3? What is the reason for only using the standard library?
Additionally, I push you to at least consider AnyIO and do your own research on the topic. Many packages use it - some of the most well known being Starlette and FastAPI.
If you're going for a zero dependency package why not use urllib3?
-
HTTP_PROXYenvironment variable and the handling of it. - Connection pooling and the handling of it.
P.S.: urllib3 is also a third-party package.
P.S.:
urllib3is also a third-party package.
Right you are! I misspoke - I meant urllib
The arguments for the use of requests are basically the same as for any other third party package: "It implements code that we would prefer to not implement and maintain ourselves." It isn't clear to me why this is different to any other package?
HTTP_PROXYenvironment variable and the handling of it.
This is handled by urllib, I believe: https://docs.python.org/3/library/urllib.request.html#urllib.request.getproxies
Has anyone made any progress on this? We're hitting a model serving endpoint inline from a FastAPI server, and it's hard to believe there's no async implementation years later; asyncio.to_thread() is only so scalable.
ditto @jonahharris, we ended up having to use a http module w/async support instead of the databricks-sdk in our fastapi app when dispatching on model serving endpoints.