Files
plex-playlist/backend/pyproject.toml
Cliff Hill cad7c7fea9
Some checks failed
Tests / Build and Push CICD Base Image (push) Successful in 1m2s
Tests / Build and Push CICD Complete Image (push) Failing after 20m37s
Tests / TSDoc Lint Check (push) Has been skipped
Tests / Trailing Whitespace Check (push) Has been skipped
Tests / End of File Check (push) Has been skipped
Tests / YAML Syntax Check (push) Has been skipped
Tests / TOML Syntax Check (push) Has been skipped
Tests / Mixed Line Ending Check (push) Has been skipped
Tests / TOML Formatting Check (push) Has been skipped
Tests / Ruff Linting (push) Has been skipped
Tests / No Docstring Types Check (push) Has been skipped
Tests / ESLint Check (push) Has been skipped
Tests / Prettier Format Check (push) Has been skipped
Tests / TypeScript Type Check (push) Has been skipped
Tests / Backend Tests (push) Has been skipped
Tests / Frontend Tests (push) Has been skipped
Tests / Ruff Format Check (push) Has been skipped
Tests / Pyright Type Check (push) Has been skipped
Tests / Darglint Docstring Check (push) Has been skipped
Tests / Backend Doctests (push) Has been skipped
Tests / Integration Tests (push) Has been skipped
Tests / End-to-End Tests (push) Has been skipped
Fixing how uv is being used in the base image, adding Poe the Poet to everything.
Signed-off-by: Cliff Hill <xlorep@darkhelm.org>
2025-10-31 13:25:03 -04:00

237 lines
8.8 KiB
TOML

