Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

aiofreqlimit

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aiofreqlimit - npm Package Compare versions

Comparing version
0.2.1
to
0.2.2
+9
-9
PKG-INFO
Metadata-Version: 2.3
Name: aiofreqlimit
Version: 0.2.1
Version: 0.2.2
Summary: Frequency limit for asyncio

@@ -41,10 +41,10 @@ Author: Gleb Chipiga

Classifier: Framework :: AsyncIO
Requires-Dist: redis>=5.0.0 ; extra == 'redis'
Requires-Dist: pytest>=9.0.1 ; extra == 'test'
Requires-Dist: pytest-asyncio>=1.3.0 ; extra == 'test'
Requires-Dist: hypothesis>=6.148.1 ; extra == 'test'
Requires-Dist: pytest-cov>=7.0.0 ; extra == 'test'
Requires-Dist: pytest-mock>=3.14.0 ; extra == 'test'
Requires-Dist: redis>=5.0.0 ; extra == 'test'
Requires-Dist: testcontainers[redis]>=4.3.3 ; extra == 'test'
Requires-Dist: redis>=5.0.0,<6.0.0 ; extra == 'redis'
Requires-Dist: pytest>=9.0.1,<10.0.0 ; extra == 'test'
Requires-Dist: pytest-asyncio>=1.3.0,<2.0.0 ; extra == 'test'
Requires-Dist: hypothesis>=6.148.1,<7.0.0 ; extra == 'test'
Requires-Dist: pytest-cov>=7.0.0,<8.0.0 ; extra == 'test'
Requires-Dist: pytest-mock>=3.14.0,<4.0.0 ; extra == 'test'
Requires-Dist: redis>=5.0.0,<6.0.0 ; extra == 'test'
Requires-Dist: testcontainers[redis]>=4.3.3,<5.0.0 ; extra == 'test'
Requires-Python: >=3.11, <3.15

@@ -51,0 +51,0 @@ Project-URL: Homepage, https://github.com/gleb-chipiga/aiofreqlimit

@@ -7,3 +7,3 @@ [build-system]

name = "aiofreqlimit"
version = "0.2.1"
version = "0.2.2"
description = "Frequency limit for asyncio"

@@ -34,11 +34,11 @@ readme = "README.md"

[project.optional-dependencies]
redis = ["redis>=5.0.0"]
redis = ["redis>=5.0.0,<6.0.0"]
test = [
"pytest>=9.0.1",
"pytest-asyncio>=1.3.0",
"hypothesis>=6.148.1",
"pytest-cov>=7.0.0",
"pytest-mock>=3.14.0",
"redis>=5.0.0",
"testcontainers[redis]>=4.3.3",
"pytest>=9.0.1,<10.0.0",
"pytest-asyncio>=1.3.0,<2.0.0",
"hypothesis>=6.148.1,<7.0.0",
"pytest-cov>=7.0.0,<8.0.0",
"pytest-mock>=3.14.0,<4.0.0",
"redis>=5.0.0,<6.0.0",
"testcontainers[redis]>=4.3.3,<5.0.0",
]

@@ -48,34 +48,34 @@

