Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code check workflow, add poetry test deps #1

Merged
merged 2 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
with:
node-version: 18
cache: 'npm'
cache-dependency-path: 'frontend/package-lock.json'
- name: Install dependencies and check code
run: |
poetry env use '3.10'
Expand Down
1 change: 1 addition & 0 deletions backend/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Backend package."""
1 change: 1 addition & 0 deletions backend/api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Backend API package."""
3 changes: 2 additions & 1 deletion backend/api/delirium.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Delirium rates API endpoints."""

from typing import List, Dict
from typing import Dict, List

from fastapi import FastAPI
from pydantic import BaseModel

Expand Down
2 changes: 1 addition & 1 deletion backend/api/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

from backend.api.delirium import (
get_delirium_rates,
get_time_trends,
get_patient_demographics,
get_time_trends,
)


Expand Down
840 changes: 839 additions & 1 deletion poetry.lock

Large diffs are not rendered by default.

90 changes: 90 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,96 @@ fastapi = "^0.111.0"
uvicorn = "^0.30.1"
pydantic = "^2.7.4"

[tool.poetry.group.test]
optional = true

[tool.poetry.group.test.dependencies]
pytest = "^7.1.1"
pre-commit = "^2.17.0"
pytest-cov = "^3.0.0"
codecov = "^2.1.13"
mypy = "^1.7.0"
ruff = "^0.2.0"
pip-audit = "^2.7.1"

[tool.mypy]
ignore_missing_imports = true
install_types = true
pretty = true
namespace_packages = true
explicit_package_bases = true
non_interactive = true
warn_unused_configs = true
allow_any_generics = false
allow_subclassing_any = false
allow_untyped_calls = false
allow_untyped_defs = false
allow_incomplete_defs = false
check_untyped_defs = true
allow_untyped_decorators = false
warn_redundant_casts = true
warn_unused_ignores = true
warn_return_any = true
implicit_reexport = false
strict_equality = true
extra_checks = true

[tool.ruff]
include = ["*.py", "pyproject.toml", "*.ipynb"]
line-length = 88

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
docstring-code-format = true

[tool.ruff.lint]
select = [
"A", # flake8-builtins
"B", # flake8-bugbear
"COM", # flake8-commas
"C4", # flake8-comprehensions
"RET", # flake8-return
"SIM", # flake8-simplify
"ICN", # flake8-import-conventions
"Q", # flake8-quotes
"RSE", # flake8-raise
"D", # pydocstyle
"E", # pycodestyle
"F", # pyflakes
"I", # isort
"W", # pycodestyle
"N", # pep8-naming
"ERA", # eradicate
"PL", # pylint
]
fixable = ["A", "B", "COM", "C4", "RET", "SIM", "ICN", "Q", "RSE", "D", "E", "F", "I", "W", "N", "ERA", "PL"]
ignore = [
"B905", # `zip()` without an explicit `strict=` parameter
"E501", # line too long
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"PLR2004", # Replace magic number with named constant
"PLR0913", # Too many arguments
"COM812", # Missing trailing comma
]

# Ignore import violations in all `__init__.py` files.
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402", "F401", "F403", "F811"]

[tool.ruff.lint.pep8-naming]
ignore-names = ["X*", "setUp"]

[tool.ruff.lint.isort]
lines-after-imports = 2

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.ruff.lint.pycodestyle]
max-doc-length = 88

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"