Closed blockchainunchained closed 6 months ago
I think we should proceed with moving this to production once httpx is stable
Agreed, I'm using this branch to power the ticker at /r/ethfinance and it's stable for my use but I'm not doing anything crazy or weird.
@blockchainunchained is there any change on the public API with this case? If not, what are the benefits from this change? If yes, should we add some more info in the README?
@spiderjako can you, please, take a look at this PR and see if you have some comments?
No changes to the public API, this simply uses HTTPX (who will be releasing 1.0 shortly, API should already be stable) instead of Requests. HTTPX is designed to be a drop in replacement for requests but allows asynchronous projects to not block their main thread when trying to interact with SanBase via SanPy.
I've not pulled the latest HTTPX or the latest SanPy recently so don't merge this until I've had a chance to test it (and also we should wait until HTTPX goes 1.0).
No documentation updates are required because if an event loop is not detected one is created internally so it doesn't matter whether you are running synchronous Python code or asynchronous Python code, or at least that is my understanding of it anyway.
I'm fairly busy with other stuff right now but I will update when HTTPX release 1.0
@blockchainunchained, @valo
Maybe would be best to close the PR now and re-open when HTTPX release 1.0?
I've been keeping this up to date with the latest HTTPX and I'm more than happy to continue doing so until the final version of HTTPX is released. Other than artificially lowering the pull request count what is the advantage to closing this pull request prematurely?
You can just put a WIP
label on it and leave it open
It doesn't look like labels are set up.
Do you mean edit the title? If so should it prefix or postfix the existing title?
I've created this label
httpx
still has no 1.0 version ~5 years later.
Over the years since this PR was opened we've did some work in the async direction:
After some discussion internally, we decided that we don't want to replace the internals as done in this PR. One of our experienced Python developers has the following concerns:
httpx
still hasn't reached stable release (latest version is 0.27.0)ThreadPoolExecutor
+ loop.run_in_executor
solution to wrap our execute calls to unblock main thread, while sanpy
fetches dataIf we still find the need to do something similar to the PR, we'll do it as an alternative implementation to the existing one, and users of the library can choose what to do.
Add httpx and then use it to support async clients.