Skip to content

Feature Parity: Add Cancellation Support to Python Package #41

Description

@AryanSharma48

Description

In PR #40 , native cancellation support was added to the TypeScript package (smooth-api-ts) allowing users to pass an AbortSignal to cancel requests and interrupt backoff delays immediately.

To maintain feature parity as defined in our Contributing guidelines, we need to implement equivalent cancellation behavior in the Python package (smooth-api-py).

Acceptance Criteria

  • Implement a mechanism to cancel requests and interrupt backoff delays in Python. (The idiomatic approach is usually properly handling asyncio.CancelledError when the wrapping task is cancelled, or accepting an asyncio.Event as a cancellation token).
  • Ensure that cancelling a request immediately breaks out of the retry loop and doesn't just trigger another retry.
  • Add unit tests verifying cancellation during the backoff sleep phase and pre-aborted states.
  • Update packages/smooth-api-py/README.md with usage examples.

Additional Context

  • Reference TS Implementation PR: feat: Add Abort Controller #40
  • Python does not have a 1:1 equivalent of AbortController. The implementation should feel native to Python asyncio patterns.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions