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.

Features

  • Fetch total downloads over a time window
  • Get daily/weekly/monthly/yearly breakdowns
  • Compare per-version download trends
  • Output in plain text, Markdown, or CSV
  • Optional plotting with matplotlib

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

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

Contributing

Contributions welcome! Please open issues or pull requests via GitHub.

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pepystats-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9bd13cad627290104ef4f1d0853c8e63f9deb15a16208b4160aded11d3ee4be9
MD5 f865179e8fbddd0fb65fb66459372b94
BLAKE2b-256 fae66ea4b9147b0bb9481f44b386f6162f3ecfa563037f383d5efa1614fa44ca

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pepystats-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51169e6e6932329f7c601275c59a3a677381bddc11e1431eb7525354f5d0d406
MD5 eaf3fa10385b01ce2abc259ab2f40350
BLAKE2b-256 01bcc38c999e6b1877228e67c8a6525a35cf018d5621e586e08c662d79bdffb5

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