-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
Description
Enhancement description
The TodoistAPIAsync class currently wraps synchronous API calls using run_async(lambda: self._api.method(...)). This approach does not truly make the operations asynchronous and introduces inefficiencies, such as blocking the event loop.
To properly support async functionality, the project should consider using httpx, which provides both sync (httpx.Client) and async (httpx.AsyncClient) interfaces. This would allow for a cleaner implementation of async API methods without relying on wrapping sync calls inside lambda functions.
The problem it solves
- Prevents event loop blocking: The current approach does not truly offload work asynchronously and could degrade performance in async environments.
- Simplifies the implementation: Removing unnecessary
lambdawrappers makes the codebase cleaner and easier to maintain. - Provides true async support: Using
httpxenables real async HTTP requests without requiring additional workarounds likerun_async.
Additional information
- The
httpxlibrary is well-supported and designed for both sync and async HTTP requests. - This change would improve compatibility with modern async frameworks while maintaining backward compatibility for sync users.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed