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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pepystats-0.2.2.tar.gz
  • Upload date:
  • Size: 46.8 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.2.tar.gz
Algorithm Hash digest
SHA256 4445afd69569e86f731d8403d75127f10bf2a64f1dbb649ebeab09c704d4d48c
MD5 c916b9668b0ea86f7d794f272be0c9d7
BLAKE2b-256 2195bf531fe1a890028899f57c41da4b3f13de71f6c72b1871cc9dcd23016fe4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pepystats-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 31.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 44392b077a1a6fa8d3f4e313938902b796b41faa795a6c31afe1a2abc8634aa9
MD5 dc327b36aef48af249a61583594e4c62
BLAKE2b-256 9e411a4f9fba1ffb7a02241ba1e905e267100d320af78557680436b1ee94e916

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