Skip to main content

Fantasy public pull utilities

Project description

Stable release

Roadmap: We are on A) Hybrid → see ROADMAP.md.
Releases: see RELEASING.md.

Roadmap: Currently on A) Hybrid. See ROADMAP.md.

PyPI Python versions CI Release workflow PyPI publish

CI

CI

Status: Continuous Integration (contracts + validation checks) passing ✅

fantasy-public-pull

Goal: Use ESPN private league endpoints only to discover league/team/roster, and use public endpoints to fetch week-by-week player stats for all players (regardless of roster), then join them when building reports.

Quickstart

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
mkdir -p data/raw data/processed
# place raw pulls in data/raw ; clean outputs go to data/processed

Local Development Safety Checks

This repo uses a shared .githooks/pre-push script to enforce style, lint, and contract tests before every push.

One-time setup per machine

# ensure hooks use the shared folder
git config core.hooksPath .githooks

# install pre-commit into your virtualenv (if not already)
pip install pre-commit

# (optional) verify everything runs cleanly
git commit --allow-empty -m "hook check"
git push

Docs

Local guardrails (pre-push)

pip install -r requirements-dev.txt
git config core.hooksPath .githooks
# (optional) run once to build hook envs faster:
pre-commit run --all-files

The pre-push hook runs:

  • pre-commit (Black + Ruff) on your changes
  • ./scripts/ci.sh test (unit tests)
  • ./scripts/ci.sh contracts (contract tests)

Pushes are blocked if any step fails.

Reports

Once you’ve generated a joined season file (e.g., with pull_range), you can summarize it:

# regenerate joined data (offline sample weeks 1–3)
python -m fppull.cli.pull_range --season 2025 --weeks 1-3 --out-dir data/processed

# top players by total points
python -m fppull.cli.report_top --in data/processed/season_2025_joined.csv --top 15

# group by position
python -m fppull.cli.report_top --in data/processed/season_2025_joined.csv --group-by position --top 10

# group by team
python -m fppull.cli.report_top --in data/processed/season_2025_joined.csv --group-by team --top 10

# require a minimum number of distinct weeks (e.g., >= 2)
python -m fppull.cli.report_top --in data/processed/season_2025_joined.csv --group-by player --min-weeks 2 --top 20

# optionally write the table to CSV
python -m fppull.cli.report_top --in data/processed/season_2025_joined.csv --group-by team --out data/processed/top_teams.csv


## Make targets

Handy shortcuts for common tasks:

```bash
# Rebuild joined data and print a top summary (defaults: season=2025, weeks=1-3)
make report-top

# Variations:
make report-top season=2025 weeks=1-3
make report-top season=2025 group_by=team top=10
make report-top season=2025 group_by=position min_weeks=2

# Local checks
make test         # unit tests
make contracts    # contract tests
make lint         # ruff
make fmt          # black
make ci           # fmt + lint + tests + contracts

### report_top formats & PPG

```bash
# table (default) + points per game
python -m fppull.cli.report_top --in data/processed/season_2025_joined.csv --top 10 --ppg

# CSV to stdout
python -m fppull.cli.report_top --in data/processed/season_2025_joined.csv --format csv --top 10

# JSON to file
python -m fppull.cli.report_top --in data/processed/season_2025_joined.csv --format json --ppg --top 10 --out data/processed/top10.json

[![PyPI version](https://img.shields.io/pypi/v/fppull.svg)](https://pypi.org/project/fppull/)
[![Release](https://img.shields.io/github/v/release/Masen222/fantasy-public-pull?display_name=tag)](https://github.com/Masen222/fantasy-public-pull/releases)
[![CI](https://github.com/Masen222/fantasy-public-pull/actions/workflows/ci.yml/badge.svg)](https://github.com/Masen222/fantasy-public-pull/actions/workflows/ci.yml)

## Install

```bash
pip install fppull==0.5.6

```bash
python -c "import fppull; print(fppull.__version__)"
# should print: 0.5.1


## Artifacts map (what gets produced)

| Layer | How to run | Key outputs |
|------|------------|-------------|
| Public stats | `python -m fppull.cli.pull_range --season 2025 --weeks 1-3 --out-dir data/processed` | `player_week_stats_long.csv`, `player_week_stats_wide.csv`, **`player_week_points.csv`** |
| Private league context | (your private fetch or CSVs) | `teams.csv`, `roster_week.csv`, `matchups.csv` |
| Join + reports | `python -m fppull.cli.report_top --in data/processed/season_2025_joined.csv --top 15 [--group-by position|team]` | console table (or `--out` CSV/JSON), league workbook (optional) |

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

fppull-0.5.8.tar.gz (316.4 kB view details)

Uploaded Source

Built Distribution

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

fppull-0.5.8-py3-none-any.whl (99.0 kB view details)

Uploaded Python 3

File details

Details for the file fppull-0.5.8.tar.gz.

File metadata

  • Download URL: fppull-0.5.8.tar.gz
  • Upload date:
  • Size: 316.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fppull-0.5.8.tar.gz
Algorithm Hash digest
SHA256 2873b4ee1cc292e9cc39238e13a25d68561c329f3b431b4dc1de8c342ea56ae0
MD5 acd0b2837dbbaefb83eceb7c20aefe6f
BLAKE2b-256 e85381793e4809d85c2d42fc2e645b9d6eeef2230e11c8c72e9b6dd35dd1dd4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for fppull-0.5.8.tar.gz:

Publisher: publish-pypi.yml on Masen222/fantasy-public-pull

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

File details

Details for the file fppull-0.5.8-py3-none-any.whl.

File metadata

  • Download URL: fppull-0.5.8-py3-none-any.whl
  • Upload date:
  • Size: 99.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fppull-0.5.8-py3-none-any.whl
Algorithm Hash digest
SHA256 b1fc67fa1f83acadb28ec6c48a8157c887d2ae4f1817ab359f45a14da6db3f52
MD5 9de2d8c440a29a7fed45a4fcdc1ac224
BLAKE2b-256 cc3e62b3a733b5ff8ce5df37a508c9c9845bbfc5b8d83049d19fd3f06084ae10

See more details on using hashes here.

Provenance

The following attestation bundles were made for fppull-0.5.8-py3-none-any.whl:

Publisher: publish-pypi.yml on Masen222/fantasy-public-pull

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