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-2/

{
  "context": "This criteria evaluates how well the engineer uses the pyrate-limiter package's basic limiter API to implement rate limiting functionality. The focus is on proper usage of the Rate class for defining rate limits, the Limiter class for managing rate limiting operations, and the try_acquire method for controlling request flow with both blocking and non-blocking modes.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Rate definition",
      "description": "Uses the Rate class to define rate limits with proper limit count and time interval (e.g., Rate(5, Duration.MINUTE) or Rate(3, Duration.SECOND))",
      "max_score": 20
    },
    {
      "name": "Limiter initialization",
      "description": "Creates Limiter instance properly, passing Rate objects and optionally a bucket backend (e.g., Limiter(rate) or Limiter(rate, bucket))",
      "max_score": 20
    },
    {
      "name": "try_acquire usage",
      "description": "Uses the try_acquire method with appropriate parameters including identity/name and blocking parameter (e.g., limiter.try_acquire(client_id, blocking=True))",
      "max_score": 25
    },
    {
      "name": "Blocking mode",
      "description": "Correctly implements blocking behavior by setting blocking=True in try_acquire, allowing the method to wait until a request can proceed",
      "max_score": 15
    },
    {
      "name": "Non-blocking mode",
      "description": "Correctly implements non-blocking behavior by setting blocking=False in try_acquire, enabling immediate return of True/False without waiting",
      "max_score": 15
    },
    {
      "name": "Per-client routing",
      "description": "Properly uses different identity/name values for different clients in try_acquire to maintain separate rate limit tracking for each client",
      "max_score": 5
    }
  ]
}

Install with Tessl CLI

npx tessl i tessl/pypi-pyrate-limiter

tile.json