Skip to content

Commit 7f5a4e6

Browse files
authored
Merge pull request #229 from uberfastman/release/v20.0.0
Release/v20.0.0
2 parents 5862214 + 747d840 commit 7f5a4e6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+4791
-3887
lines changed

.dockerignore

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,12 @@
99
**.pytest_cache
1010

1111
# environment
12-
.env*
13-
env*
14-
.venv
15-
venv
12+
*.env*
13+
.venv*/
14+
.python-venv
1615

1716
# auth secrets
1817
**private*.json
19-
!**private.template.json
20-
**token*.json
21-
!**token.template.json
22-
**credentials*.json
23-
!**credentials.template.json
2418

2519
# output
2620
**logs/

.github/workflows/python-build.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
1+
# This workflow will install Python dependencies and run tests with a variety of Python versions
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

44
name: CI Build
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
python-version: ["3.11", "3.12"]
23+
python-version: ["3.11", "3.12", "3.13"]
2424

2525
steps:
2626
- uses: actions/checkout@v4
@@ -31,18 +31,8 @@ jobs:
3131
- name: Install dependencies
3232
run: |
3333
python -m pip install --upgrade pip
34-
python -m pip install flake8 bandit pytest
34+
python -m pip install pytest
3535
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
36-
# - name: Lint with flake8
37-
# run: |
38-
# # stop the build if there are Python syntax errors
39-
# flake8 . --count --show-source --statistics
40-
# # exit-zero treats all errors as warnings
41-
# flake8 . --count --exit-zero --statistics
42-
# - name: Security lint with bandit
43-
# run: |
44-
# # stop the build if there are security warnings
45-
# bandit -r yfpy/
46-
- name: Test with pytest
36+
- name: Test with PyTest
4737
run: |
4838
pytest

.gitignore

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,11 @@
1010

1111
# environment
1212
*.env*
13-
env*
14-
.venv
15-
venv
1613
.venv*/
17-
venv*/
18-
.python-version
1914
.python-venv
2015

21-
# dependencies
22-
uv.lock
23-
2416
# auth secrets
2517
**private*.json
26-
!**private.template.json
27-
**token*.json
28-
!**token.template.json
29-
**credentials*.json
30-
!**credentials.template.json
3118

3219
# output
3320
**logs/

.ruff.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
exclude = [
2+
".git",
3+
".github",
4+
".idea",
5+
".pytest_cache",
6+
".python-venv",
7+
"__pycache__",
8+
]
9+
extend-exclude = [
10+
]
11+
line-length = 120
12+
indent-width = 4
13+
14+
[format]
15+
quote-style = "double"
16+
indent-style = "space"
17+
docstring-code-format = true
18+
skip-magic-trailing-comma = false
19+
line-ending = "auto"
20+
21+
[lint]
22+
extend-select = [
23+
"E501"
24+
]

Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Determine this makefile's path. Be sure to place this BEFORE `include` directives, if any.
2+
THIS_FILE := $(lastword $(MAKEFILE_LIST))
3+
4+
# help target from https://github.com/cargo-bins/cargo-quickinstall/blob/e17486445f6577c551a35876dca73132cc4c6298/Makefile#L70
5+
help:
6+
@grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
7+
8+
.PHONY: deps dev_deps lint secure test_code test_actions test_actions_amd check test_check help Makefile
9+
10+
deps: ## Install all dependencies.
11+
uv pip install -r requirements.txt
12+
13+
dev_deps: ## Install all development dependencies.
14+
uv pip install -r requirements-dev.txt
15+
16+
lint: ## Lint code with ruff.
17+
ruff check .
18+
19+
secure: ## Check code security with bandit.
20+
$ bandit -r ffmwr -s B113,B310,B311,B608
21+
22+
test_code: ## Run tests with PyTest.
23+
pytest tests
24+
25+
test_actions: ## Test GitHub Actions using act.
26+
act -j build
27+
28+
test_actions_amd: ## Test package GitHub Actions on ARM architecture using act.
29+
act --container-architecture linux/amd64 -j build
30+
31+
check: deps dev_deps lint secure ## Run all code checks.
32+
echo "Code checked."
33+
34+
test_check: check test_code ## Run all code checks and tests.
35+
echo "Code checked and tested."

README.md

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Project dependencies can be viewed in the [`requirements.txt`](requirements.txt)
195195

196196
The Fantasy Football Metrics Weekly Report requires several sets of setup steps, depending on which platform(s) for which you will be running it. To get the application running locally, you will first need to complete the below setup.
197197

