Skip to main content

Lightweight Python client & CLI for pepy.tech download stats

Project description

pepystats

Lightweight Python client & CLI for pepy.tech download stats.

  • overall --- total downloads over a window (single number)

  • detailed --- day-by-day (or resampled) totals across all versions, zero-filling missing days

  • versions --- per-version series for selected versions

Not affiliated with pepy.tech.

Install

pip install pepystats

Python ≥ 3.8.

CLI

pepystats --help

Common flags

  • project --- PyPI package name (e.g. chunkwrap)

  • --months INT --- lookback window (default: 3). 0 disables trimming.

  • --api-key KEY --- pepy API key (or set $PEPY_API_KEY)

  • --no-ci --- present for parity; ignored with public v2 data

  • --fmt {plain,md,csv} --- output format (default: plain)

overall --- total downloads (sum)

pepystats overall chunkwrap --months 1

→ prints a single integer

pepystats overall chunkwrap --months 1 --fmt md
downloads
12345

detailed --- totals across all versions

  • Daily output includes every day in range with 0s for gaps.

  • Resampling is client-side:

    • weekly buckets end Saturday (W-SAT)

    • monthly buckets start 1st of month (MS)

    • yearly buckets start Jan 1 (YS)

# Daily, Markdown table
pepystats detailed chunkwrap --months 1 --fmt md

# Weekly, CSV
pepystats detailed chunkwrap --months 3 --granularity weekly --fmt csv

# Plot (requires a display)
pepystats detailed chunkwrap --months 1 --plot`

recent — last 7 days of downloads

pepystats recent chunkwrap --fmt md
pepystats recent chunkwrap --granularity weekly --plot
  • Uses the same formatting and plotting options as detailed

  • Always trims to the last 7 calendar days

versions --- per-version series

pepystats versions chunkwrap --versions 2.4.1 2.4.0 --months 2 --fmt md
pepystats versions chunkwrap --versions 1.0 --granularity monthly --fmt csv`

Exit codes

  • 0 success

  • 1 error (e.g., HTTP 5xx or unauthorized)

Auth & rate-limits

  • Public v2 endpoint is used. If your key is required/limited, set it via:
export PEPY_API_KEY=...    # or use --api-key
  • --no-ci is retained for future parity but does not affect public v2.

Library usage (Python)

import pepystats as ps

# 1) Sum over window (int)
total = ps.get_overall("chunkwrap", months=3)

# 2) Detailed totals (DataFrame with columns: date, downloads, label='total')
df = ps.get_detailed("chunkwrap", months=1, granularity="daily")

# 3) Per-version series (DataFrame with columns: date, downloads, label=<version>)
dv = ps.get_versions("chunkwrap", versions=["2.4.1", "2.4.0"], months=2)

# Formatting helpers
print(ps.to_markdown(df))
csv_text = ps.to_csv(dv)`

Data semantics

  • Dates are parsed as UTC, normalized to midnight, then rendered as YYYY-MM-DD.

  • detailed (daily) zero-fills missing days between the min/max dates after trimming.

  • Weekly/monthly/yearly outputs include empty buckets as zeros.

Troubleshooting

  • 401 Unauthorized: set --api-key or $PEPY_API_KEY.

  • "no data": the lookback window may exclude all rows; try --months 0.

  • Plotting errors: ensure a GUI backend or run without --plot on headless systems.

Development

# Tests & coverage
pytest -q --cov=pepystats --cov-report=term --cov-report=xml

# Lint (example tools)
ruff check .
pylint pepystats`

License

GNU General Public License v3.0 (see LICENSE for details).

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

pepystats-0.2.1.tar.gz (46.9 kB view details)

Uploaded Source

Built Distribution

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

pepystats-0.2.1-py3-none-any.whl (32.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pepystats-0.2.1.tar.gz
  • Upload date:
  • Size: 46.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for pepystats-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c3cdaa364faa63602b81642774e6faec6151b02b1ebd288f10f7236e4ec112fa
MD5 b170bfc4a3e70927468339dee468cb6c
BLAKE2b-256 aa4befbda4274d8a52ad0a702838f591806ed9159110e58ca70416560ac70674

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pepystats-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 32.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for pepystats-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3a18cb1ae2333454b9a103b3032d94a8d1dd45c81db646ba031b0b13762091c0
MD5 62bd45e55f6e317dcfe23f00155db738
BLAKE2b-256 5ed964e84fc20f12e3b7e4170988aa57e8202837ab6331f41dc71f266178fda8

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