Registry / type-stubs / types-ratelimit

types-ratelimit

JSON →
library2.2.0.20260508pypypiunverified

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-ratelimit
INSTALL
IMPORT
SIG · TYPES-RATELIMIT
T
types-ratelimit
type-stubspythonv2.2.0.20260508
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.2.0.20260508 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

limits
from ratelimit_stubs import limits
from ratelimit-stubs import limits

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.

import time from ratelimit import limits, sleep_and_retry # Define a period for rate limiting (e.g., 60 seconds) ONE_MINUTE = 60 @sleep_and_retry @limits(calls=5, period=ONE_MINUTE) def call_api(attempt: int) -> str: """Simulates an API call with rate limiting.""" print(f"Calling API - Attempt {attempt}") # Simulate some work # In a real scenario, this would make an external request return f"API response for attempt {attempt}" print("Starting API calls...") for i in range(1, 10): try: result = call_api(i) print(result) except Exception as e: print(f"Error: {e}") # Small delay to make output clearer, not part of ratelimit logic time.sleep(1) print("Finished API calls.")
Debug
Known issues
breakingType stubs from typeshed, including `types-ratelimit`, may introduce breaking changes to type checking even in minor updates, as they reflect evolving upstream libraries or typeshed's own typing improvements.
fix
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.
affects: All versions
gotchaThe `types-ratelimit` package provides type hints for the `ratelimit` library (specifically `tomasbasham/ratelimit`). If you are using a different rate-limiting library (e.g., `upstash-ratelimit` or `pyrate-limiter`), these stubs will not be applicable and may cause incorrect type-checking results or errors.
fix
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.
affects: All versions
gotchaTypeshed stubs, including `types-ratelimit`, are typically maintained to be compatible with a specific range of the runtime library's versions (e.g., `ratelimit==2.2.*`). Discrepancies between the stub version and your installed `ratelimit` version can lead to incorrect type checking or unannotated code.
fix
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.
affects: All versions
Upgrade
Version history
2.2.0.20260508latest on PyPI · released May 8, 2026
Audit
Dependencies
ratelimitrequiredProvides runtime functionality; these are typing stubs for that library.
Agent activity
43 hits · last 30 days
node
40
OpenAI (training)
1
Resources
types-ratelimit — pip install types-ratelimit · libregistry