fantasyfb 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. fantasyfb-0.3.0/LICENSE +21 -0
  2. fantasyfb-0.3.0/PKG-INFO +150 -0
  3. fantasyfb-0.3.0/README.md +113 -0
  4. fantasyfb-0.3.0/pyproject.toml +60 -0
  5. fantasyfb-0.3.0/setup.cfg +4 -0
  6. fantasyfb-0.3.0/src/fantasyfb/__init__.py +41 -0
  7. fantasyfb-0.3.0/src/fantasyfb/analysis/__init__.py +1 -0
  8. fantasyfb-0.3.0/src/fantasyfb/analysis/move_analyzer.py +639 -0
  9. fantasyfb-0.3.0/src/fantasyfb/analysis/war_calculator.py +165 -0
  10. fantasyfb-0.3.0/src/fantasyfb/cli.py +202 -0
  11. fantasyfb-0.3.0/src/fantasyfb/configs.py +166 -0
  12. fantasyfb-0.3.0/src/fantasyfb/data/__init__.py +1 -0
  13. fantasyfb-0.3.0/src/fantasyfb/data/nfl_provider.py +102 -0
  14. fantasyfb-0.3.0/src/fantasyfb/data/nflreadpy_provider.py +367 -0
  15. fantasyfb-0.3.0/src/fantasyfb/data/player_data_manager.py +440 -0
  16. fantasyfb-0.3.0/src/fantasyfb/data/yahoo_client.py +466 -0
  17. fantasyfb-0.3.0/src/fantasyfb/drafts/__init__.py +1 -0
  18. fantasyfb-0.3.0/src/fantasyfb/drafts/prep.py +314 -0
  19. fantasyfb-0.3.0/src/fantasyfb/drafts/salary_cap.py +388 -0
  20. fantasyfb-0.3.0/src/fantasyfb/drafts/snake.py +554 -0
  21. fantasyfb-0.3.0/src/fantasyfb/drafts/snake_cockpit.py +288 -0
  22. fantasyfb-0.3.0/src/fantasyfb/drafts/tools.py +638 -0
  23. fantasyfb-0.3.0/src/fantasyfb/io/__init__.py +1 -0
  24. fantasyfb-0.3.0/src/fantasyfb/io/excel_exporter.py +252 -0
  25. fantasyfb-0.3.0/src/fantasyfb/league.py +830 -0
  26. fantasyfb-0.3.0/src/fantasyfb/projections/__init__.py +1 -0
  27. fantasyfb-0.3.0/src/fantasyfb/projections/engine.py +312 -0
  28. fantasyfb-0.3.0/src/fantasyfb/projections/engine_v2.py +321 -0
  29. fantasyfb-0.3.0/src/fantasyfb/projections/model_fitter.py +227 -0
  30. fantasyfb-0.3.0/src/fantasyfb/scoring/__init__.py +1 -0
  31. fantasyfb-0.3.0/src/fantasyfb/scoring/fantasy_scoring.py +202 -0
  32. fantasyfb-0.3.0/src/fantasyfb/scoring/lineup_optimizer.py +197 -0
  33. fantasyfb-0.3.0/src/fantasyfb/scoring/matchup_model.py +275 -0
  34. fantasyfb-0.3.0/src/fantasyfb/sim/__init__.py +1 -0
  35. fantasyfb-0.3.0/src/fantasyfb/sim/backtest.py +267 -0
  36. fantasyfb-0.3.0/src/fantasyfb/sim/schedule_manager.py +142 -0
  37. fantasyfb-0.3.0/src/fantasyfb/sim/season_simulator.py +489 -0
  38. fantasyfb-0.3.0/src/fantasyfb.egg-info/PKG-INFO +150 -0
  39. fantasyfb-0.3.0/src/fantasyfb.egg-info/SOURCES.txt +53 -0
  40. fantasyfb-0.3.0/src/fantasyfb.egg-info/dependency_links.txt +1 -0
  41. fantasyfb-0.3.0/src/fantasyfb.egg-info/entry_points.txt +5 -0
  42. fantasyfb-0.3.0/src/fantasyfb.egg-info/requires.txt +14 -0
  43. fantasyfb-0.3.0/src/fantasyfb.egg-info/top_level.txt +1 -0
  44. fantasyfb-0.3.0/tests/test_backtest.py +99 -0
  45. fantasyfb-0.3.0/tests/test_draft_cockpit.py +528 -0
  46. fantasyfb-0.3.0/tests/test_draft_tools.py +487 -0
  47. fantasyfb-0.3.0/tests/test_get_rates.py +144 -0
  48. fantasyfb-0.3.0/tests/test_matchup_model.py +248 -0
  49. fantasyfb-0.3.0/tests/test_model_fitter.py +157 -0
  50. fantasyfb-0.3.0/tests/test_pipeline.py +83 -0
  51. fantasyfb-0.3.0/tests/test_player_data_manager.py +131 -0
  52. fantasyfb-0.3.0/tests/test_projection_engine_v2.py +229 -0
  53. fantasyfb-0.3.0/tests/test_provider.py +200 -0
  54. fantasyfb-0.3.0/tests/test_snake_draft.py +165 -0
  55. fantasyfb-0.3.0/tests/test_yahoo_client.py +93 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Taylor Firman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,150 @@
