Skip to main content

Reusable live statistics and progress display for CLIs.

Project description

archiver-stats

Python versions PyPI - Version GitHub tag (with filter) License GitHub commits since latest release (by SemVer including pre-releases) CodeQL QA Tests Coverage Status Dependabot Documentation Status mypy uv pytest Ruff Downloads Stargazers pre-commit Prettier

@Tatsh Buy Me A Coffee Libera.Chat Mastodon Follow Patreon

Reusable live statistics and progress display for archiver-style CLIs.

Installation

pip install archiver-stats

Usage

Declare counters and optional free-form status lines, then drive a live Rich display from the Stats instance:

import sys

from archiver_stats import Category, Stats, StatusDisplay, StatusLine

stats = Stats(
    (Category('hits', 'Hits:'), Category('misses', 'Misses:')),
    status_lines=(StatusLine('progress', 'Progress:', after='hits'),),
)
display = StatusDisplay(stats, stream=sys.stderr, initial_message='Working...')
display.start()
try:
    stats.increment('hits')
    stats['progress'] = 'https://example.com/1 (1/3)'
    display.refresh()
finally:
    display.stop()

Stats is a MutableMapping keyed by category or status-line key. Counter values are integers (update with stats[key] = value or stats.increment(key, amount)), and status-line values are str or None. Keys are fixed at construction time and the mapping does not support deletion.

StatusDisplay wraps a Rich Live display: call start() and stop() around your work, refresh() to re-render after updating counters, set_message() to change the spinner text, and write() to print a persistent line above the live region.

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

archiver_stats-0.0.1.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

archiver_stats-0.0.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file archiver_stats-0.0.1.tar.gz.

File metadata

  • Download URL: archiver_stats-0.0.1.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for archiver_stats-0.0.1.tar.gz
Algorithm Hash digest
SHA256 abd393d86c62f10c1c7ec6a7baae83cb078dac372348a89506aebef89f3359fd
MD5 46dbbc036d17573ce135b1d46b6264a7
BLAKE2b-256 4495925156ac4a72b7a01f378acad2eeaf7deed7a3d55090e752a4b7eb58786d

See more details on using hashes here.

Provenance

The following attestation bundles were made for archiver_stats-0.0.1.tar.gz:

Publisher: publish.yml on Tatsh/archiver-stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file archiver_stats-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: archiver_stats-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for archiver_stats-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 be9df65fdb71667970464132901c2d51180804d95405d4aac9558ff3cf324fd4
MD5 5ca8737f76e633a2ba6735d56d5a9462
BLAKE2b-256 72f1919ef4b3a15afc9c0286e0fe7f71c584712a2289654da70be542ba0f5857

See more details on using hashes here.

Provenance

The following attestation bundles were made for archiver_stats-0.0.1-py3-none-any.whl:

Publisher: publish.yml on Tatsh/archiver-stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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