chore(ml): added testing and github workflow (#2969)

* added testing

* github action for python, made mypy happy

* formatted with black

* minor fixes and styling

* test model cache

* cache test dependencies

* narrowed model cache tests

* moved endpoint tests to their own class

* cleaned up fixtures

* formatting

* removed unused dep
This commit is contained in:
Mert
2023-06-27 19:21:33 -04:00
committed by GitHub
parent 5e3bdc76b2
commit df1e8679d9
12 changed files with 622 additions and 95 deletions

View File

@@ -22,6 +22,8 @@ fastapi = "^0.95.2"
uvicorn = {extras = ["standard"], version = "^0.22.0"}
pydantic = "^1.10.8"
aiocache = "^0.12.1"
pytest-cov = "^4.1.0"
ruff = "^0.0.272"
[tool.poetry.group.dev.dependencies]
mypy = "^1.3.0"
@@ -29,6 +31,8 @@ black = "^23.3.0"
pytest = "^7.3.1"
locust = "^2.15.1"
gunicorn = "^20.1.0"
httpx = "^0.24.1"
pytest-asyncio = "^0.21.0"
[[tool.poetry.source]]
name = "pytorch-cpu"
@@ -39,9 +43,6 @@ priority = "explicit"
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.flake8]
max-line-length = 120
[tool.mypy]
python_version = "3.11"
plugins = "pydantic.mypy"
@@ -49,11 +50,35 @@ follow_imports = "silent"
warn_redundant_casts = true
disallow_any_generics = true
check_untyped_defs = true
no_implicit_reexport = true
disallow_untyped_defs = true
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true
warn_untyped_fields = true
[[tool.mypy.overrides]]
module = [
"transformers.pipelines",
"cv2",
"insightface.app",
"sentence_transformers",
"aiocache.backends.memory",
"aiocache.lock",
"aiocache.plugins"
]
ignore_missing_imports = true
[tool.ruff]
line-length = 120
target-version = "py311"
select = ["E", "F", "I"]
ignore = ["F401"]
[tool.ruff.per-file-ignores]
"test_main.py" = ["F403"]
[tool.black]
line-length = 120
target-version = ['py311']