Repository navigation
Conversation
Use return_exceptions with asyncio.gather so a failed chunk's error is not raised while other chunk uploads are still in flight.
Replaces asyncio.gather/to_thread with anyio task groups and to_thread.run_sync. Retired HTTP clients are now closed in aclose() since anyio has no fire-and-forget tasks. Adds anyio dependency.
Emit warnings in a scoped context so caller filters are preserved. Add tests for sync and async decorators, warning attribution, and filter restoration.
Require all service methods, Client.call, and Client.chunked_upload to be awaited. Coroutine on_progress callbacks are also awaited. The SDK now requires Python 3.11 and uses httpx2 instead of requests. Client.aclose() and async context manager support are also documented.
Alias httpx to httpx2 before importing respx for root, service, and standalone test discovery. Treat falsey Appwrite Cloud error codes as unreachable responses.
The async client imports anyio, so an install without it fails at import time.
Every service method is a coroutine now, so the snippets await the call and run their main function.
A raising async progress callback escaped the chunk worker and cancelled in-flight sibling uploads. Capture it with the other failures so every chunk settles before the error surfaces.
|
This library is auto-generated by the Appwrite SDK Generator, and does not accept pull requests directly. To learn more about how you can help us improve this SDK, please check the contributing guide. |
🔵 Tier A · Mergeable after minor fixes
The SDK now uses an async HTTP transport and AnyIO-based chunk uploads, with service methods and examples converted to awaitable calls. The client gains async cleanup and context-manager support, while packaging metadata, deprecation handling, documentation, and tests are updated for the new design. 934 of 950 changed files were too large to include in full.
Note Not approving while a bug finding is open: Serialize async progress callbacks
Fix with agent prompt### Issue 1
appwrite/client.py:402-411
**Serialize async progress callbacks**
Previously, `progress_lock` held through each callback; these awaited callbacks can now overlap across chunk tasks and finish out of order. A callback that forwards progress to a UI or service can apply an older `sizeUploaded` after a newer update, or race on its own shared state.
### Issue 2
appwrite/client.py:418-420
**Exercise the Trio backend in tests**
The new async tests use `IsolatedAsyncioTestCase` and `asyncio`, so this task-group path is never exercised on Trio. Because Trio support is an explicit behavior change, a Trio-backed request or chunk-upload test would catch backend-specific incompatibilities that the current suite cannot.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.📂 Walkthrough · 6
Reviewed |
| await self._report_progress( | ||
| on_progress, | ||
| { | ||
| "$id": upload_id_header, | ||
| "progress": uploaded_size / size * 100, | ||
| "sizeUploaded": uploaded_size, | ||
| "chunksTotal": total_chunks, | ||
| "chunksUploaded": completed_count, | ||
| }, | ||
| ) |
There was a problem hiding this comment.
Serialize async progress callbacks
Previously, progress_lock held through each callback; these awaited callbacks can now overlap across chunk tasks and finish out of order. A callback that forwards progress to a UI or service can apply an older sizeUploaded after a newer update, or race on its own shared state.
Prompt To Fix With AI
This is a comment left during a code review.
Path: appwrite/client.py
Line: 402-411
Comment:
**Serialize async progress callbacks**
Previously, `progress_lock` held through each callback; these awaited callbacks can now overlap across chunk tasks and finish out of order. A callback that forwards progress to a UI or service can apply an older `sizeUploaded` after a newer update, or race on its own shared state.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.🟡 Minor · concurrency · Reply if this doesn't apply.
| async with anyio.create_task_group() as tg: | ||
| for chunk in chunks[1:]: | ||
| tg.start_soon(upload_remaining_chunk, chunk) |
There was a problem hiding this comment.
Exercise the Trio backend in tests
The new async tests use IsolatedAsyncioTestCase and asyncio, so this task-group path is never exercised on Trio. Because Trio support is an explicit behavior change, a Trio-backed request or chunk-upload test would catch backend-specific incompatibilities that the current suite cannot.
Prompt To Fix With AI
This is a comment left during a code review.
Path: appwrite/client.py
Line: 418-420
Comment:
**Exercise the Trio backend in tests**
The new async tests use `IsolatedAsyncioTestCase` and `asyncio`, so this task-group path is never exercised on Trio. Because Trio support is an explicit behavior change, a Trio-backed request or chunk-upload test would catch backend-specific incompatibilities that the current suite cannot.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.🟡 Minor · testing · Reply if this doesn't apply.
What does this PR do?
Fully migrates the generated Python SDK to an async-first design on top of
httpxandanyio, replacing the previous synchronous implementation.Supersedes #176, which was auto-closed before the review fixes could land in its head. This PR is based on the same branch and includes the fixes addressing both review comments:
usersservice it usesChanges
httpxand swapasyncioforanyio, so the SDK runs on both asyncio and trioanyioto the package dependenciesrespx+ async transport and add async client, deprecation and integration test suites, including regression coverage for sibling chunks when the progress callback failsBreaking changes
asyncand must be awaited; migration notes are documented in the READMETesting
python -m unittest discover -s testlocally: 1009 tests, all passingmainbefore the 27.1.0 regeneration, so it will need a rebase/regeneration pass once the overall approach is reviewed