-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
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. |
Hello, I know the PRs can be difficult to review, that is why if you want to we could schedule a meet to work live together if you want to. Regards, |
Other than the possible decrease in async conversion burden, what benefits does niquests offer? Development on PRAW has slowed due to less changes happening with the public API so the benefits offered from less async conversion burden isn't going to change much in the long run. In fact, it is going to cause more work in the short term do consolidate the sync and async packages. At the moment, Bryce and I are pretty busy with life so it might be a while before we can decide to fully commit to niquests. If there isn't any benefits outside of less async burden, then I'm leaning towards sticking with requests and aiohttp. Lastly, nothing against you (I have to consider this with every PR to PRAW) but in general I'm apprehensive about switching to or adding a new dependency when the author is driving hard for its adoption (hence my question about the benefits). Given the recent uptick in supply-chain attacks, it's throwing a red flag for me. |
Hard to believe. But I am not shocked either.
I suppose you meant "What does Niquests brings to PRAW itself other than the lower async burden?"
It is not true. Yes there is work to do to achieve lower maintenance burden. Clearly deprecating two packages (asyncpraw, and asyncprawcore) will surely ends up in easier maintenance for sure. I explicitly said numerous times that I am willing to contribute and not throw you the remaining tasks solely in your hands.
There's no winning with this kind of argumentation. It is just weird in OSS to say something like this in a negative way. Anything else than "is driving hard for its adoption" would be perceived negatively also. Figure.
Don't take this the wrong way but you are clearly misinformed about the risks. Did you thought that Requests, or aiohttp or PRAW were safe? Or even better, GitHub itself. Today, from praw and asyncpraw you have 23 (unique) dependencies in the tree. And using Niquests instead would bring it down to 13. (counting asyncprawcore gone) What is weird is that it goes against your perception. I can see that you changed your mind. We passed from:
to:
Just, for a favour, don't do that to anyone else in the future. You clearly let the door open, and with time you asked things to be done your way on three different projects knowing fully the amount of work required (which I have fulfilled completely) when it seems like your last message makes it like you've just discovered the PRs. This is discouraging plenty of good people to work in OSS. It is me who is seeing the red flag now. I don't know what I can say more. Regards. |
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.