1
+ Metadata-Version: 2.4
2
+ Name: fantasyfb
3
+ Version: 0.3.0
4
+ Summary: Fantasy football league simulation and optimization tool.
5
+ Author-email: Taylor Firman <tefirman@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/tefirman/fantasyfb
8
+ Project-URL: Repository, https://github.com/tefirman/fantasyfb
9
+ Project-URL: Issues, https://github.com/tefirman/fantasyfb/issues
10
+ Keywords: fantasy-football,nfl,simulation,yahoo-fantasy
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: End Users/Desktop
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Games/Entertainment
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: pandas>=2.0
24
+ Requires-Dist: numpy>=1.24
25
+ Requires-Dist: nflreadpy>=0.1.5
26
+ Requires-Dist: pyarrow>=14.0
27
+ Requires-Dist: yahoo-fantasy-api>=2.6
28
+ Requires-Dist: yahoo-oauth>=2.0
29
+ Requires-Dist: openpyxl>=3.1
30
+ Requires-Dist: python-dotenv>=1.0
31
+ Requires-Dist: pytz>=2023.3
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=7.4; extra == "dev"
34
+ Requires-Dist: ruff>=0.5; extra == "dev"
35
+ Requires-Dist: build>=1.0; extra == "dev"
36
+ Dynamic: license-file
37
+
38
+ # fantasyfb
39
+
40
+ Fantasy football league simulation and optimization toolkit. Pulls
41
+ projections from [nflverse](https://github.com/nflverse) data, syncs
42
+ roster state from a Yahoo Fantasy league, and runs Monte Carlo season
43
+ simulations to value pickups, trades, and draft picks.
44
+
45
+ ## Install
46
+
47
+ ```bash
48
+ pip install fantasyfb
49
+ ```
50
+
51
+ For local development:
52
+
53
+ ```bash
54
+ git clone https://github.com/tefirman/fantasyfb.git
55
+ cd fantasyfb
56
+ pip install -e ".[dev]"
57
+ ```
58
+
59
+ Python 3.10+ is required.
60
+
61
+ ## Quickstart
62
+
63
+ ```python
64
+ import fantasyfb as fb
65
+
66
+ league = fb.League(name="My Team")
67
+ schedule_sim, standings_sim = league.season_sims(postseason=True)
68
+ print(standings_sim[["team", "wins_avg", "playoffs", "winner"]])
69
+ ```
70
+
71
+ `fb.League(name=...)` reads from the Yahoo Fantasy API, so you'll need
72
+ `oauth2.json` (and `.env` with `CONSUMER_KEY` / `CONSUMER_SECRET`) set
73
+ up alongside the script. See the
74
+ [yahoo_oauth docs](https://github.com/josuebrunel/yahoo-oauth) for a
75
+ walkthrough.
76
+
77
+ ## Command-line tools
78
+
79
+ After install, four entry points are on your PATH:
80
+
81
+ | Command | Source | Use |
82
+ | ------------------ | ----------------------------------- | ------------------------------------ |
83
+ | `fantasyfb` | `fantasyfb.league:main` | Weekly projections + lineup analysis |
84
+ | `snake-draft` | `fantasyfb.drafts.snake:main` | Live snake-draft cockpit |
85
+ | `salary-cap-draft` | `fantasyfb.drafts.salary_cap:main` | Live salary-cap (auction) draft tool |
86
+ | `draft-prep` | `fantasyfb.drafts.prep:main` | Pre-draft tiers / VORP / mocks |
87
+
88
+ ```bash
89
+ # Weekly run for a team
90
+ fantasyfb --team "My Team" --sims 1000 --adds --drops
91
+
92
+ # Pre-draft analytics
93
+ draft-prep tiers --team "My Team"
94
+ draft-prep mock --team "My Team" --adp ADP.csv --my-pick 7 --sims 50
95
+
96
+ # Draft-day cockpit
97
+ snake-draft --team "My Team" --adp ADP.csv
98
+ salary-cap-draft --team "My Team"
99
+ ```
100
+
101
+ Run any command with `--help` for the full option list.
102
+
103
+ ## Public API
104
+
105
+ ```python
106
+ from fantasyfb import (
107
+ League, # main entry point
108
+ FantasyScorer, # scoring rules -> points
109
+ MatchupModel, ProjectionEngineV2, # projection internals
110
+ LineupOptimizer,
111
+ SeasonSimulator, ScheduleManager,
112
+ NflreadpyProvider, # default data backend
113
+ )
114
+ ```
115
+
116
+ Lower-level utilities live in submodules and can be imported directly:
117
+
118
+ ```python
119
+ from fantasyfb.drafts.tools import compute_vorp, assign_tiers, MockDraft
120
+ from fantasyfb.drafts.snake_cockpit import build_board, view_best
121
+ from fantasyfb.sim.backtest import run_backtest, evaluate
122
+ from fantasyfb.io.excel_exporter import FantasyExcelExporter
123
+ ```
124
+
125
+ | Subpackage | Purpose |
126
+ | ----------------------- | ------------------------------------------ |
127
+ | `fantasyfb.league` | Top-level `League` class |
128
+ | `fantasyfb.configs` | League / scoring presets |
129
+ | `fantasyfb.drafts` | Snake, salary-cap, prep, shared draft math |
130
+ | `fantasyfb.data` | Yahoo client + nflverse providers |
131
+ | `fantasyfb.scoring` | Scoring, lineup optimization, matchups |
132
+ | `fantasyfb.projections` | V1 / V2 projection engines, fitter |
133
+ | `fantasyfb.sim` | Season simulation, backtests, schedule |
134
+ | `fantasyfb.analysis` | WAR, move analysis |
135
+ | `fantasyfb.io` | Excel export |
136
+
137
+ ## Development
138
+
139
+ ```bash
140
+ pip install -e ".[dev]"
141
+ pytest # full test suite
142
+ python -m build # produce sdist + wheel under dist/
143
+ ```
144
+
145
+ The `tests/` directory pulls a small slice of nflverse parquet data on
146
+ first run; subsequent runs are cached locally.
147
+
148
+ ## License
149
+
150
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,113 @@
1
+ # fantasyfb
2
+
3
+ Fantasy football league simulation and optimization toolkit. Pulls
4
+ projections from [nflverse](https://github.com/nflverse) data, syncs
5
+ roster state from a Yahoo Fantasy league, and runs Monte Carlo season
6
+ simulations to value pickups, trades, and draft picks.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ pip install fantasyfb
12
+ ```
13
+
14
+ For local development:
15
+
16
+ ```bash
17
+ git clone https://github.com/tefirman/fantasyfb.git
18
+ cd fantasyfb
19
+ pip install -e ".[dev]"
20
+ ```
21
+
22
+ Python 3.10+ is required.
23
+
24
+ ## Quickstart
25
+
26
+ ```python
27
+ import fantasyfb as fb
28
+
29
+ league = fb.League(name="My Team")
30
+ schedule_sim, standings_sim = league.season_sims(postseason=True)
31
+ print(standings_sim[["team", "wins_avg", "playoffs", "winner"]])
32
+ ```
33
+
34
+ `fb.League(name=...)` reads from the Yahoo Fantasy API, so you'll need
35
+ `oauth2.json` (and `.env` with `CONSUMER_KEY` / `CONSUMER_SECRET`) set
36
+ up alongside the script. See the
37
+ [yahoo_oauth docs](https://github.com/josuebrunel/yahoo-oauth) for a
38
+ walkthrough.
39
+
40
+ ## Command-line tools
41
+
42
+ After install, four entry points are on your PATH:
43
+
44
+ | Command | Source | Use |
45
+ | ------------------ | ----------------------------------- | ------------------------------------ |
46
+ | `fantasyfb` | `fantasyfb.league:main` | Weekly projections + lineup analysis |
47
+ | `snake-draft` | `fantasyfb.drafts.snake:main` | Live snake-draft cockpit |
48
+ | `salary-cap-draft` | `fantasyfb.drafts.salary_cap:main` | Live salary-cap (auction) draft tool |
49
+ | `draft-prep` | `fantasyfb.drafts.prep:main` | Pre-draft tiers / VORP / mocks |
50
+
51
+ ```bash
52
+ # Weekly run for a team
53
+ fantasyfb --team "My Team" --sims 1000 --adds --drops
54
+
55
+ # Pre-draft analytics
56
+ draft-prep tiers --team "My Team"
57
+ draft-prep mock --team "My Team" --adp ADP.csv --my-pick 7 --sims 50
58
+
59
+ # Draft-day cockpit
60
+ snake-draft --team "My Team" --adp ADP.csv
61
+ salary-cap-draft --team "My Team"
62
+ ```
63
+
64
+ Run any command with `--help` for the full option list.
65
+
66
+ ## Public API
67
+
68
+ ```python
69
+ from fantasyfb import (
70
+ League, # main entry point
71
+ FantasyScorer, # scoring rules -> points
72
+ MatchupModel, ProjectionEngineV2, # projection internals
73
+ LineupOptimizer,
74
+ SeasonSimulator, ScheduleManager,
75
+ NflreadpyProvider, # default data backend
76
+ )
77
+ ```
78
+
79
+ Lower-level utilities live in submodules and can be imported directly:
80
+
81
+ ```python
82
+ from fantasyfb.drafts.tools import compute_vorp, assign_tiers, MockDraft
83
+ from fantasyfb.drafts.snake_cockpit import build_board, view_best
84
+ from fantasyfb.sim.backtest import run_backtest, evaluate
85
+ from fantasyfb.io.excel_exporter import FantasyExcelExporter
86
+ ```
87
+
88
+ | Subpackage | Purpose |
89
+ | ----------------------- | ------------------------------------------ |
90
+ | `fantasyfb.league` | Top-level `League` class |
91
+ | `fantasyfb.configs` | League / scoring presets |
92
+ | `fantasyfb.drafts` | Snake, salary-cap, prep, shared draft math |
93
+ | `fantasyfb.data` | Yahoo client + nflverse providers |
94
+ | `fantasyfb.scoring` | Scoring, lineup optimization, matchups |
95
+ | `fantasyfb.projections` | V1 / V2 projection engines, fitter |
96
+ | `fantasyfb.sim` | Season simulation, backtests, schedule |
97
+ | `fantasyfb.analysis` | WAR, move analysis |
98
+ | `fantasyfb.io` | Excel export |
99
+
100
+ ## Development
101
+
102
+ ```bash
103
+ pip install -e ".[dev]"
104
+ pytest # full test suite
105
+ python -m build # produce sdist + wheel under dist/
106
+ ```
107
+
108
+ The `tests/` directory pulls a small slice of nflverse parquet data on
109
+ first run; subsequent runs are cached locally.
110
+
111
+ ## License
112
+
113
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,60 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "fantasyfb"
7
+ version = "0.3.0"
8
+ description = "Fantasy football league simulation and optimization tool."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.10"
12
+ authors = [{ name = "Taylor Firman", email = "tefirman@gmail.com" }]
13
+ keywords = ["fantasy-football", "nfl", "simulation", "yahoo-fantasy"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: End Users/Desktop",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Topic :: Games/Entertainment",
24
+ ]
25
+ dependencies = [
26
+ "pandas>=2.0",
27
+ "numpy>=1.24",
28
+ "nflreadpy>=0.1.5",
29
+ "pyarrow>=14.0",
30
+ "yahoo-fantasy-api>=2.6",
31
+ "yahoo-oauth>=2.0",
32
+ "openpyxl>=3.1",
33
+ "python-dotenv>=1.0",
34
+ "pytz>=2023.3",
35
+ ]
36
+
37
+ [project.optional-dependencies]
38
+ dev = [
39
+ "pytest>=7.4",
40
+ "ruff>=0.5",
41
+ "build>=1.0",
42
+ ]
43
+
44
+ [project.urls]
45
+ Homepage = "https://github.com/tefirman/fantasyfb"
46
+ Repository = "https://github.com/tefirman/fantasyfb"
47
+ Issues = "https://github.com/tefirman/fantasyfb/issues"
48
+
49
+ [project.scripts]
50
+ fantasyfb = "fantasyfb.league:main"
51
+ snake-draft = "fantasyfb.drafts.snake:main"
52
+ salary-cap-draft = "fantasyfb.drafts.salary_cap:main"
53
+ draft-prep = "fantasyfb.drafts.prep:main"
54
+
55
+ [tool.pytest.ini_options]
56
+ testpaths = ["tests"]
57
+
58
+ [tool.setuptools.packages.find]
59
+ where = ["src"]
60
+ include = ["fantasyfb*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,41 @@
1
+ """fantasyfb: fantasy football league simulation and optimization toolkit.
2
+
3
+ Public API
4
+ ----------
5
+ The most commonly used entry points are re-exported here so that
6
+ ``import fantasyfb as fb`` continues to work after the package
7
+ restructuring (League, FantasyScorer, projection / matchup models, etc.).
8
+ For lower-level helpers, import directly from the relevant submodule:
9
+
10
+ from fantasyfb.drafts.tools import compute_vorp, assign_tiers
11
+ from fantasyfb.sim.backtest import run_backtest
12
+ from fantasyfb.io.excel_exporter import FantasyExcelExporter
13
+ """
14
+
15
+ from .league import League
16
+ from .scoring.fantasy_scoring import FantasyScorer
17
+ from .scoring.matchup_model import MatchupModel
18
+ from .scoring.lineup_optimizer import LineupOptimizer
19
+ from .projections.engine_v2 import ProjectionEngineV2
20
+ from .sim.season_simulator import SeasonSimulator
21
+ from .sim.schedule_manager import ScheduleManager
22
+ from .data.nfl_provider import NFLDataProvider
23
+ from .data.nflreadpy_provider import NflreadpyProvider
24
+ from .configs import get_league_config, apply_default_scoring_categories
25
+
26
+ __version__ = "0.3.0"
27
+
28
+ __all__ = [
29
+ "League",
30
+ "FantasyScorer",
31
+ "MatchupModel",
32
+ "LineupOptimizer",
33
+ "ProjectionEngineV2",
34
+ "SeasonSimulator",
35
+ "ScheduleManager",
36
+ "NFLDataProvider",
37
+ "NflreadpyProvider",
38
+ "get_league_config",
39
+ "apply_default_scoring_categories",
40
+ "__version__",
41
+ ]
@@ -0,0 +1 @@
1
+ """WAR calculation, move analysis, and post-hoc evaluators."""