Add asyncio support to the Python SDK#57
Open
kvz wants to merge 16 commits into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## py310-v2 #57 +/- ##
============================================
+ Coverage 86.60% 95.52% +8.91%
============================================
Files 7 11 +4
Lines 209 625 +416
Branches 19 81 +62
============================================
+ Hits 181 597 +416
Misses 28 28
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Issue #9 asks for a Pythonic asyncio surface without changing sync callers. This PR adds a separate
AsyncTransloaditAPI on top of the v2 runtime/security branch (#56) so async users can opt in without affecting the existing synchronous client.What changed
transloadit.async_client.AsyncTransloaditwith async versions of the existing client helpers.Responsewrapper that works for both sync and async responses.aclose()/close().TransloaditAPI untouched.TUS/resumable tradeoff
aiohttpdirectly.tuspyuploader, but throughasyncio.to_thread()so the event loop is not blocked. That keeps the implementation straightforward and honest about the sync TUS path.Testing
wait=Truepolling with mockedasyncio.sleep, async context-manager cleanup, and resumable upload delegation.poetry checkpoetry installpoetry run pytest testspoetry run sphinx-build -E -b html docs/source docs/_build/htmlpoetry run tox -e py314poetry buildbash -n scripts/test-in-docker.sh scripts/notify-registry.shgit diff --check./scripts/test-in-docker.sh --python 3.12This PR is intentionally based on #56 and targets base branch
py310-v2.