Skip to content

Commit

Permalink
udpated documentation, dependency checking, and fixed Sleeper bug wit…
Browse files Browse the repository at this point in the history
…h missing player positions
uberfastman committed Nov 16, 2024
1 parent 0a68741 commit 5862214
Showing 11 changed files with 43 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-build.yml
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.11", "3.12"]

steps:
- uses: actions/checkout@v4
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -13,6 +13,13 @@
env*
.venv
venv
.venv*/
venv*/
.python-version
.python-venv

# dependencies
uv.lock

# auth secrets
**private*.json
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -184,7 +184,7 @@ If you wish to disable the automatic check for updates, you can set `CHECK_FOR_U
<a name="dependencies"></a>
### Dependencies

The application is actively developed in macOS, but is cross-platform compatible. The app requires ***Python 3.10 or later***. To check if you have the minimum required version (or later) of Python installed, open up a window in Terminal (macOS), Command Prompt (Windows), or a command line shell of your choice, and run `python --version`. If the return value is `Python 3.x.x` where the first `x` is equal to or greater than the minimum required minor version, you are good to go. If the return is `Python 2.x.x`, you will need to install the correct Python 3 version. Check out the instructions [here](https://realpython.com/installing-python/) for how to install Python 3 on your system.
The application is actively developed in macOS, but is cross-platform compatible. The app requires ***Python 3.11 or later***. To check if you have the minimum required version (or later) of Python installed, open up a window in Terminal (macOS), Command Prompt (Windows), or a command line shell of your choice, and run `python --version`. If the return value is `Python 3.x.x` where the first `x` is equal to or greater than the minimum required minor version, you are good to go. If the return is `Python 2.x.x`, you will need to install the correct Python 3 version. Check out the instructions [here](https://realpython.com/installing-python/) for how to install Python 3 on your system.

Project dependencies can be viewed in the [`requirements.txt`](requirements.txt) file.

2 changes: 1 addition & 1 deletion compose.build.yaml
Original file line number Diff line number Diff line change
@@ -8,4 +8,4 @@ services:
args:
- PYTHON_VERSION_MAJOR=3
- PYTHON_VERSION_MINOR=12
- PYTHON_VERSION_PATCH=0
- PYTHON_VERSION_PATCH=7
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
services:

app:
image: ghcr.io/uberfastman/fantasy-football-metrics-weekly-report:19.4.0
image: ghcr.io/uberfastman/fantasy-football-metrics-weekly-report:19.5.0
platform: linux/amd64
ports:
- "5001:5000"
3 changes: 3 additions & 0 deletions dao/platforms/base/position_mapping.json
Original file line number Diff line number Diff line change
@@ -152,8 +152,11 @@
"IDP_FLEX": {
"base": "FLEX_IDP",
"positions": [
"CB",
"DB",
"DE",
"DL",
"DT",
"LB"
]
}
28 changes: 18 additions & 10 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
__author__ = "Wren J. R. (uberfastman)"
__email__ = "uberfastman@uberfastman.dev"

import sys

if not sys.warnoptions:
import warnings

# suppress SyntaxWarning due to "invalid escape sequence" messages in transitive dependencies: stringcase, rauth
warnings.filterwarnings("ignore", category=SyntaxWarning)

import getopt
import os
import re
import subprocess
import sys
import time
from importlib.metadata import distributions
from pathlib import Path
from typing import Union

@@ -21,6 +27,7 @@
from utilities.app import check_github_for_updates
from utilities.logger import get_logger
from utilities.settings import settings
from utilities.utils import normalize_dependency_package_name

colorama.init()

@@ -36,18 +43,19 @@ def main(argv):
with open(Path(__file__).parent / "requirements.txt", "r") as reqs:
for line in reqs.readlines():
if not line.startswith("#"):
dependencies.append(line.strip())
dep, dep_version = line.strip().split("==")
dependencies.append(f"{normalize_dependency_package_name(dep)}=={dep_version}")

installed_dependencies = sorted(
[f"{normalize_dependency_package_name(x.name)}=={x.version}" for x in distributions()]
)

installed_dependencies = subprocess.check_output(["pip", "freeze"]).decode("utf-8")
missing_dependency_count = 0
for dependency in dependencies:
dependency_is_installed = installed_dependencies.find(dependency) != -1
if not dependency_is_installed:
if dependency not in installed_dependencies:
missing_dependency_count += 1
dependency_package = re.split("\\W+", dependency)[0]
logger.error(
f"MISSING DEPENDENCY: {dependency_package}. Please run `pip install {dependency_package}` and retry "
f"the report generation."
f"MISSING DEPENDENCY: {dependency}. Please run `uv add {dependency}` and retry the report generation."
)

if missing_dependency_count > 0:
2 changes: 0 additions & 2 deletions requirements-dev.txt

This file was deleted.

10 changes: 6 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
bandit==1.7.9
beautifulsoup4==4.12.3
camel-converter==4.0.1
colorama==0.4.6
discord-webhook==1.3.1
espn-api==0.39.0
GitPython==3.1.43
flake8==7.1.1
gitpython==3.1.43
google-api-python-client==2.149.0
httplib2==0.22.0
numpy==2.1.2
oauth2client==4.1.3
pillow==10.4.0
pydantic==2.9.2
pydantic-settings==2.5.2
PyDrive2==1.20.0
pydantic==2.9.2
pydrive2==1.20.0
pytest==8.3.3
python-dotenv==1.0.1
reportlab==4.2.5
requests==2.32.3
selenium==4.25.0
slack_sdk==3.33.1
slack-sdk==3.33.1
tornado==6.4.1
urllib3==2.2.3
yahoo-oauth==2.1.0
2 changes: 0 additions & 2 deletions resources/documentation/README.md
Original file line number Diff line number Diff line change
@@ -94,8 +94,6 @@
<a name="running-the-report-application"></a>
### Running the Report Application

* If you are running on macOS, see [below](#macos-launch-script)!

* *If you followed the setup instructions and set up the application to run in a virtual environment, once you have navigated to the project directory, you **MUST** run*

```bash
5 changes: 5 additions & 0 deletions utilities/utils.py
Original file line number Diff line number Diff line change
@@ -14,6 +14,11 @@
logger = get_logger(__name__, propagate=False)


def normalize_dependency_package_name(package_name: str) -> str:
# normalize Python package name (see https://packaging.python.org/en/latest/specifications/name-normalization/)
return re.sub(r"[-_.]+", "-", package_name).lower()


def format_platform_display(platform: str) -> str:
return platform.capitalize() if len(platform) > 4 else platform.upper()

0 comments on commit 5862214

Please sign in to comment.