Skip to content

Commit 79c0cd6

Browse files
committed
Update dependencies, quality scripts, and suppress pylint false positives
- Pin all dependencies to current venv versions in requirements.txt - Add requirements-dev.txt with black, pylint, mypy - Add tests/requirements.txt with pytest, requests, openapi-spec-validator - Fix make.ps1 and make.sh to use correct ml_rest_api directory (was ml_rest_fastapi) - Suppress pylint invalid-name on IN_UWSGI constant in app.py
1 parent ef5388a commit 79c0cd6

8 files changed

Lines changed: 31 additions & 13 deletions

File tree

make.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
$StyleOn="$($PSStyle.Bold)$($PSStyle.Foreground.Blue)"
2+
$StyleOff="$($PSStyle.Reset)"
3+
Write-Host $StyleOn"---------- Reformating with black... ----------"$StyleOff
4+
black .\ml_rest_api .\tests
5+
Write-Host $StyleOn"---------- Analysing with pylint... -----------"$StyleOff
6+
pylint --recursive=y .\ml_rest_api .\tests
7+
Write-Host $StyleOn"---------- Validating with mypy... ------------"$StyleOff
8+
mypy --pretty --config-file=mypy.ini .\ml_rest_api

make.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
echo -e "\033[1;34m---------- Reformating with black... ----------\033[0m"
3+
black ./ml_rest_api ./tests
4+
echo -e "\033[1;34m---------- Analysing with pylint... -----------\033[0m"
5+
pylint --recursive=y ./ml_rest_api ./tests
6+
echo -e "\033[1;34m---------- Validating with mypy... ------------\033[0m"
7+
mypy --pretty --config-file=mypy.ini ./ml_rest_api

ml_rest_api/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
import ml_rest_api.api.health.readiness # pylint: disable=unused-import
1515
import ml_rest_api.api.model.predict # pylint: disable=unused-import
1616

17-
IN_UWSGI: bool = True
17+
IN_UWSGI: bool = True # pylint: disable=invalid-name
1818
try:
1919
# pyright: reportMissingImports=false
2020
import uwsgi # pylint: disable=unused-import
2121
except ImportError:
22-
IN_UWSGI = False
22+
IN_UWSGI = False # pylint: disable=invalid-name
2323

2424

2525
def configure_app(flask_app: Flask) -> None:

ml_rest_api/ml_trained_model/ml_trained_model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# coding: utf-8
22
"""Module that does all the ML trained model prediction heavy lifting."""
3+
34
from logging import Logger, getLogger
45
from datetime import datetime, date
56
from os.path import normpath, join, dirname

requirements-dev.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
black==26.1.0
2+
pylint==4.0.5
3+
mypy==1.19.1

requirements.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
setuptools>=62.0.0
2-
Flask==3.0.3
3-
flask-restx==1.3.0
4-
Flask-WTF==1.2.1
5-
Werkzeug==3.0.3
1+
setuptools>=82.0.0
2+
Flask==3.1.3
3+
flask-restx==1.3.2
4+
Flask-WTF==1.2.2
5+
Werkzeug==3.1.6
66
rfc3339-validator==0.1.4
7-
numpy==1.26.4
8-
pandas==2.2.2
7+
numpy==2.4.2
8+
pandas==3.0.1

tests/basic_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
)
1212
from openapi_spec_validator.validation.exceptions import OpenAPIValidationError
1313

14-
1514
ROOT_URL = "http://localhost:8888/api/"
1615
SWAGGER_JSON_PATH = "swagger.json"
1716
LIVENESS_PATH = "liveness"

tests/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
pytest==8.2.1
2-
requests==2.32.1
3-
openapi_spec_validator==0.7.1
1+
pytest==9.0.2
2+
requests==2.32.5
3+
openapi-spec-validator==0.8.1

0 commit comments

Comments
 (0)