mantimon-tcg/backend/pyproject.toml
Cal Corum 996c43fbd9 Implement Phase 2: Authentication system
Complete OAuth-based authentication with JWT session management:

Core Services:
- JWT service for access/refresh token creation and verification
- Token store with Redis-backed refresh token revocation
- User service for CRUD operations and OAuth-based creation
- Google and Discord OAuth services with full flow support

API Endpoints:
- GET /api/auth/{google,discord} - Start OAuth flows
- GET /api/auth/{google,discord}/callback - Handle OAuth callbacks
- POST /api/auth/refresh - Exchange refresh token for new access token
- POST /api/auth/logout - Revoke single refresh token
- POST /api/auth/logout-all - Revoke all user sessions
- GET/PATCH /api/users/me - User profile management
- GET /api/users/me/linked-accounts - List OAuth providers
- GET /api/users/me/sessions - Count active sessions

Infrastructure:
- Pydantic schemas for auth/user request/response models
- FastAPI dependencies (get_current_user, get_current_premium_user)
- OAuthLinkedAccount model for multi-provider support
- Alembic migration for oauth_linked_accounts table

Dependencies added: email-validator, fakeredis (dev), respx (dev)

84 new tests, 1058 total passing
2026-01-27 21:49:59 -06:00

122 lines
2.7 KiB
TOML

[project]
name = "mantimon-tcg-backend"
version = "0.1.0"
description = "Mantimon TCG - Backend API and Game Engine"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"alembic>=1.18.1",
"asyncpg>=0.31.0",
"bcrypt>=5.0.0",
"email-validator>=2.3.0",
"fastapi>=0.128.0",
"httpx>=0.28.1",
"passlib>=1.7.4",
"psycopg2-binary>=2.9.11",
"pydantic>=2.12.5",
"pydantic-settings>=2.12.0",
"python-jose>=3.5.0",
"python-socketio>=5.16.0",
"redis>=7.1.0",
"sqlalchemy>=2.0.46",
"uvicorn>=0.40.0",
]
[dependency-groups]
dev = [
"beautifulsoup4>=4.12.0",
"black>=26.1.0",
"fakeredis>=2.33.0",
"httpx>=0.28.1",
"mypy>=1.19.1",
"pytest>=9.0.2",
"pytest-asyncio>=1.3.0",
"pytest-cov>=7.0.0",
"requests>=2.31.0",
"respx>=0.22.0",
"ruff>=0.14.14",
"testcontainers[postgres,redis]>=4.0.0",
]
# Black configuration
[tool.black]
line-length = 100
target-version = ["py312"]
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.venv
| __pycache__
| migrations
)/
'''
# Ruff configuration (fast Python linter)
[tool.ruff]
line-length = 100
target-version = "py312"
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # Pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"SIM", # flake8-simplify
]
ignore = [
"E501", # line too long (handled by black)
"B008", # do not perform function calls in argument defaults (FastAPI Depends)
]
[tool.ruff.lint.isort]
known-first-party = ["app"]
# Pytest configuration
[tool.pytest.ini_options]
testpaths = ["tests"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "session"
addopts = "-v --tb=short"
filterwarnings = [
"ignore::DeprecationWarning",
# Suppress async connection cleanup warnings from pytest-asyncio event loop mismatch
# These are harmless since we use NullPool + TRUNCATE for test isolation
"ignore:The garbage collector is trying to clean up:sqlalchemy.exc.SAWarning",
"ignore:coroutine 'Connection._cancel' was never awaited:RuntimeWarning",
]
# MyPy configuration
[tool.mypy]
python_version = "3.12"
strict = true
warn_return_any = true
warn_unused_ignores = true
disallow_untyped_defs = true
plugins = ["pydantic.mypy"]
[[tool.mypy.overrides]]
module = [
"redis.*",
"socketio.*",
"passlib.*",
]
ignore_missing_imports = true
# Coverage configuration
[tool.coverage.run]
source = ["app"]
branch = true
omit = ["*/tests/*", "*/__pycache__/*"]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"raise NotImplementedError",
]