diff --git a/.github/workflows/python-build.yml b/.github/workflows/python-build.yml index 09a6aa2..b695e16 100644 --- a/.github/workflows/python-build.yml +++ b/.github/workflows/python-build.yml @@ -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 diff --git a/.gitignore b/.gitignore index a95f2bf..232876e 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,13 @@ env* .venv venv +.venv*/ +venv*/ +.python-version +.python-venv + +# dependencies +uv.lock # auth secrets **private*.json diff --git a/README.md b/README.md index e3690b4..edc87b4 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ If you wish to disable the automatic check for updates, you can set `CHECK_FOR_U ### 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. diff --git a/compose.build.yaml b/compose.build.yaml index 3f3a693..7065ba2 100644 --- a/compose.build.yaml +++ b/compose.build.yaml @@ -8,4 +8,4 @@ services: args: - PYTHON_VERSION_MAJOR=3 - PYTHON_VERSION_MINOR=12 - - PYTHON_VERSION_PATCH=0 + - PYTHON_VERSION_PATCH=7 diff --git a/compose.yaml b/compose.yaml index 95d8fef..040f66e 100644 --- a/compose.yaml +++ b/compose.yaml @@ -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" diff --git a/dao/platforms/base/position_mapping.json b/dao/platforms/base/position_mapping.json index 46d556d..014f1f1 100644 --- a/dao/platforms/base/position_mapping.json +++ b/dao/platforms/base/position_mapping.json @@ -152,8 +152,11 @@ "IDP_FLEX": { "base": "FLEX_IDP", "positions": [ + "CB", "DB", + "DE", "DL", + "DT", "LB" ] } diff --git a/main.py b/main.py index 53432ae..e883178 100644 --- a/main.py +++ b/main.py @@ -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: diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index 949e1f3..0000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,2 +0,0 @@ -bandit==1.7.10 -flake8==7.1.1 diff --git a/requirements.txt b/requirements.txt index 1cb26ab..689d0d0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/resources/documentation/README.md b/resources/documentation/README.md index 3fbe3b1..23fc6af 100644 --- a/resources/documentation/README.md +++ b/resources/documentation/README.md @@ -94,8 +94,6 @@ ### 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 diff --git a/utilities/utils.py b/utilities/utils.py index b36fc54..45e20e8 100644 --- a/utilities/utils.py +++ b/utilities/utils.py @@ -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()