BSD Ports

net/py-pyrate-limiter 4.5.0 NetBSD

Rate-Limiter using Leaky-Bucket Algorithm

System
NetBSD
Repository
pkgsrc
Maintainer
[email protected]
Last update
Commit
2d4aadb7f3
License
mit
Categories
net, python
Package size
97.4 KiB, 569.1 KiB installed

Description

The request rate limiter using Leaky-bucket Algorithm.

* Supports unlimited rate limits and custom intervals. * Separately tracks limits for different services or resources. * Manages limit breaches with configurable blocking or non-blocking behavior. * Offers multiple usage modes: direct calls or decorators. * Fully compatible with both synchronous and asynchronous workflows. * Provides SQLite and Redis backends for persistent limit tracking across threads or restarts. * Includes MultiprocessBucket and SQLite File Lock backends for multiprocessing environments.

Version history 1

  1. 4.5.0 2d4aadb7f3

Upstream's version as each commit to the port's Makefile set it, or as this site first saw it in the system's packages; the tree's own revisions are not versions here.

Install

Binary package:

pkgin install py311-pyrate-limiter

From pkgsrc:

cd /usr/pkgsrc/net/py-pyrate-limiter && make install clean

Packages

The version each package repository carries. “-” means the repository builds no package of it, “n/a” that there is no such repository.

RepositoryVersion
NetBSD 10.1 x86_644.5.0
NetBSD 10.1 aarch644.5.0
SmartOS / illumos x86_644.5.0
macOS 15 arm644.5.0

Dependency graph

Ports that need it on the left, what it needs to run on the right; at most 8 of each. "Dependencies" below lists them all.

Dependencies

Run dependencies 2

Configuration

No options to configure.

Service scripts
none
Flavors
py312-pyrate-limiter-4.5.0, py313-pyrate-limiter-4.5.0, py314-pyrate-limiter-4.5.0

Commit history 1

DateCommitCreditsLog message
2d4aadb7f3 adam py-pyrate-limiter: updated to 4.5.0
4.5.0 Pluggable rate-limiting algorithms. Additive — no breaking public API changes; the default behaviour of every existing bucket is unchanged. Added - **`GCRA` / `TokenBucket` algorithms, and `StateBucket` to run them.** These keep a couple of numbers per key instead of one entry per consumed unit, so storage does not grow with traffic and the wait is exact without any lookup. `TokenBucket` *is* `GCRA` under a familiar name — one implementation, not two. ```python from pyrate_limiter import Duration, Limiter, Rate, StateBucket, TokenBucket limiter = Limiter(StateBucket([Rate(5, Duration.SECOND, burst=10)], algorithm=TokenBucket())) ``` Stores: `InMemoryStateStore`, `MultiprocessStateStore`, and `RedisStateStore` …