Skip to main content
fantasyfb logo

fantasyfb

Fantasy football league simulation and optimization toolkit. Pulls projections from nflverse data, syncs roster state from a Yahoo Fantasy league, and runs Monte Carlo season simulations to value pickups, trades, and draft picks.

PyPI version Run Tests License: MIT

Docs: https://tefirman.github.io/fantasyfb/

Try it in your browser: https://fantasy.taylorfirman.com/

Install

pip install fantasyfb

For local development:

git clone https://github.com/tefirman/fantasyfb.git
cd fantasyfb
pip install -e ".[dev]"

Python 3.10+ is required.

Quickstart

import fantasyfb as fb

league = fb.League(name="My Team")
schedule_sim, standings_sim = league.season_sims(postseason=True)
print(standings_sim[["team", "wins_avg", "playoffs", "winner"]])

fb.League(name=...) reads from the Yahoo Fantasy API, so you'll need oauth2.json (and .env with CONSUMER_KEY / CONSUMER_SECRET) set up alongside the script. See the yahoo_oauth docs for a walkthrough.

Command-line tools

After install, four entry points are on your PATH:

Command Source Use
fantasyfb fantasyfb.league:main Weekly projections + lineup analysis
snake-draft fantasyfb.drafts.snake:main Live snake-draft cockpit
salary-cap-draft fantasyfb.drafts.salary_cap:main Live salary-cap draft tool
draft-prep fantasyfb.drafts.prep:main Pre-draft tiers / VORP / mocks
# Weekly run for a team
fantasyfb --team "My Team" --sims 1000 --adds --drops

# Same run, as a self-contained interactive HTML report (or --format both)
fantasyfb --team "My Team" --sims 1000 --adds --drops --format html

# Pre-draft analytics
draft-prep tiers --team "My Team"
draft-prep mock --team "My Team" --adp ADP.csv --my-pick 7 --sims 50

# Draft-day cockpit
snake-draft --team "My Team" --adp ADP.csv
salary-cap-draft --team "My Team"

Run any command with --help for the full option list.

NFL data (stats, schedules, rosters) is cached to disk for 24 hours, so repeated runs within that window work offline. The fantasyfb weekly CLI shortens that to 30 minutes on game days (September through January, every day except Wednesday and Friday), so reruns pick up finished games. Past the cache window you'll need a live connection again to refresh it — see nflreadpy caching for details and the --refresh-cache flag.

Public API

from fantasyfb import (
    League,                            # main entry point
    FantasyScorer,                     # scoring rules -> points
    MatchupModel, ProjectionEngineV2,  # projection internals
    LineupOptimizer,
    SeasonSimulator, ScheduleManager,
    NflreadpyProvider,                 # default data backend
)

Lower-level utilities live in submodules and can be imported directly:

from fantasyfb.drafts.tools import compute_vorp, assign_tiers, MockDraft
from fantasyfb.drafts.snake_cockpit import build_board, view_best
from fantasyfb.sim.backtest import run_backtest, evaluate
from fantasyfb.io.excel_exporter import FantasyExcelExporter
Subpackage Purpose
fantasyfb.league Top-level League class
fantasyfb.configs League / scoring presets
fantasyfb.drafts Snake, salary-cap, prep, shared draft math
fantasyfb.data Yahoo client + nflverse providers
fantasyfb.scoring Scoring, lineup optimization, matchups
fantasyfb.projections V2 projection engine, walk-forward fitter
fantasyfb.sim Season simulation, backtests, schedule
fantasyfb.analysis WAR, move analysis
fantasyfb.io Excel and HTML report export

Development

pip install -e ".[dev]"
pytest                       # full test suite
python -m build              # produce sdist + wheel under dist/

The tests/ directory pulls a small slice of nflverse parquet data on first run; subsequent runs are cached locally.

License

MIT. See LICENSE.

Metadata

Release files for fantasyfb 0.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fantasyfb 0.13.0
File Size Uploaded Provenance Actions
fantasyfb-0.13.0.tar.gz 295.2 kB With provenance Details for fantasyfb-0.13.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fantasyfb 0.13.0
File Interpreter ABI Platform Actions
fantasyfb-0.13.0-py3-none-any.whl Python 3 none any Details for fantasyfb-0.13.0-py3-none-any.whl

Total release size: 502.2 kB

Release files / fantasyfb-0.13.0.tar.gz

Download URL fantasyfb-0.13.0.tar.gz
Size 295.2 kB
Tags Source
SHA-256 checksum
How to use checksums
39a05ee14b5e58f29ef0faab12947e6956c28d4aafd52133b335923ed08cf07f
BLAKE2b-256 checksum
How to use checksums
2755218585ab1fd622b3528286b76122d1454b036a81408d725f1830be310e28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / fantasyfb-0.13.0-py3-none-any.whl

Download URL fantasyfb-0.13.0-py3-none-any.whl
Size 207.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c28594ffefc8080640c141acd0a649dc6aea3a238045afb353fea53ca097fe8
BLAKE2b-256 checksum
How to use checksums
8fa6284b2fdd7341390bc155b5ff077c9a62e6575f2b65210beab084ff09cbe7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for fantasyfb 0.13.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fantasyfb-0.13.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page