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.3.0.tar.gz (2.8 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.3.0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for rollingstats-0.3.0.tar.gz
Algorithm Hash digest
SHA256 218c0de4cdf2efbc4b6a37f8a102f04a69e58cd749e8edca472acc73a93f8a0c
MD5 e9968711553617987037aa3f19b13cae
BLAKE2b-256 cceecf79b5b4dd257a9d6b306222f16ad612a37294f9f9d56ddb6b4e223c3ee8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rollingstats-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 2.8 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f331515c3fe177db6cccfb5223b7ca9e096accf51dd1fa55191022d59474a6c
MD5 5202ad541de7fbfb6b42e6538947a972
BLAKE2b-256 18c561812329d3e320363d6f8432237ee714941c0538587667ad9c6c9841764a

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