198-
_\* General setup **excludes** Google Drive and Slack integrations. See [Additional Integrations](#additional-integrations) for details on including those add-ons._
198+
_\* General setup **excludes** third-party integrations. See [Additional Integrations](#additional-integrations) for details on including those add-ons._
199199

200200
---
201201

@@ -452,15 +452,19 @@ CBS has a public API that was once documented, the last version of which can be
452452

453453
1. You should see the following prompts:
454454

455-
1. `Generate report for default league? (y/n) -> `.
455+
1. `Generate report for default platform? (y/n) ->`
456456

457457
Type `y` and hit enter.
458458

459459
2. `Generate report for default week? (y/n) ->`.
460460

461461
Type `y` and hit enter.
462462

463-
3. <ins>**NOTE FOR YAHOO USERS ONLY**</ins>: The ***FIRST*** time you run the app, you will see an `AUTHORIZATION URL` (if you followed the instructions in the [Yahoo Setup](#yahoo-setup) section).
463+
3. `Generate report for default league? (y/n) -> `
464+
465+
Type `y` and hit enter.
466+
467+
4. <ins>**NOTE FOR YAHOO USERS ONLY**</ins>: The ***FIRST*** time you run the app, you will see an `AUTHORIZATION URL` (if you followed the instructions in the [Yahoo Setup](#yahoo-setup) section).
464468

465469
1. Click the link (or copy and paste it into your web browser).
466470

@@ -527,29 +531,31 @@ In addition to turning on/off the features of the report PDF itself, there are a
527531

528532
After completing the above setup and settings steps, you should now be able to simply run `docker exec -it fantasy-football-metrics-weekly-report_app_1 python main.py` to regenerate a report. The report generator script (`main.py`) also supports several command line options/arguments that allow you to specify the following:
529533

530-
| Flag | Description |
531-
|:----------------------------------------|:--------------------------------------------------------------------------------------------------------------------------|
532-
| `-h`, `--help` | Display command line usage message |
533-
| `-d`, `--use-default` | Automatically run the report using the default settings without user input prompts. |
534-
| `-f`, `--fantasy-platform` `<platform>` | Fantasy football platform on which league for report is hosted. |
535-
| `-l`, `--league-id` `<league_id>` | Fantasy Football league ID |
536-
| `-w`, `--week` `<week>` | Chosen week for which to generate report |
537-
| `-g`, `--game-id` `<game_id>` | Chosen fantasy game id for which to generate report. Defaults to "nfl", interpreted as the current season if using Yahoo. |
538-
| `-y`, `--year` `<year>` | Chosen year (season) of the league for which a report is being generated. |
539-
| `-s`, `--save-data` | Save all retrieved data locally for faster future report generation |
540-
| `-s`, `--refresh-web-data` | Refresh all web data from external APIs (such as bad boy and beef data) |
541-
| `-p`, `--playoff-prob-sims` `<int>` | Number of Monte Carlo playoff probability simulations to run." |
542-
| `-b`, `--break-ties` | Break ties in metric rankings |
543-
| `-q`, `--disqualify-ce` | Automatically disqualify teams ineligible for coaching efficiency metric |
544-
| `-o`, `--offline` | Run ***OFFLINE*** (for development). Must have previously run report with -s option. |
545-
| `-t`, `--test` | Generate TEST report (for development) |
534+
| Flag | Description |
535+
|:-------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------|
536+
| `-h`, `--help` | Display command line usage message |
537+
| `-p`, `--fantasy-platform` `<platform>` | Fantasy football platform on which league for report is hosted |
538+
| `-l`, `--league-id` `<league_id>` | Fantasy Football league ID |
539+
| `-g`, `--yahoo-game-id` `<yahoo_game_id>` | (Yahoo only) Chosen fantasy game id for which to generate report. Defaults to "nfl", which is interpreted as the current season on Yahoo |
540+
| `-y`, `--year` `<year>` | Chosen year (season) of the league for which a report is being generated |
541+
| `-k`, `--start-week` `<league_start_week>` | League start week (if league started later than week |
542+
| `-w`, `--week` `<week>` | Chosen week for which to generate report |
543+
| `-d`, `--use-default` | Run the report using the default settings (in .env file) without user input |
544+
| `-s`, `--save-data` | Save all fantasy league data for faster future report generation |
545+
| `-r`, `--refresh-feature-web-data` | Refresh all feature web data |
546+
| `-m`, `--playoff-prob-sims` `<num_sims>` | Number of Monte Carlo playoff probability simulations to run |
547+
| `-b`, `--break-ties` | Break ties in metric rankings |
548+
| `-q`, `--disqualify-coaching-efficiency` | Automatically disqualify teams ineligible for coaching efficiency metric |
549+
| `-o`, `--offline` | Run ***OFFLINE*** for development (must have previously run report with -s option) |
550+
| `-u`, `--skip-uploads ` | Skip all integration uploads regardless of the configured settings |
551+
| `-t`, `--test` | Generate TEST report |
546552

547553
#### NOTE: all command line arguments <ins>***OVERRIDE***</ins> any settings in the local .env file!
548554

549555
##### Example:
550556

551557
```bash
552-
docker exec -it fantasy-football-metrics-weekly-report_app_1 python main.py -l 140941 -f fleaflicker -y 2020 -w 3 -p 1000 -s -r
558+
docker exec -it fantasy-football-metrics-weekly-report_app_1 python main.py -p fleaflicker -l 140941 -y 2020 -w 3 -m 1000 -s -r
553559
```
554560

555561
The above command runs the report with the following settings (which override anything set in the `.env` file):
@@ -573,7 +579,7 @@ The above command runs the report with the following settings (which override an
573579
<a name="additional-integrations"></a>
574580
### Additional Integrations
575581

576-
The Fantasy Football Metrics Weekly Report application also supports several additional integrations if you choose to utilize them. Currently, it is capable of uploading your generated reports to Google Drive, and also directly posting your generated reports to the Slack Messenger app.
582+
The Fantasy Football Metrics Weekly Report application also supports several additional integrations if you choose to utilize them.
577583

578584
<a name="google-drive-setup"></a>
579585
#### Google Drive Setup

RELEASE.md

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,17 @@
1212
pip install -r requirements.txt -r requirements-dev.txt
1313
```
1414

15-
4. *(Optional)* Lint code with `flake8`:
16-
```shell
17-
flake8 . --count --show-source --statistics
18-
```
19-
20-
5. *(Optional)* Check code security with `bandit`:
21-
```shell
22-
bandit -r .
23-
```
24-
25-
6. *(Optional)* Run *all* `pytest` tests:
15+
4. *(Optional)* Run *all* `pytest` tests:
2616
```shell
2717
python -m pytest
2818
```
2919

30-
7. *(Optional)* Run *all* `pytest` tests *verbosely*:
20+
5. *(Optional)* Run *all* `pytest` tests *verbosely*:
3121
```shell
3222
python -m pytest -v -s
3323
```
3424

35-
8. *(Optional)* Test Python support using [act](https://github.com/nektos/act) for GitHub Actions:
25+
6. *(Optional)* Test Python support using [act](https://github.com/nektos/act) for GitHub Actions:
3626

3727
```shell
3828
act -j build
@@ -44,33 +34,33 @@
4434
sudo ln -s "$HOME/.docker/run/docker.sock" /var/run/docker.sock`
4535
```
4636

47-
9. Update the Docker `compose.yaml` file with the latest version of the app.
37+
7. Update the Docker `compose.yaml` file with the latest version of the app.
4838

49-
10. Build and push a new Docker image for the app (see [DEPLOYMENT.md](./docker/DEPLOYMENT.md)).
39+
8. Build and push a new Docker image for the app (see [DEPLOYMENT.md](./docker/DEPLOYMENT.md)).
5040

51-
11. *(Optional)* Create a new git branch if creating a release:
52-
```shell
53-
git checkout -b release/vX.X.X
54-
```
41+
9. *(Optional)* Create a new git branch if creating a release:
42+
```shell
43+
git checkout -b release/vX.X.X
44+
```
5545

56-
12. Create a git commit:
46+
10. Create a git commit:
5747
```shell
5848
git add .
5949
git commit -m 'commit message'
6050
```
6151

62-
13. Update the git tag (format: `git tag -a [tag_name/version] -m [message]`):
52+
11. Update the git tag (format: `git tag -a [tag_name/version] -m [message]`):
6353
```shell
6454
git tag -a v1.0.0 -m 'first release'
6555
git push origin --tags
6656
```
6757

68-
14. *(Optional)* View git tags:
58+
12. *(Optional)* View git tags:
6959
```shell
7060
git tag -l --sort=v:refname -n99
7161
```
7262

73-
15. Update `fantasy-football-metrics-weekly-report` GitHub repository:
63+
13. Update `fantasy-football-metrics-weekly-report` GitHub repository:
7464

7565
* *(Optional)* If creating a release:
7666
```shell
@@ -82,6 +72,6 @@
8272
git push
8373
```
8474

85-
16. Open a pull request (PR) with the `release/vX.X.X` branch, allow GitHub actions to complete successfully, draft release notes, and merge it.
75+
14. Open a pull request (PR) with the `release/vX.X.X` branch, allow GitHub actions to complete successfully, draft release notes, and merge it.
8676

87-
17. Go to the [FFMWR Releases page](https://github.com/uberfastman/fantasy-football-metrics-weekly-report/releases) and draft a new release using the above git tag.
77+
15. Go to the [FFMWR Releases page](https://github.com/uberfastman/fantasy-football-metrics-weekly-report/releases) and draft a new release using the above git tag.

compose.build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ services:
77
dockerfile: docker/Dockerfile
88
args:
99
- PYTHON_VERSION_MAJOR=3
10-
- PYTHON_VERSION_MINOR=12
11-
- PYTHON_VERSION_PATCH=7
10+
- PYTHON_VERSION_MINOR=13
11+
- PYTHON_VERSION_PATCH=1

compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
services:
33

44
app:
5-
image: ghcr.io/uberfastman/fantasy-football-metrics-weekly-report:19.5.0
5+
image: ghcr.io/uberfastman/fantasy-football-metrics-weekly-report:20.0.0
66
platform: linux/amd64
77
ports:
88
- "5001:5000"

dao/__init__.py

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)