leeger


Nameleeger JSON
Version 2.7.0 PyPI version JSON
download
home_pagehttps://github.com/joeyagreco/leeger
SummaryInstant stats for any fantasy football league.
upload_time2024-12-25 19:28:15
maintainerNone
docs_urlNone
authorJoey Greco
requires_python>=3.10
licenseMIT
keywords nfl statistics stats football espn yahoo sleeper myfantasyleague fleaflicker
VCS
bugtrack_url
requirements espn_api fleaflicker numpy openpyxl pymfl setuptools sleeper yahoofantasy
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
    <img src="https://raw.githubusercontent.com/joeyagreco/leeger/main/img/leeger-logo-cropped.png" alt="leeger logo" width="300"/>

Instant stats for any fantasy football league.

[![PyPi Version](https://img.shields.io/pypi/v/leeger)](https://pypi.org/project/leeger/)
<br>
<a target="_blank" href="https://www.python.org/downloads/" title="Python version"><img src="https://img.shields.io/badge/python-%3E=_3.10-teal.svg"></a>
![Last Commit](https://img.shields.io/github/last-commit/joeyagreco/leeger)
<br>
![End-to-end Tests](https://github.com/joeyagreco/leeger/actions/workflows/e2e-tests.yml/badge.svg)
![Unit Tests](https://github.com/joeyagreco/leeger/actions/workflows/unit-tests.yml/badge.svg)
![Formatting Check](https://github.com/joeyagreco/leeger/actions/workflows/formatting-check.yml/badge.svg)

</div>

### Table of Contents

- [Overview](https://github.com/joeyagreco/leeger#overview)
- [Quickstart Guide](https://github.com/joeyagreco/leeger#quickstart-guide)
- [FAQ](https://github.com/joeyagreco/leeger#faq)
- [Installation](https://github.com/joeyagreco/leeger#installation)
- [Supported League Loaders](https://github.com/joeyagreco/leeger#supported-league-loaders)
- [Stats Explained](https://github.com/joeyagreco/leeger#stats-explained)
- [Running Tests](https://github.com/joeyagreco/leeger#running-tests)
- [Contributing](https://github.com/joeyagreco/leeger#contributing)
- [License](https://github.com/joeyagreco/leeger#license)
- [Credit](https://github.com/joeyagreco/leeger#credit)

## Overview

![](https://github.com/joeyagreco/leeger/blob/main/img/leeger-overview-transparent.png)
This library allows you to take data from an existing fantasy football league and get instant stats from that league
into either a Python script or an Excel spreadsheet.\
\
This library supports multiple fantasy sites AND manual league data input.\
\
Python stats will be stored in these objects:

- [AllTimeStatSheet](https://github.com/joeyagreco/leeger/blob/main/leeger/model/stat/AllTimeStatSheet.py)
- [YearStatSheet](https://github.com/joeyagreco/leeger/blob/main/leeger/model/stat/YearStatSheet.py)

Excel sheets will include:

- A tab for each year with team stats
- A tab for each year with matchup info
- A tab for all-time with team stats
- A tab for all-time with matchup info
- A tab for all-time with owner stats

\
The main idea behind this library is:

1. Load stats into a League object
2. Pass this League object into various library methods to extract stats

\
For guides on how to use this library, see the information
under [Supported League Loaders](https://github.com/joeyagreco/leeger#supported-league-loaders) and
in the [`example`](https://github.com/joeyagreco/leeger/tree/main/example) folder.

## Quickstart Guide

#### 1. Download Python

- Download the latest _supported_ version of Python [here](https://www.python.org/downloads/release/python-3109/).
- Currently, Python version 3.10+ is supported

#### 2. Create a basic Python file to use this library

- Create a file that ends in the extension ".py"
  - Example: _my_script.py_

#### 3. Download this library

- Navigate in your terminal to the directory where you created your Python script in Step 2
- Run the command `pip install leeger`
  - If you do not have [pip](https://pip.pypa.io/en/stable/) installed, you will need to install it

#### 4. Download your league data using a league loader

- Find the site/s you use for fantasy football [here](https://github.com/joeyagreco/leeger#supported-league-loaders)
- Follow the **Setup Documentation**
- Once you have everything you need for your selected site/s, use the code examples
  found [here](https://github.com/joeyagreco/leeger/tree/main/example/league_loader) for your specific site/s to
  download your league data
  - You can put the code inside the Python script you created in Step 2
- If you have leagues that are continued in multiple sites, you can pull from multiple sites and add the League objects
  together to combine the different sites
  - An example of this can be
    found [here](https://github.com/joeyagreco/leeger/blob/main/example/league/combiningLeagues.py)

#### 5. Run your script

- Navigate in your terminal to the directory where you created your Python script in Step 2
- Run the command `py my_script.py`
  - Replace _my_script.py_ with whatever you named your script in Step 2

#### 6. Load your league stats into Excel

- Slightly alter your script from Step 2 to include a function call to load your league stats into Excel
- Follow [this example](https://github.com/joeyagreco/leeger/blob/main/example/stat/statsToExcelExample.py)
- Make sure that you are passing the League object that you pulled from the league loader/s into the function call to
  put your stats into Excel

## FAQ

**Question:**
I'm getting this error when I run my script:

<!---
// @formatter:off
-->

```python3
TypeError: dataclass() got an unexpected keyword argument 'kw_only'
```

<!---
// @formatter:on
-->

**Answer:**
This error occurs when the Python version you are using is not 3.10 or greater.\
Make sure you are using Python version 3.10 or a newer version.

---

**Q:**
How do I use this library to pull stats from my online fantasy league?

**A:**

1. Find your fantasy site [here](https://github.com/joeyagreco/leeger#supported-league-loaders) and ensure you have
   everything you need for the site you are using
2. Follow the [example code snippets](https://github.com/joeyagreco/leeger/tree/main/example/league_loader) for your
   fantasy site to load the League object

---

**Q:**
How can I get stats into Excel once I have my League object?

**A:**
Follow [this example code](https://github.com/joeyagreco/leeger/blob/main/example/stat/statsToExcelExample.py).

---

**Q:**
Can I combine years from different fantasy sites that are loaded as separate League objects into a single League object?

**A:**
Yes, the League object supports addition (+) to combine multiple league objects.\
An example of this can be
found [here](https://github.com/joeyagreco/leeger/blob/main/example/league/combiningLeagues.py).

---

**Q:**
Can I disable validation on my League object?

**A:**
Yes. While it is not recommended that you disable this, as validation ensures the stats are calculated properly,
disabling validation can be done by passing `validate=False` into any method that takes a League object OR any `loadLeague()` method from a League Loader.

## Installation

Use the package manager [pip](https://pip.pypa.io/en/stable/) to install.

```bash
pip install leeger
```

## Supported League Loaders

Sites that you can automatically load your league data from.

| Name            | Website                                   | Supported          | Setup Documentation                                                                                                       |
| --------------- | ----------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------- |
| ESPN            | https://www.espn.com/fantasy/football/    | :heavy_check_mark: | [ESPN :page_facing_up:](https://github.com/joeyagreco/leeger/blob/main/doc/league_loader/espn.md)                         |
| Fleaflicker     | https://www.fleaflicker.com/              | :heavy_check_mark: | [Fleaflicker :page_facing_up:](https://github.com/joeyagreco/leeger/blob/main/doc/league_loader/fleaflicker.md)           |
| MyFantasyLeague | http://home.myfantasyleague.com/          | :heavy_check_mark: | [MyFantasyLeague :page_facing_up:](https://github.com/joeyagreco/leeger/blob/main/doc/league_loader/my_fantasy_league.md) |
| NFL             | https://fantasy.nfl.com/                  | :x:                | :x:                                                                                                                       |
| Sleeper         | https://sleeper.com/fantasy-football/     | :heavy_check_mark: | [Sleeper :page_facing_up:](https://github.com/joeyagreco/leeger/blob/main/doc/league_loader/sleeper.md)                   |
| Yahoo           | https://football.fantasysports.yahoo.com/ | :heavy_check_mark: | [Yahoo :page_facing_up:](https://github.com/joeyagreco/leeger/blob/main/doc/league_loader/yahoo.md)                       |

<!---
// @formatter:off
-->

If a fantasy site you use is not listed here and you would like it to be, please [open an issue](https://github.com/joeyagreco/leeger/issues/new/choose).

<!---
// @formatter:on
-->

## Stats Explained

Stats used in this library are
documented [here](https://github.com/joeyagreco/leeger/blob/main/doc/stats.md).

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## Development

_Run these commands from the root folder_

- Format Code: `make fmt`
- Run Unit Tests: `make test`

## License

[MIT](https://choosealicense.com/licenses/mit/)

## Credit

- [ESPN API](https://github.com/cwendt94/espn-api)
- [ESPN Private Leagues](https://cran.r-project.org/web/packages/ffscrapr/vignettes/espn_authentication.html)
- [fleaflicker](https://github.com/joeyagreco/fleaflicker)
- [pymfl](https://github.com/joeyagreco/pymfl)
- [sleeper](https://github.com/joeyagreco/sleeper)
- [YahooFantasy](https://github.com/mattdodge/yahoofantasy)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/joeyagreco/leeger",
    "name": "leeger",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "nfl statistics stats football espn yahoo sleeper myfantasyleague, fleaflicker",
    "author": "Joey Greco",
    "author_email": "joeyagreco@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/a9/52/59a122a5bcb8d44fb25d79f3d982d652cb863dbd618fb0fd9fd00eac25ea/leeger-2.7.0.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n    <img src=\"https://raw.githubusercontent.com/joeyagreco/leeger/main/img/leeger-logo-cropped.png\" alt=\"leeger logo\" width=\"300\"/>\n\nInstant stats for any fantasy football league.\n\n[![PyPi Version](https://img.shields.io/pypi/v/leeger)](https://pypi.org/project/leeger/)\n<br>\n<a target=\"_blank\" href=\"https://www.python.org/downloads/\" title=\"Python version\"><img src=\"https://img.shields.io/badge/python-%3E=_3.10-teal.svg\"></a>\n![Last Commit](https://img.shields.io/github/last-commit/joeyagreco/leeger)\n<br>\n![End-to-end Tests](https://github.com/joeyagreco/leeger/actions/workflows/e2e-tests.yml/badge.svg)\n![Unit Tests](https://github.com/joeyagreco/leeger/actions/workflows/unit-tests.yml/badge.svg)\n![Formatting Check](https://github.com/joeyagreco/leeger/actions/workflows/formatting-check.yml/badge.svg)\n\n</div>\n\n### Table of Contents\n\n- [Overview](https://github.com/joeyagreco/leeger#overview)\n- [Quickstart Guide](https://github.com/joeyagreco/leeger#quickstart-guide)\n- [FAQ](https://github.com/joeyagreco/leeger#faq)\n- [Installation](https://github.com/joeyagreco/leeger#installation)\n- [Supported League Loaders](https://github.com/joeyagreco/leeger#supported-league-loaders)\n- [Stats Explained](https://github.com/joeyagreco/leeger#stats-explained)\n- [Running Tests](https://github.com/joeyagreco/leeger#running-tests)\n- [Contributing](https://github.com/joeyagreco/leeger#contributing)\n- [License](https://github.com/joeyagreco/leeger#license)\n- [Credit](https://github.com/joeyagreco/leeger#credit)\n\n## Overview\n\n![](https://github.com/joeyagreco/leeger/blob/main/img/leeger-overview-transparent.png)\nThis library allows you to take data from an existing fantasy football league and get instant stats from that league\ninto either a Python script or an Excel spreadsheet.\\\n\\\nThis library supports multiple fantasy sites AND manual league data input.\\\n\\\nPython stats will be stored in these objects:\n\n- [AllTimeStatSheet](https://github.com/joeyagreco/leeger/blob/main/leeger/model/stat/AllTimeStatSheet.py)\n- [YearStatSheet](https://github.com/joeyagreco/leeger/blob/main/leeger/model/stat/YearStatSheet.py)\n\nExcel sheets will include:\n\n- A tab for each year with team stats\n- A tab for each year with matchup info\n- A tab for all-time with team stats\n- A tab for all-time with matchup info\n- A tab for all-time with owner stats\n\n\\\nThe main idea behind this library is:\n\n1. Load stats into a League object\n2. Pass this League object into various library methods to extract stats\n\n\\\nFor guides on how to use this library, see the information\nunder [Supported League Loaders](https://github.com/joeyagreco/leeger#supported-league-loaders) and\nin the [`example`](https://github.com/joeyagreco/leeger/tree/main/example) folder.\n\n## Quickstart Guide\n\n#### 1. Download Python\n\n- Download the latest _supported_ version of Python [here](https://www.python.org/downloads/release/python-3109/).\n- Currently, Python version 3.10+ is supported\n\n#### 2. Create a basic Python file to use this library\n\n- Create a file that ends in the extension \".py\"\n  - Example: _my_script.py_\n\n#### 3. Download this library\n\n- Navigate in your terminal to the directory where you created your Python script in Step 2\n- Run the command `pip install leeger`\n  - If you do not have [pip](https://pip.pypa.io/en/stable/) installed, you will need to install it\n\n#### 4. Download your league data using a league loader\n\n- Find the site/s you use for fantasy football [here](https://github.com/joeyagreco/leeger#supported-league-loaders)\n- Follow the **Setup Documentation**\n- Once you have everything you need for your selected site/s, use the code examples\n  found [here](https://github.com/joeyagreco/leeger/tree/main/example/league_loader) for your specific site/s to\n  download your league data\n  - You can put the code inside the Python script you created in Step 2\n- If you have leagues that are continued in multiple sites, you can pull from multiple sites and add the League objects\n  together to combine the different sites\n  - An example of this can be\n    found [here](https://github.com/joeyagreco/leeger/blob/main/example/league/combiningLeagues.py)\n\n#### 5. Run your script\n\n- Navigate in your terminal to the directory where you created your Python script in Step 2\n- Run the command `py my_script.py`\n  - Replace _my_script.py_ with whatever you named your script in Step 2\n\n#### 6. Load your league stats into Excel\n\n- Slightly alter your script from Step 2 to include a function call to load your league stats into Excel\n- Follow [this example](https://github.com/joeyagreco/leeger/blob/main/example/stat/statsToExcelExample.py)\n- Make sure that you are passing the League object that you pulled from the league loader/s into the function call to\n  put your stats into Excel\n\n## FAQ\n\n**Question:**\nI'm getting this error when I run my script:\n\n<!---\n// @formatter:off\n-->\n\n```python3\nTypeError: dataclass() got an unexpected keyword argument 'kw_only'\n```\n\n<!---\n// @formatter:on\n-->\n\n**Answer:**\nThis error occurs when the Python version you are using is not 3.10 or greater.\\\nMake sure you are using Python version 3.10 or a newer version.\n\n---\n\n**Q:**\nHow do I use this library to pull stats from my online fantasy league?\n\n**A:**\n\n1. Find your fantasy site [here](https://github.com/joeyagreco/leeger#supported-league-loaders) and ensure you have\n   everything you need for the site you are using\n2. Follow the [example code snippets](https://github.com/joeyagreco/leeger/tree/main/example/league_loader) for your\n   fantasy site to load the League object\n\n---\n\n**Q:**\nHow can I get stats into Excel once I have my League object?\n\n**A:**\nFollow [this example code](https://github.com/joeyagreco/leeger/blob/main/example/stat/statsToExcelExample.py).\n\n---\n\n**Q:**\nCan I combine years from different fantasy sites that are loaded as separate League objects into a single League object?\n\n**A:**\nYes, the League object supports addition (+) to combine multiple league objects.\\\nAn example of this can be\nfound [here](https://github.com/joeyagreco/leeger/blob/main/example/league/combiningLeagues.py).\n\n---\n\n**Q:**\nCan I disable validation on my League object?\n\n**A:**\nYes. While it is not recommended that you disable this, as validation ensures the stats are calculated properly,\ndisabling validation can be done by passing `validate=False` into any method that takes a League object OR any `loadLeague()` method from a League Loader.\n\n## Installation\n\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install.\n\n```bash\npip install leeger\n```\n\n## Supported League Loaders\n\nSites that you can automatically load your league data from.\n\n| Name            | Website                                   | Supported          | Setup Documentation                                                                                                       |\n| --------------- | ----------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------- |\n| ESPN            | https://www.espn.com/fantasy/football/    | :heavy_check_mark: | [ESPN :page_facing_up:](https://github.com/joeyagreco/leeger/blob/main/doc/league_loader/espn.md)                         |\n| Fleaflicker     | https://www.fleaflicker.com/              | :heavy_check_mark: | [Fleaflicker :page_facing_up:](https://github.com/joeyagreco/leeger/blob/main/doc/league_loader/fleaflicker.md)           |\n| MyFantasyLeague | http://home.myfantasyleague.com/          | :heavy_check_mark: | [MyFantasyLeague :page_facing_up:](https://github.com/joeyagreco/leeger/blob/main/doc/league_loader/my_fantasy_league.md) |\n| NFL             | https://fantasy.nfl.com/                  | :x:                | :x:                                                                                                                       |\n| Sleeper         | https://sleeper.com/fantasy-football/     | :heavy_check_mark: | [Sleeper :page_facing_up:](https://github.com/joeyagreco/leeger/blob/main/doc/league_loader/sleeper.md)                   |\n| Yahoo           | https://football.fantasysports.yahoo.com/ | :heavy_check_mark: | [Yahoo :page_facing_up:](https://github.com/joeyagreco/leeger/blob/main/doc/league_loader/yahoo.md)                       |\n\n<!---\n// @formatter:off\n-->\n\nIf a fantasy site you use is not listed here and you would like it to be, please [open an issue](https://github.com/joeyagreco/leeger/issues/new/choose).\n\n<!---\n// @formatter:on\n-->\n\n## Stats Explained\n\nStats used in this library are\ndocumented [here](https://github.com/joeyagreco/leeger/blob/main/doc/stats.md).\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## Development\n\n_Run these commands from the root folder_\n\n- Format Code: `make fmt`\n- Run Unit Tests: `make test`\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n\n## Credit\n\n- [ESPN API](https://github.com/cwendt94/espn-api)\n- [ESPN Private Leagues](https://cran.r-project.org/web/packages/ffscrapr/vignettes/espn_authentication.html)\n- [fleaflicker](https://github.com/joeyagreco/fleaflicker)\n- [pymfl](https://github.com/joeyagreco/pymfl)\n- [sleeper](https://github.com/joeyagreco/sleeper)\n- [YahooFantasy](https://github.com/mattdodge/yahoofantasy)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Instant stats for any fantasy football league.",
    "version": "2.7.0",
    "project_urls": {
        "Homepage": "https://github.com/joeyagreco/leeger"
    },
    "split_keywords": [
        "nfl statistics stats football espn yahoo sleeper myfantasyleague",
        " fleaflicker"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3bba4667a2c6b0a8c94a52ea2a9a6af6d7900ee769ac7ca496c671aa98559783",
                "md5": "42bc37fe356f1665c7382726ac558113",
                "sha256": "a01f91c15a9ad03fa7109b8982cf005433fd5550ab5182ff568aa4d624df9988"
            },
            "downloads": -1,
            "filename": "leeger-2.7.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "42bc37fe356f1665c7382726ac558113",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 220042,
            "upload_time": "2024-12-25T19:28:12",
            "upload_time_iso_8601": "2024-12-25T19:28:12.825247Z",
            "url": "https://files.pythonhosted.org/packages/3b/ba/4667a2c6b0a8c94a52ea2a9a6af6d7900ee769ac7ca496c671aa98559783/leeger-2.7.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a95259a122a5bcb8d44fb25d79f3d982d652cb863dbd618fb0fd9fd00eac25ea",
                "md5": "2717ada111d623dc11eb3cce6938d383",
                "sha256": "9d9937885ef108886b8f623e740a29874dbaae965e20f6ec317bcff3b69a816b"
            },
            "downloads": -1,
            "filename": "leeger-2.7.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2717ada111d623dc11eb3cce6938d383",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 145352,
            "upload_time": "2024-12-25T19:28:15",
            "upload_time_iso_8601": "2024-12-25T19:28:15.448242Z",
            "url": "https://files.pythonhosted.org/packages/a9/52/59a122a5bcb8d44fb25d79f3d982d652cb863dbd618fb0fd9fd00eac25ea/leeger-2.7.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-25 19:28:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "joeyagreco",
    "github_project": "leeger",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "espn_api",
            "specs": [
                [
                    "~=",
                    "0.43.0"
                ]
            ]
        },
        {
            "name": "fleaflicker",
            "specs": [
                [
                    "~=",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "~=",
                    "1.24.4"
                ]
            ]
        },
        {
            "name": "openpyxl",
            "specs": [
                [
                    "~=",
                    "3.1.2"
                ]
            ]
        },
        {
            "name": "pymfl",
            "specs": [
                [
                    "~=",
                    "1.0.2"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    "~=",
                    "66.1.1"
                ]
            ]
        },
        {
            "name": "sleeper",
            "specs": [
                [
                    "~=",
                    "1.6.0"
                ]
            ]
        },
        {
            "name": "yahoofantasy",
            "specs": [
                [
                    "~=",
                    "1.4.2"
                ]
            ]
        }
    ],
    "lcname": "leeger"
}
        
Elapsed time: 0.43554s