Skip to main content

Lightweight sliding-window counters for streaming aggregation

Project description

rollingstats

Lightweight sliding-window counters for streaming aggregation.

from rollingstats import SlidingCounter

counter = SlidingCounter(capacity=1000)
counter.add(42)
counter.add(58)
print(counter.total)  # 100

Installation

pip install rollingstats

API

SlidingCounter(capacity)

Maintains a running total over a sliding window. When the total exceeds capacity, the oldest entries are evicted.

  • .add(value) — append a value
  • .total — current sum
  • .empty — True if no values recorded
  • .reset() — clear all entries

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rollingstats-0.2.1.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rollingstats-0.2.1-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

Details for the file rollingstats-0.2.1.tar.gz.

File metadata

  • Download URL: rollingstats-0.2.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for rollingstats-0.2.1.tar.gz
Algorithm Hash digest
SHA256 63cf63ae062804bc84f0e3bc3d7f6733c19e157482928d034ac077b735173578
MD5 3cd29f69f896bbd6941036706abb7cc6
BLAKE2b-256 c77e75f200bfb5a1ae942e68efa1257ef63de921a1ebdbac82f44d24326a8a22

See more details on using hashes here.

File details

Details for the file rollingstats-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: rollingstats-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 2.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for rollingstats-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f3f857a31bca993e02dc6e9bfd5ec5fdd4feec86f4018a99418467e27909d661
MD5 c237716bb6f2d56478db9e8f5f2c5bb9
BLAKE2b-256 ae4a86c1436b5579969377ea1cdc3c8ffd2ade1c82201abec433637528b28f06

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page