lint = [
"basedpyright>=1.33.0",
"mypy>=1.18.2",
"ruff>=0.14.5",
"pytest>=9.0.1",
"pytest-asyncio>=1.3.0",
"pytest-mock>=3.14.0",
"redis>=5.0.0",
"hypothesis>=6.148.1",
"testcontainers[redis]>=4.3.3",
"basedpyright>=1.33.0,<2.0.0",
"mypy>=1.18.2,<2.0.0",
"ruff>=0.14.5,<0.15.0",
"pytest>=9.0.1,<10.0.0",
"pytest-asyncio>=1.3.0,<2.0.0",
"pytest-mock>=3.14.0,<4.0.0",
"redis>=5.0.0,<6.0.0",
"hypothesis>=6.148.1,<7.0.0",
"testcontainers[redis]>=4.3.3,<5.0.0",
]
test = [
"hypothesis>=6.148.1",
"pytest>=9.0.1",
"pytest-asyncio>=1.3.0",
"pytest-cov>=7.0.0",
"pytest-mock>=3.14.0",
"redis>=5.0.0",
"testcontainers[redis]>=4.3.3",
"hypothesis>=6.148.1,<7.0.0",
"pytest>=9.0.1,<10.0.0",
"pytest-asyncio>=1.3.0,<2.0.0",
"pytest-cov>=7.0.0,<8.0.0",
"pytest-mock>=3.14.0,<4.0.0",
"redis>=5.0.0,<6.0.0",
"testcontainers[redis]>=4.3.3,<5.0.0",
]
dev = [
"basedpyright>=1.33.0",
"build>=1.3.0",
"hypothesis>=6.148.1",
"mypy>=1.18.2",
"pytest>=9.0.1",
"pytest-asyncio>=1.3.0",
"pytest-cov>=7.0.0",
"pytest-mock>=3.14.0",
"redis>=5.0.0",
"testcontainers[redis]>=4.3.3",
"ruff>=0.14.5",
"twine>=6.2.0",
"basedpyright>=1.33.0,<2.0.0",
"build>=1.3.0,<2.0.0",
"hypothesis>=6.148.1,<7.0.0",
"mypy>=1.18.2,<2.0.0",
"pytest>=9.0.1,<10.0.0",
"pytest-asyncio>=1.3.0,<2.0.0",
"pytest-cov>=7.0.0,<8.0.0",
"pytest-mock>=3.14.0,<4.0.0",
"redis>=5.0.0,<6.0.0",
"testcontainers[redis]>=4.3.3,<5.0.0",
"ruff>=0.14.5,<0.15.0",
"twine>=6.2.0,<7.0.0",
]

@@ -130,3 +130,3 @@

[tool.tox]
requires = ["tox>=4.22", "tox-uv>=1.15"]
requires = ["tox>=4.22,<5.0", "tox-uv>=1.15,<2.0"]
env_list = ["py311", "py312", "py313", "py314", "lint"]

@@ -133,0 +133,0 @@

@@ -1,12 +0,35 @@

from collections.abc import Hashable
from __future__ import annotations
from collections.abc import AsyncIterator, Hashable
from textwrap import dedent as ddent
from typing import Final
from typing import Final, Protocol
from redis.asyncio import Redis
from redis.commands.core import Script
from ..params import FreqLimitParams
__all__ = ("GCRA_LUA", "RedisBackend")
__all__ = ("GCRA_LUA", "RedisBackend", "RedisClientProtocol", "ScriptProtocol")
# Local protocol copies of the minimal Redis surface we rely on.
# Mirrors the .pyi stubs we shipped, so type checkers stay happy even
# if external redis stubs are absent.
class ScriptProtocol(Protocol):
async def __call__(self, *, keys: list[str], args: list[float]) -> str: ...
class RedisClientProtocol(Protocol):
@classmethod
def from_url(
cls, url: str, *, decode_responses: bool = ...
) -> RedisClientProtocol: ...
def register_script(self, script: str) -> ScriptProtocol: ...
def scan_iter(self, *, match: str = "*") -> AsyncIterator[str]: ...
async def delete(self, *names: str | bytes | memoryview) -> object: ...
async def ttl(self, name: str | bytes | memoryview) -> int | float | None: ...
async def set(self, name: str | bytes | memoryview, value: object) -> object: ...
async def get(self, name: str | bytes | memoryview) -> object: ...
async def ping(self) -> object: ...
async def aclose(self) -> object: ...
# Lua script: single GCRA step + TTL handling (atomic on Redis).

@@ -83,3 +106,3 @@ #

self,
redis: Redis,
redis: RedisClientProtocol,
*,

@@ -95,7 +118,8 @@ prefix: str = "freqlimit:gcra:",

self._redis: Final[Redis] = redis
# Keep only the minimal protocol surface for type checkers.
self._redis: Final[RedisClientProtocol] = redis
self._prefix: Final = prefix
self._extra_ttl: Final = float(extra_ttl)
# Script object caches SHA and transparently uses EVAL/EVALSHA.
self._script: Script = redis.register_script(GCRA_LUA)
self._script: ScriptProtocol = redis.register_script(GCRA_LUA)

@@ -102,0 +126,0 @@ async def reserve(