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.
🔵 Tier A · Mergeable after minor fixes
This PR converts the Python SDK services and generated examples to async APIs backed by an httpx2/AnyIO transport. It adds async client lifecycle management, redirect handling, progress callbacks, chunked-upload coordination, dependency updates, and async test coverage. 933 of 950 changed files were too large to include in full.
Note Not approving while a bug finding is open: Progress callback errors cancel sibling uploads
Fix with agent prompt### Issue 1
appwrite/client.py:404
**Progress callback errors cancel sibling uploads**
If an async progress callback raises while other chunks are in flight, this exception escapes the worker and AnyIO cancels its sibling tasks. The previous executor waited for all futures, so this path can abort other chunk requests instead of letting them settle before the error is surfaced.
### Issue 2
README.md:139
**The error example uses an out-of-scope service**
The preceding request example now creates `users` inside its `main()`, so this later snippet references an undefined name when following the README examples as written. Create the service in this example or keep it in a scope shared with it.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.📂 Walkthrough · 8
Reviewed |
|
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. |
| last_result = chunk_result | ||
| if is_upload_complete(chunk_result): | ||
| final_result = chunk_result | ||
| await self._report_progress( |
There was a problem hiding this comment.
Progress callback errors cancel sibling uploads
If an async progress callback raises while other chunks are in flight, this exception escapes the worker and AnyIO cancels its sibling tasks. The previous executor waited for all futures, so this path can abort other chunk requests instead of letting them settle before the error is surfaced.
Prompt To Fix With AI
This is a comment left during a code review.
Path: appwrite/client.py
Line: 404
Comment:
**Progress callback errors cancel sibling uploads**
If an async progress callback raises while other chunks are in flight, this exception escapes the worker and AnyIO cancels its sibling tasks. The previous executor waited for all futures, so this path can abort other chunk requests instead of letting them settle before the error is surfaced.
---
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 def main(): | ||
| try: | ||
| user = await users.get(user_id='<USER_ID>') |
There was a problem hiding this comment.
The error example uses an out-of-scope service
The preceding request example now creates users inside its main(), so this later snippet references an undefined name when following the README examples as written. Create the service in this example or keep it in a scope shared with it.
Prompt To Fix With AI
This is a comment left during a code review.
Path: README.md
Line: 139
Comment:
**The error example uses an out-of-scope service**
The preceding request example now creates `users` inside its `main()`, so this later snippet references an undefined name when following the README examples as written. Create the service in this example or keep it in a scope shared with it.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.🟡 Minor · documentation · 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.Changes
httpxand swapasyncioforanyio, so the SDK runs on both asyncio and trioanyioto the package dependenciesrespx+ async transport and add async client, deprecation and integration test suitesBreaking changes
asyncand must be awaited; migration notes are documented in the READMETesting
python -m unittest discover -s testlocally: 1008 tests, all passingmainbefore the 27.1.0 regeneration, so it will need a rebase/regeneration pass once the overall approach is reviewed