Add asyncio support to the Python SDK#57
Draft
kvz wants to merge 26 commits into
Draft
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## py310-v2 #57 +/- ##
============================================
+ Coverage 86.60% 96.58% +9.98%
============================================
Files 7 14 +7
Lines 209 849 +640
Branches 19 107 +88
============================================
+ Hits 181 820 +639
- Misses 28 29 +1
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:
|
Member
Author
|
Setting this back to draft while we expand the feature scope: the v2 PR should also cover the full Transloadit API endpoint surface before we treat it as ready. I added a matching @todo to the 2.0.0 CHANGELOG section so the release notes get updated once the endpoint coverage is complete. |
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.This branch is also the first SDK companion for the API2 contract generator work in https://github.com/transloadit/api2/pull/7928. Low-level endpoint methods that the current Python transport can honestly express are generated from API2 endpoint contracts and verified byte-for-byte from API2.
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 compatible with existing callers.api2-generated-endpointsblocks so API2 can rewrite them directly.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 run pytestapi2/bin/cli.ts contracts sdks --no-motd --platform python --include-generated --sdk-root ../python-sdk-asyncio --compare-existingapi2/bin/cli.ts contracts sdks --no-motd --platform python --sdk-root ../python-sdk-asyncio --rewrite-sdk --compare-existingThis PR is intentionally based on #56 and targets base branch
py310-v2.