types-ratelimit provides PEP 561 type stubs for the `ratelimit` library, enabling static type checking for projects using `tomasbasham/ratelimit`. It helps identify type-related issues before runtime by providing annotations for functions, classes, and methods. As part of the typeshed project, its releases are aligned with typeshed's update cadence and aim to match specific versions of the `ratelimit` library.
pip install types-ratelimitVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates basic usage of the `ratelimit` library with `types-ratelimit` providing static type checking. The `limits` decorator restricts the number of calls within a period, and `sleep_and_retry` ensures the function waits until the rate limit resets before retrying.
Pin your `types-ratelimit` version to a known good one (e.g., `types-ratelimit==X.Y.Z.YYYYMMDD`) or align it with the exact major.minor version of the `ratelimit` runtime library you are using. Regularly test type checking in your CI.
Ensure that the `ratelimit` library you intend to use for runtime execution is indeed `tomasbasham/ratelimit` (the one found on PyPI as `ratelimit`). If not, uninstall `types-ratelimit` and seek stubs specific to your chosen rate-limiting library, or write your own custom stubs if none exist.
Check the `types-ratelimit` metadata (e.g., on PyPI or typeshed's stats page) to identify the `ratelimit` versions it supports. Ensure your installed `ratelimit` package falls within this range.