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.0.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.0-py3-none-any.whl (32.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pepystats-0.2.0.tar.gz
Algorithm Hash digest
SHA256 73c00ae2cb3eaa6a411bb2ecb3d020564d2a29f08864b154a5e1e0a9fd2d0023
MD5 d49c7e9559f663820ffaf17fd8c8b147
BLAKE2b-256 b7e486eef3955c5dc3ca66ee993d1f6de7bfd84ec394df1c379b1e72d828a8e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pepystats-0.2.0-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.9.6

File hashes

Hashes for pepystats-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c99be6ed03425b305eacfb4550dec811e53a21a4c98099a11b7a470b5df311b7
MD5 84bbc317af6a34c12d68f74e2154b0df
BLAKE2b-256 10c0cde196ac7f0b3dfda0a5558c7ff33d23da26e9462daf19bf56540859773b

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