CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-pyrate-limiter

Python Rate-Limiter using Leaky-Bucket Algorithm for controlling request rates in applications with multiple backend storage options.

81

1.44x
Overview
Eval results
Files

rubric.jsonevals/scenario-3/

{
  "context": "This criteria evaluates how effectively the engineer uses pyrate-limiter's core limiter API, specifically the try_acquire method and related components, to implement rate limiting with blocking, non-blocking, and timeout behaviors.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Limiter initialization",
      "description": "Creates a Limiter instance, properly initializing it with a Rate object that defines the rate limit (e.g., Rate(limit=max_requests, interval=Duration.SECOND * time_window_seconds))",
      "max_score": 20
    },
    {
      "name": "Basic try_acquire usage",
      "description": "Uses the try_acquire method with the name parameter to acquire permits for rate-limited operations",
      "max_score": 15
    },
    {
      "name": "Non-blocking mode",
      "description": "Implements non-blocking behavior by calling try_acquire with blocking=False parameter, allowing immediate return when rate limit is exceeded",
      "max_score": 15
    },
    {
      "name": "Blocking mode",
      "description": "Implements blocking behavior by calling try_acquire with blocking=True parameter (or default), causing the method to wait until permits become available",
      "max_score": 15
    },
    {
      "name": "Timeout handling",
      "description": "Uses the timeout parameter in try_acquire to limit waiting time in blocking mode, properly handling the timeout by checking return value or catching exceptions",
      "max_score": 15
    },
    {
      "name": "Rate configuration",
      "description": "Properly uses Duration enum (e.g., Duration.SECOND) in conjunction with Rate class to configure time windows for rate limits",
      "max_score": 10
    },
    {
      "name": "Resource cleanup",
      "description": "Properly manages limiter lifecycle, either by using context manager (with statement) or explicitly calling close() method",
      "max_score": 10
    }
  ]
}

Install with Tessl CLI

npx tessl i tessl/pypi-pyrate-limiter

tile.json