Skip to content

Fully migrate SDK to async on httpx2 - #170

Closed
Xharry01X wants to merge 2 commits into
appwrite:mainfrom
Xharry01X:main
Closed

Xharry01X wants to merge 2 commits into
appwrite:mainfrom
Xharry01X:main

Conversation

@Xharry01X

Copy link
Copy Markdown

Make SDK operations async and migrate to httpx2

Rebuild the client on httpx2.AsyncClient and turn every service
method into an async def, so callers await instead of blocking.
Chunked uploads use asyncio.gather with a semaphore, and the
client doubles as an async context manager.

Swap the HTTP dependency from httpx to httpx2, the fork now
maintained by Pydantic, and raise the Python floor to 3.11 to
match its requirement.

Add end-to-end tests that drive the SDK against a real local
server over real sockets, covering concurrency, connection
pooling, multipart chunking and TLS.

@github-actions

Copy link
Copy Markdown

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.

@hansi-codes

hansi-codes Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

🔵 Tier A · Mergeable after minor fixes

The only finding affects cleanup and consistency on the less common path where a concurrent upload chunk fails.

The SDK now uses httpx2.AsyncClient, with service methods and chunked uploads exposed as async operations. It also adds async client cleanup, updates package requirements and usage examples, and adds async and real-socket integration coverage.

55 of 73 changed files were too large to include in full.

Verdict New comments Fixed Still open
💬 Commented 1 0 0

Note

Not approving while a bug finding is open: Wait for sibling chunk uploads after a failure

Finding Where
🟡 Wait for sibling chunk uploads after a failure appwrite/client.py:406
Fix with agent prompt
### Issue 1
appwrite/client.py:406
**Wait for sibling chunk uploads after a failure**

If one remaining chunk raises, `asyncio.gather` propagates it immediately without cancelling the other uploads. The caller can therefore see a failed upload while sibling requests are still writing, unlike the previous executor path, which waited for all submitted futures before returning.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
📂 Walkthrough · 5
File Change
appwrite/client.py Migrates requests to an async HTTP client and adds async chunk uploading, progress callbacks, and client lifecycle methods.
appwrite/services/*.py Converts service API methods to async and awaits client requests.
appwrite/utils/deprecated.py Preserves deprecation warnings for async service methods.
test/*.py Updates service tests for async calls and adds async-client and real-socket integration tests.
README.md, pyproject.toml, setup.py, requirements.txt, test/__init__.py, .gitignore Updates Python and HTTP dependencies, async usage guidance, test transport setup, and ignored artifacts.

Reviewed 894f3b2 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@github-actions github-actions Bot closed this Oct 26, 2026

@hansi-codes hansi-codes Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · See the inline comments. Summary

Comment thread appwrite/client.py
futures = [executor.submit(upload_remaining_chunk, chunk) for chunk in chunks[1:]]
for future in as_completed(futures):
future.result()
await asyncio.gather(*(upload_remaining_chunk(chunk) for chunk in chunks[1:]))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait for sibling chunk uploads after a failure

If one remaining chunk raises, asyncio.gather propagates it immediately without cancelling the other uploads. The caller can therefore see a failed upload while sibling requests are still writing, unlike the previous executor path, which waited for all submitted futures before returning.

Prompt To Fix With AI
This is a comment left during a code review.
Path: appwrite/client.py
Line: 406

Comment:
**Wait for sibling chunk uploads after a failure**

If one remaining chunk raises, `asyncio.gather` propagates it immediately without cancelling the other uploads. The caller can therefore see a failed upload while sibling requests are still writing, unlike the previous executor path, which waited for all submitted futures before returning.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

🟡 Minor · error-handling · Reply if this doesn't apply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant