-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace Requests http client by Niquests and add built-in async support #186
base: main
Are you sure you want to change the base?
Conversation
We need to be able to pass |
This PR will take some thought as this is the first I've heard of Niquests. I'm generally a little weary of pulling in new packages, especially ones owned by individuals. I have a few questions: How many people have admin access to the repo, and what governs them? Who all can publish packages? |
Same concerns that @bboe has. From a technical standpoint, PRAW will also need to pass all of its tests with this as well. It's unlikely we will switch http clients unless our concerns are resolved and it makes maintaining the async version significantly easier. The async changes to PRAW would also need to be a drop in replacement for Async PRAW. |
Hello there, Thanks for your fast response.
Naturally.
We partnered up with Tidelift to ensure a source of income, also they handle the security part. They are reliable enough. We have gain enough trust (I hope) by managing project like charset-normalizer for example. If we partner up on this, we will be able to move closer to the said goals.
Maintaining the async part will be completely automatic after this PR. If you are willing to pursue this, I will manage a follow up PR that automatically generate this part like I have done in https://github.com/grafana-toolbox/grafana-client/blob/main/script/generate_async.py I am sure that this will make your life easier, and additionally be of service to the broader community.
I will look into it, but it should be. Regards, |
c60e91e
to
9d14800
Compare
We'll need to see if PRAW works with this (all tests pass) before proceeding as well. |
Do you need anything else from my part? regards, |
Would like to see it work with the async side of PRAW:
|
Done. praw-dev/asyncpraw#289
As I already stated, generating the async code AND the async tests are really challenging as per the 100% coverage constraint. I can generate the async code using a script, for sure, but I am less confident about the test suite to be generated along. Moreover, the async generation script is going to be doable in prawcore, not in praw or asyncpraw (due to the feature diff, asyncpraw isn't ISO with praw). In the long term, you could deprecate asyncpraw and generate the async part in praw instead. I definitely want to propose another PR, dedicated to the async generation so that I can solely focus on it. The work done in the three PRs should be a good starter point. WDYT? Regards, |
I updated praw to do the same as asyncpraw regarding websocket. I will wait for further instruction & reviews from your side. regards, |
This definitely looks promising! Give me time to review all the changes and discuss with @bboe about moving forward with this. I would like to see how the scripts to generate the async parts as that what will make this migration worthwhile. |
695bdc4
to
d52d0db
Compare
Hello again, I have just pushed an "experimental" async code generator in
It is not completed as we speak. But very close to be. I am proposing this preview so that you can decide whether you (maintainers) want to pursue this integration (aka. async generation) or not. I am waiting for your appreciations and feedback if any. Regards, |
d52d0db
to
7446620
Compare
7446620
to
bcd213e
Compare
The generator is complete for prawcore & integrated smoothly in pre-commit. |
Thanks for doing that! Give me some time to review this. |
This PR effectively replace the http client Requests for Niquests.
Niquests is a drop-in replacement for Requests that is no longer under feature freeze.
This new client support HTTP/2, and HTTP/3 by default and offers both sync and async interfaces. It supports all the latest shiny features you would expect from an http client.
If you were interested on merging, I will be interested to propose a followup PR that will propose a script that generate
the async part of prawcore automatically. If you want to.
Why make the switch?
I believe this will benefit you and your users:
disclaimer: I maintain Niquests.