Add ruff and mypy to dev dependencies with configuration in pyproject.toml. Add a lint CI job that runs ruff check, ruff format --check, and mypy. Auto-fix import sorting and formatting across the codebase. Exclude alembic/versions from linting (auto-generated migrations). Ignore B008 (FastAPI Depends pattern) and RUF001 (unicode in user-facing strings). 21 ruff lint errors and 50 mypy errors remain for manual review. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
26 lines
688 B
Python
26 lines
688 B
Python
from __future__ import annotations
|
|
|
|
from functools import lru_cache
|
|
|
|
from app.auth.rate_limit import SlidingWindowRateLimiter
|
|
from app.auth.security import PasswordService
|
|
from app.auth.service import AuthService
|
|
from app.settings import settings
|
|
|
|
|
|
@lru_cache
|
|
def get_password_service() -> PasswordService:
|
|
return PasswordService()
|
|
|
|
|
|
@lru_cache
|
|
def get_auth_service() -> AuthService:
|
|
return AuthService(password_service=get_password_service())
|
|
|
|
|
|
@lru_cache
|
|
def get_login_rate_limiter() -> SlidingWindowRateLimiter:
|
|
return SlidingWindowRateLimiter(
|
|
max_attempts=settings.login_rate_limit_attempts,
|
|
window_seconds=settings.login_rate_limit_window_seconds,
|
|
)
|