Skip to content
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

Asyncio support? #19

Open
3 tasks done
jeffsawatzky opened this issue Oct 16, 2024 · 4 comments
Open
3 tasks done

Asyncio support? #19

jeffsawatzky opened this issue Oct 16, 2024 · 4 comments
Labels
enhancement New feature or request ready Issue has been triaged and accepted, ready to work

Comments

@jeffsawatzky
Copy link
Contributor

Acknowledgements

  • I have written a descriptive issue title
  • I have searched Issues to see if the feature has already been requested
  • If relevant, I have enabled debug mode and am attaching relevant console logs and HTML files

Describe the Feature

Would you be open to adding asyncio support using either httpx or aiohttp?

might help speed up loading as it is currently pretty slow.

Describe Alternative Solutions/Workarounds

Other options are using something like gevent maybe? But asyncio seems cleaner.

@jeffsawatzky jeffsawatzky added the enhancement New feature or request label Oct 16, 2024
@alexdlaird
Copy link
Owner

No plans to add this, but would be happy to consider a pull request. It doesn't seem like it'd be a huge lift, and the current tests for unit / integration should catch any regressions.

@alexdlaird alexdlaird added the good first issue Good for newcomers label Nov 3, 2024
@alexdlaird
Copy link
Owner

alexdlaird commented Nov 3, 2024

If anyone does pick this up to do it, I think I'd rather switch ot using httpx rather than modifying requests (or using grequests) to accomplish this, since that feels hacky. To start this work then, we'd first need to replace requests with httpx throughout the code (primarily in AmazonSession, since that's pretty coupled to requestsSession object (but the comparable way to do this inhttpx would be with its [Client`](https://www.python-httpx.org/advanced/clients/)).

The biggest lift beyond this will probably be refactoring tests, which currently very conveniently uses responses.activate to mock responses. I haven't looked in to what / if httpx has a good alternative to this, or if we're going to have to roll our own monkeypatch for each test.

Once the coupling with AmazonSession is replaced, the remaining code to add awaits is a pretty small lift from there.

@jeffsawatzky
Copy link
Contributor Author

For httpx there is pytest_httpx

Would you want both sync and async support, or are you ok with dropping sync altogether?

@alexdlaird
Copy link
Owner

Nice!

I think we'd want to maintain both, but I haven't thought about it enough to decide if users would lose anything they might miss if we dropped sync support ... I'll noodle on it, would be curious to know your thoughts.

@alexdlaird alexdlaird removed the good first issue Good for newcomers label Nov 7, 2024
@github-actions github-actions bot added the stale Issue will be closed automatically if no further activity occurs label Nov 16, 2024
@alexdlaird alexdlaird added ready Issue has been triaged and accepted, ready to work and removed stale Issue will be closed automatically if no further activity occurs labels Nov 16, 2024
Repository owner deleted a comment from github-actions bot Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ready Issue has been triaged and accepted, ready to work
Projects
Status: Triage
Development

No branches or pull requests

2 participants