Skip to content

Fully converted into Asynchronous. - #172

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

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

Conversation

@Xharry01X

Copy link
Copy Markdown

Go through all the code and test hope you guys allow this. This needs to be in python sdk

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.
@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 current test mocking bypasses the new HTTPX2 client, and the error-handling example is not valid as a standalone Python script; both are minor fixes before merge.

The SDK now exposes asynchronous service methods backed by an HTTPX2 async client, with explicit client shutdown and async file-upload support. The README, package requirements, and tests were updated for async usage.

58 of 74 changed files were too large to include in full.

Verdict New comments Fixed Still open
💬 Commented 2 0 0

Note

@Xharry01X does not have write access to this repository, so Hansi does not approve automatically. A maintainer can review and approve.

Finding Where
🟡 Use a mock transport compatible with HTTPX2 appwrite/client.py:44
🟡 Put the error-handling example inside a coroutine README.md:135
Fix with agent prompt
### Issue 1
appwrite/client.py:44
**Use a mock transport compatible with HTTPX2**

The service and client tests still use `respx`, which patches `httpx.AsyncClient` transports, while this constructs `httpx2.AsyncClient`; those requests bypass the mocks and can hit the default Appwrite endpoint. The tests also provide `httpx2.Response` objects where respx expects `httpx.Response`, so switch to a mock transport supported by HTTPX2 or adapt the test setup.

### Issue 2
README.md:135
**Put the error-handling example inside a coroutine**

This block shows `await` at module scope, which raises `SyntaxError` in a normal Python script. Wrap the example in `async def` and invoke it with `asyncio.run`, as in the request example above.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
📂 Walkthrough · 7
File Change
appwrite/client.py Replaced synchronous requests with HTTPX2 async transport and added client lifecycle and async chunk uploads.
appwrite/services/* Converted service API methods to async calls and awaited the shared client transport.
appwrite/utils/deprecated.py Updated deprecated-method wrapping to preserve coroutine behavior.
README.md Revised setup and API examples for async calls and client cleanup.
pyproject.toml, requirements.txt, setup.py Updated Python version and HTTP transport/test dependencies.
test/* Converted service tests to async and added transport, upload, and integration coverage.
.gitignore Added Python build, cache, and editor artifacts to ignore rules.

Reviewed 126ca1b · 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

def _new_http_client(self, verify):
context = _default_ssl_context() if verify else False
return httpx2.AsyncClient(verify=context, timeout=None)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use a mock transport compatible with HTTPX2

The service and client tests still use respx, which patches httpx.AsyncClient transports, while this constructs httpx2.AsyncClient; those requests bypass the mocks and can hit the default Appwrite endpoint. The tests also provide httpx2.Response objects where respx expects httpx.Response, so switch to a mock transport supported by HTTPX2 or adapt the test setup.

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

Comment:
**Use a mock transport compatible with HTTPX2**

The service and client tests still use `respx`, which patches `httpx.AsyncClient` transports, while this constructs `httpx2.AsyncClient`; those requests bypass the mocks and can hit the default Appwrite endpoint. The tests also provide `httpx2.Response` objects where respx expects `httpx.Response`, so switch to a mock transport supported by HTTPX2 or adapt the test setup.

---

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.

Comment thread README.md

try:
user = users.get(user_id='<USER_ID>')
user = await users.get(user_id='<USER_ID>')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Put the error-handling example inside a coroutine

This block shows await at module scope, which raises SyntaxError in a normal Python script. Wrap the example in async def and invoke it with asyncio.run, as in the request example above.

Prompt To Fix With AI
This is a comment left during a code review.
Path: README.md
Line: 135

Comment:
**Put the error-handling example inside a coroutine**

This block shows `await` at module scope, which raises `SyntaxError` in a normal Python script. Wrap the example in `async def` and invoke it with `asyncio.run`, as in the request example above.

---

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.

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