pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/net/py-pyrate-limiter



Module Name:    pkgsrc
Committed By:   wiz
Date:           Tue Jun 23 11:42:43 UTC 2026

Modified Files:
        pkgsrc/net/py-pyrate-limiter: Makefile PLIST distinfo

Log Message:
py-pyrate-limiter: update to 4.4.0.

[4.4.0]

Bug-fix, scalability, and internal-refactor release. No public API changes (the new AbstractBucket.is_async attribute is additive).
Fixed

    InMemoryBucket: guard the internal item list with a lock so the background Leaker thread can no longer race put/peek/leak. This was a data race in the default configuration (in-memory bucket + 
scheduled leak). MultiprocessBucket aliases this lock to its shared cross-process lock. (#302)
    PostgresClock: when the DB time query fails, fall back to local wall-clock epoch time instead of monotonic time. The monotonic fallback was ~5 orders of magnitude smaller than the stored epoch-ms 
timestamps and would corrupt every window comparison and leak bound. (#302)
    Leaker: make the background sync-leak worker restartable. Re-registering a bucket after every bucket had been disposed previously raised RuntimeError: threads can only be started once. (#302)
    Keep Limiter picklable after the InMemoryBucket lock addition. (#302)

Performance & Scalability

    Limiter: release the limiter lock during the synchronous blocking wait, so a long wait on one key no longer serializes acquisitions for every other key sharing the limiter. (#304)
    RedisBucket: batch weighted ZADDs in bounded chunks inside the atomic Lua script, lowering latency for high-weight puts. (#284)

Internal / Refactor

    Unify the limiter's sync/async acquire plumbing into a single coroutine and share the delay-step decision across the sync and async branches. (#303)
    Add a declarative is_async bucket attribute so the Leaker no longer detects async by executing a side-effecting leak(0) probe. RedisBucket still probes because it may wrap either a sync or an 
async client. (#305)
    Introduce an internal Algorithm/Decision seam (SlidingWindowLog) that the built-in buckets delegate their per-rate admit decision and leak bound to — the foundation for pluggable algorithms (e.g. 
GCRA, sliding-window-counter) in a future release. (#307)

Documentation

    Document that RedisBucket keeps one sorted-set member per consumed unit, and that long-window / high-volume quotas may want a coarser counter-based backend for bounded memory. (#284)

CI

    The release workflow now also creates a GitHub Release for the pushed tag and attaches the built dist/* artifacts, in addition to publishing to PyPI.

[4.3.1]

Performance and maintenance release. No API or behavior changes.
Performance

    PostgresBucket: insert all weight unit-rows in a single statement (SELECT … FROM generate_series) instead of one INSERT per unit — ~3.4× faster weighted puts and a shorter EXCLUSIVE lock hold. 
(#296)
    PostgresBucket: compute every rate's windowed count in one query (COUNT(*) FILTER) instead of one round trip per rate — ~2× faster multi-rate checks, fewer round trips under the lock. (#297)
    SingleBucketFactory.wrap_item: inline the sync fast path (no per-acquire closures) — ~23% faster item wrapping on the hot path. (#296)
    Deduplicate the sync/async deadline math in _delay_waiter into a single shared helper. (#294)

Documentation

    Rewrite the README for accuracy, structure, and presentation, and replace the outdated architecture image with a component-level Mermaid diagram that renders on both GitHub and ReadTheDocs. 
(#293, #295)

CI

    Move GitHub Actions off the deprecated Node-20 runtime to Node-24 (checkout@v5, setup-python@v6, setup-uv@v7, upload-artifact@v6, download-artifact@v7). (#295)

[4.3.0]

Bug-fix and hardening release. It contains a few breaking changes that affect only edge or undocumented usage — see Breaking Changes below.
Breaking Changes

    Ill-formed rate lists now raise ValueError at bucket construction instead of being silently mis-enforced. A valid list is ordered by strictly increasing interval, with strictly increasing limits 
and non-increasing density (the "generous-before-tight" contract). (#239)
    binary_search has been removed from the public API. It was an undocumented internal helper, now replaced internally by the standard library bisect. (#290)
    PgQueries SQL templates now use bound %s parameters instead of the {offset} / {timestamp} format placeholders. (#233)

Security

    SQLite and Postgres backends no longer build SQL through string interpolation. The user-supplied item name (SQLite) and the table name (Postgres) are now bound/quoted, closing a SQL-injection 
vector and fixing crashes on names containing quotes or other metacharacters. (#233, #244)

Fixed

    Blocking try_acquire no longer busy-spins (burning CPU until the next background leak) or spuriously times out when buffer_ms=0; waiting() now clears the inclusive window lower bound correctly. 
(#289)
    try_acquire_async(timeout=0) now succeeds when capacity is available instead of always returning False. (#289)
    SQLite leak() no longer raises AttributeError when invoked on a closed connection during teardown (fixes the unstable test_sqlite_filelock_bucket). (#244)
    Rate lists are now consistently sorted by interval across all backends, fixing a latent leak() bug when unsorted rates were passed to the Redis, SQLite, or Postgres buckets. (#239)

Changed

    Replaced the custom binary_search with the standard library bisect. (#290)

Documentation

    Fixed stale v4 examples in the README (removed the long-gone clock=, raise_when_fail, and max_delay parameters) and documented how to use a custom / distributed clock in v4. (#261)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 pkgsrc/net/py-pyrate-limiter/Makefile \
    pkgsrc/net/py-pyrate-limiter/distinfo
cvs rdiff -u -r1.1 -r1.2 pkgsrc/net/py-pyrate-limiter/PLIST

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/net/py-pyrate-limiter/Makefile
diff -u pkgsrc/net/py-pyrate-limiter/Makefile:1.3 pkgsrc/net/py-pyrate-limiter/Makefile:1.4
--- pkgsrc/net/py-pyrate-limiter/Makefile:1.3   Mon Jun  1 08:05:59 2026
+++ pkgsrc/net/py-pyrate-limiter/Makefile       Tue Jun 23 11:42:42 2026
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.3 2026/06/01 08:05:59 adam Exp $
+# $NetBSD: Makefile,v 1.4 2026/06/23 11:42:42 wiz Exp $
 
-DISTNAME=      pyrate_limiter-4.2.0
+DISTNAME=      pyrate_limiter-4.4.0
 PKGNAME=       ${PYPKGPREFIX}-${DISTNAME:S/_/-/}
 CATEGORIES=    net python
 MASTER_SITES=  ${MASTER_SITE_PYPI:=p/pyrate-limiter/}
Index: pkgsrc/net/py-pyrate-limiter/distinfo
diff -u pkgsrc/net/py-pyrate-limiter/distinfo:1.3 pkgsrc/net/py-pyrate-limiter/distinfo:1.4
--- pkgsrc/net/py-pyrate-limiter/distinfo:1.3   Mon Jun  1 08:05:59 2026
+++ pkgsrc/net/py-pyrate-limiter/distinfo       Tue Jun 23 11:42:42 2026
@@ -1,5 +1,5 @@
-$NetBSD: distinfo,v 1.3 2026/06/01 08:05:59 adam Exp $
+$NetBSD: distinfo,v 1.4 2026/06/23 11:42:42 wiz Exp $
 
-BLAKE2s (pyrate_limiter-4.2.0.tar.gz) = d7b4ea3ed69308ed00dd6227ae0c04de76c71cc987b38c5f35ec53d3d8444dee
-SHA512 (pyrate_limiter-4.2.0.tar.gz) = 16780a32f12cb9ce793fb048df7a94399817f43b6ab641ed2c3f20627985a49fa573fa732bed0a82df7838959218db4e37ae75f5837ee0110131fc638eff33e8
-Size (pyrate_limiter-4.2.0.tar.gz) = 306505 bytes
+BLAKE2s (pyrate_limiter-4.4.0.tar.gz) = 926303ffaa401da803913846a10b18aa51fa79edd4f52c5bb192c748331edb08
+SHA512 (pyrate_limiter-4.4.0.tar.gz) = e4b6d63ebaec949c154f117ab30d04e3b94cb4b771299a08ba8bad1bd92ed004ceb89c352c66914c9fb8ae29dbe33b8ef5103a74d174dc83398a45f733ac5f84
+Size (pyrate_limiter-4.4.0.tar.gz) = 90955 bytes

Index: pkgsrc/net/py-pyrate-limiter/PLIST
diff -u pkgsrc/net/py-pyrate-limiter/PLIST:1.1 pkgsrc/net/py-pyrate-limiter/PLIST:1.2
--- pkgsrc/net/py-pyrate-limiter/PLIST:1.1      Fri Feb 27 13:33:35 2026
+++ pkgsrc/net/py-pyrate-limiter/PLIST  Tue Jun 23 11:42:42 2026
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.1 2026/02/27 13:33:35 adam Exp $
+@comment $NetBSD: PLIST,v 1.2 2026/06/23 11:42:42 wiz Exp $
 ${PYSITELIB}/${WHEEL_INFODIR}/METADATA
 ${PYSITELIB}/${WHEEL_INFODIR}/RECORD
 ${PYSITELIB}/${WHEEL_INFODIR}/WHEEL
@@ -12,6 +12,9 @@ ${PYSITELIB}/pyrate_limiter/_version.pyo
 ${PYSITELIB}/pyrate_limiter/abstracts/__init__.py
 ${PYSITELIB}/pyrate_limiter/abstracts/__init__.pyc
 ${PYSITELIB}/pyrate_limiter/abstracts/__init__.pyo
+${PYSITELIB}/pyrate_limiter/abstracts/algorithm.py
+${PYSITELIB}/pyrate_limiter/abstracts/algorithm.pyc
+${PYSITELIB}/pyrate_limiter/abstracts/algorithm.pyo
 ${PYSITELIB}/pyrate_limiter/abstracts/bucket.py
 ${PYSITELIB}/pyrate_limiter/abstracts/bucket.pyc
 ${PYSITELIB}/pyrate_limiter/abstracts/bucket.pyo



Home | Main Index | Thread Index | Old Index