[build-system]
build-backend = "hatchling.build"
requires = ["hatchling"]
[dependency-groups]
dev = [
"ruff>=0.6.0",
"pyright>=1.1.380",
"darglint>=1.8.1",
"pytest>=7.4.0",
"pytest-asyncio>=0.21.0",
"pytest-cov>=4.1.0",
"typeguard>=4.1.0",
"httpx>=0.25.0", # For testing async HTTP calls
"pytest-mock>=3.12.0",
# File format and linting tools
"pre-commit>=3.0.0", # For running pre-commit hooks in CI
"pyyaml>=6.0",
"yamllint>=1.35.0",
"toml-sort>=0.23.0",
"language-formatters-pre-commit-hooks>=2.14.0", # For pretty-format-toml
"xdoctest>=1.1.0", # For doctest support
"poethepoet>=0.24.0" # Task runner for unified development workflows
]
[project]
authors = [{name = "DarkHelm", email = "darkhelm@darkhelm.org"}]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.13"
]
dependencies = [
"fastapi>=0.100.0",
"uvicorn>=0.22.0"
]
description = "Backend service for Plex playlist management"
keywords = ["plex", "playlist", "media", "management"]
license = "MIT"
name = "plex-playlist-backend"
readme = "../README.md"
requires-python = ">=3.13"
version = "0.1.0"
[tool.coverage]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:"
]
[tool.coverage.run]
omit = [
"*/tests/*",
"*/venv/*",
"*/.venv/*",
"*/node_modules/*",
"*/migrations/*"
]
source = ["src"]
# Darglint configuration for backend
[tool.darglint]
docstring_style = "google"
strictness = "short"
[tool.hatch.build]
include = [
"src/backend/**/*.py",
"src/backend/py.typed"
]
[tool.hatch.build.targets.wheel]
packages = ["src/backend"]
[tool.hatch.version]
path = "src/backend/__init__.py"
[tool.poe.tasks]
build-cicd = {shell = "./scripts/build-cicd-local.sh", help = "Build both CI/CD images"}
# === Docker CI/CD Image Tasks ===
build-cicd-base = {shell = "./scripts/build-cicd-local.sh --base-only", help = "Build CI/CD base image only"}
build-cicd-complete = {shell = "./scripts/build-cicd-local.sh --complete-only", help = "Build CI/CD complete image only"}
build-cicd-force = {shell = "./scripts/build-cicd-local.sh --force", help = "Force rebuild CI/CD images"}
build-if-dockerfile-changed = {shell = "if git diff --quiet HEAD~1 Dockerfile.cicd-base Dockerfile.cicd; then echo 'No Dockerfile changes, skipping build'; else poe build-cicd; fi", help = "Only build CI/CD images if Dockerfiles changed"}
# === Local CI Simulation ===
ci-format-check = [
{shell = "cd backend && uv run ruff format --check ."},
{shell = "cd frontend && yarn prettier --check src/"}
]
ci-full = ["ci-format-check", "lint", "type-check", "test-all", "docs-backend"]
ci-quick = ["ci-format-check", "lint", "type-check"]
# === Utility Tasks ===
clean = [
{shell = "cd backend && find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true"},
{shell = "cd backend && find . -name '*.pyc' -delete 2>/dev/null || true"},
{shell = "cd frontend && rm -rf node_modules/.cache dist coverage 2>/dev/null || true"},
{shell = "docker system prune -f"}
]
deps-check = [
{shell = "cd backend && uv pip check"},
{shell = "cd frontend && yarn audit"}
]
# === Dependency Management ===
deps-install = [
{shell = "cd backend && uv sync --dev"},
{shell = "cd frontend && yarn install"}
]
deps-update = [
{shell = "cd backend && uv sync --upgrade --dev"},
{shell = "cd frontend && yarn upgrade"}
]
# === Development Environment Tasks ===
dev = {shell = "docker compose -f compose.dev.yml up -d", help = "Start development environment"}
dev-down = {shell = "docker compose -f compose.dev.yml down", help = "Stop development environment"}
dev-logs = {shell = "docker compose -f compose.dev.yml logs -f", help = "Follow development environment logs"}
dev-restart = {shell = "docker compose -f compose.dev.yml restart", help = "Restart development environment"}
# === Documentation Tasks ===
docs-backend = {shell = "cd backend && uv run xdoctest --module backend", help = "Run backend docstring tests"}
docs-check = {shell = "cd backend && uv run darglint backend/", help = "Check docstring quality"}
format = ["format-backend", "format-frontend"]
# === Code Formatting Tasks ===
format-backend = {shell = "cd backend && uv run ruff format .", help = "Format backend Python code"}
format-frontend = {shell = "cd frontend && yarn prettier --write src/", help = "Format frontend TypeScript code"}
lint = ["lint-backend", "lint-frontend"]
# === Linting Tasks ===
lint-backend = {shell = "cd backend && uv run ruff check .", help = "Lint backend Python code"}
lint-frontend = {shell = "cd frontend && yarn lint", help = "Lint frontend TypeScript code"}
# === Parallel Execution for Speed ===
lint-parallel = {shell = "poe lint-backend & poe lint-frontend & wait", help = "Run linting in parallel for speed"}
# === CI/CD Tasks ===
pre-commit-install = {shell = "pre-commit install", help = "Install pre-commit hooks"}
pre-commit-run = {shell = "pre-commit run --all-files", help = "Run all pre-commit hooks"}
pre-commit-update = {shell = "pre-commit autoupdate", help = "Update pre-commit hook versions"}
# === Quality Gates (Mimics CI Pipeline) ===
quality-gate = [
{shell = "echo '🔍 Running quality gate checks...'"},
"ci-format-check",
"lint",
"type-check",
"test-unit",
"docs-check",
{shell = "echo '✅ All quality checks passed!'"}
]
reset = [
"clean",
{shell = "cd backend && rm -rf .venv 2>/dev/null || true"},
{shell = "cd frontend && rm -rf node_modules 2>/dev/null || true"},
"deps-install"
]
# === Development Setup (New Developer Onboarding) ===
setup = [
"deps-install",
"pre-commit-install",
"dev",
{shell = "echo '✓ Development environment ready!'"},
{shell = "echo ' - Frontend: http://localhost:3000'"},
{shell = "echo ' - Backend API: http://localhost:8000'"},
{shell = "echo ' - API Docs: http://localhost:8000/docs'"}
]
test-all = ["test-backend", "test-frontend", "test-integration"]
# === Testing Tasks ===
test-backend = {shell = "cd backend && uv run pytest", help = "Run backend unit tests"}
test-backend-cov = {shell = "cd backend && uv run pytest --cov", help = "Run backend tests with coverage"}
test-e2e = {shell = "cd frontend && yarn test:e2e", help = "Run end-to-end tests"}
test-frontend = {shell = "cd frontend && yarn test", help = "Run frontend unit tests"}
test-frontend-cov = {shell = "cd frontend && yarn test:coverage", help = "Run frontend tests with coverage"}
test-full = ["test-backend-cov", "test-frontend-cov", "test-integration", "test-e2e"]
# === Smart Conditional Tasks ===
test-if-changed = {shell = "if git diff --quiet HEAD~1 backend/ frontend/; then echo 'No changes detected, skipping tests'; else poe test-unit; fi", help = "Only run tests if code has changed"}
test-integration = {shell = "cd backend && uv run pytest tests/integration/", help = "Run backend integration tests"}
test-parallel = {shell = "poe test-backend & poe test-frontend & wait", help = "Run unit tests in parallel for speed"}
# === Comprehensive Testing ===
test-unit = ["test-backend", "test-frontend"]
type-check = ["type-check-backend", "type-check-frontend"]
# === Type Checking Tasks ===
type-check-backend = {shell = "cd backend && uv run pyright .", help = "Type check backend Python code"}
type-check-frontend = {shell = "cd frontend && yarn type-check", help = "Type check frontend TypeScript code"}
type-check-parallel = {shell = "poe type-check-backend & poe type-check-frontend & wait", help = "Run type checking in parallel for speed"}
[tool.pytest.ini_options]
addopts = [
"--strict-markers",
"--strict-config",
"--verbose",
"--cov=backend",
"--cov-report=term-missing:skip-covered",
"--cov-report=html",
"--cov-report=xml"
]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests"
]
python_classes = ["Test*"]
python_files = ["test_*.py", "*_test.py"]
python_functions = ["test_*"]
testpaths = ["tests"]
[tool.ruff]
line-length = 88
src = ["src"]
target-version = "py313"
[tool.ruff.lint]
ignore = [
"E501", # line too long, handled by black
"B008", # do not perform function calls in argument defaults
"B903" # Use `collections.abc.MutableMapping` instead of `typing.MutableMapping`
]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"ARG", # flake8-unused-arguments
"SIM", # flake8-simplify
"TCH" # flake8-type-checking
]
[tool.ruff.lint.isort]
known-first-party = ["backend"]
section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"]
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["ARG", "S101"]