pyrate-limiter
Python Rate-Limiter using Leaky-Bucket Algorithm
Decision gist · record as of 2026-08-14
Yes. PyrateLimiter is a mature, well-maintained library with zero known vulnerabilities, no runtime dependencies, and permissive licensing. It solves a common problem (rate limiting) with a clean API that works seamlessly in both sync and async code. Install it if you need to enforce request quotas or throttle access to resources.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later.
- Low friction: pure Python wheel with no runtime dependencies.
- Active maintenance with a recent release (61 days ago) and 512 repository stars.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal obligations.
last release 2026-06-14 (61 days) · last repo commit 2026-06-14 · 512 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 7,896,876 downloads/mo, #1,683 on PyPI
Alternatives
Verify before relying
pip install pyrate-limiter
from pyrate_limiter import Duration, Rate, Limiter
limiter = Limiter(Rate(5, Duration.SECOND * 2))
limiter.try_acquire("my-resource")- Performance characteristics under high concurrency or with large numbers of keys
- Behavior and overhead of each backend option (in-memory vs. Redis vs. Postgres) at scale
- Exact semantics of the leaking mechanism and background cleanup scheduling
What it is and what it does
PyrateLimiter is a rate-limiting library that enforces request quotas using the Leaky-Bucket algorithm. It allows you to define multiple simultaneous rate limits (e.g., 5 per second and 1000 per hour) on the same key, and routes each key to a bucket that tracks and throttles incoming requests. The library works in both sync and async contexts, offering blocking (wait for a permit), non-blocking (fail fast), and timeout-based acquisition modes.
The package supports multiple storage backends: in-memory buckets for single-process use, SQLite for persistence, Redis (sync and async) for distributed systems, Postgres for shared state, and multiprocessing for worker pools. You can use it directly via `try_acquire()` calls, as a decorator on functions, or as a context manager. The same API works identically in sync and async code paths without blocking the event loop.
Use it for
- Enforce API rate limits on web services (e.g., 100 requests per minute per user)
- Throttle background job workers to avoid overwhelming downstream services
- Distribute rate limits across multiple processes or machines using Redis or Postgres
- Implement per-resource quotas in multi-tenant applications with independent tracking
- Decorate async functions to prevent concurrent request spikes without blocking
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
PyrateLimiter is a mature, well-maintained library with zero known vulnerabilities, no runtime dependencies, and permissive licensing. It solves a common problem (rate limiting) with a clean API that works seamlessly in both sync and async code. Install it if you need to enforce request quotas or throttle access to resources.
Install
pyrate-limiter on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Active maintenance with a recent release (61 days ago) and 512 repository stars. Supports Python 3.10 through 3.14.
Requires Python 3.10 or later.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects with minimal obligations.
Quickstart
pip install pyrate-limiter
from pyrate_limiter import Duration, Rate, Limiter
limiter = Limiter(Rate(5, Duration.SECOND * 2))
limiter.try_acquire("my-resource")
Verify before relying
- Performance characteristics under high concurrency or with large numbers of keys
- Behavior and overhead of each backend option (in-memory vs. Redis vs. Postgres) at scale
- Exact semantics of the leaking mechanism and background cleanup scheduling
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 61 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 7,896,876 / month, #1,683 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: DocumentationTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed |
Evidence: pyrate_limiter-4.4.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “per-key rate limits”
- pyrate-limiterPyrateLimiter implements the Leaky-Bucket rate-limiting algorithm…
- httpx-limiterProvides rate-limited HTTP transports for httpx clients, supporting…
- asgi-ratelimitAn ASGI middleware that enforces rate limits on HTTP requests by user…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also requests-ratelimiter · rush · fastapi-limiter · throttled-py · httpx-limiter · aiolimiter · asynciolimiter · limits · slowapi · upstash-ratelimit