typesense-python
typesense-python copied to clipboard
feat: add async support
Change Summary
This PR migrates the Typesense Python client from requests to httpx and adds async support across all client components. The library now supports both synchronous and asynchronous operations.
Core Changes
- Migrate HTTP client from
requeststohttpxfor sync operations - Add
AsyncApiCallclass for async HTTP operations - Refactor
RequestHandlerto support both sync (httpx.Client) and async (httpx.AsyncClient) clients - Update test dependencies: replace
requests-mockwithrespxfor mocking httpx requests - Add
pytest-asynciofor async test support
Async Client
- Add
AsyncClientclass as the main entry point for async operations - Add async versions of all resource classes
Type System Improvements
- Make
TDocTypeVar covariant inCollectionandCollectionsclasses for better type flexibility - Remove redundant
from __future__ import annotationsimports
Testing
- Add async test fixtures for all async components
- Add async integration tests mirroring existing sync tests
- Remove redundant mocked tests in favor of integration tests
Dependencies
- Add
httpxas core dependency - Add
respxandpytest-asynciofor testing - Update various dependency versions
Notes
- All async classes follow the same API patterns as their sync counterparts
- The async client supports async context management via
async with
PR Checklist
- [x] I have read and signed the Contributor License Agreement.