add style guide, ruff config, generation service extraction, remove Makefile

- Add backend/STYLE_GUIDE.md covering formatting, imports, types, docstrings,
  comments, error handling, async, logging, and naming conventions
- Add pyproject.toml with ruff linter/formatter config (ERA, FIX, isort, pyupgrade)
- Extract generation service (Phase 3): unified run_generation() replaces three
  duplicated closures, serial queue moved to services/task_queue.py
- Delete Makefile in favor of justfile; update all references
- Add Python lint/format/test commands to justfile (check-python, fix-python, test)
- Install ruff, pytest, pytest-asyncio as dev tools in setup-python
- Update REFACTOR_PLAN.md with Phase 3 and Phase 7 completion
This commit is contained in:
James Pine
2026-03-16 01:35:59 -07:00
parent 439fedcbf2
commit fe19a9ca47
13 changed files with 972 additions and 812 deletions
+39 -10
View File
@@ -52,7 +52,7 @@ setup-python:
{{ pip }} install -r {{ backend_dir }}/requirements-mlx.txt
fi
{{ pip }} install git+https://github.com/QwenLM/Qwen3-TTS.git
{{ pip }} install pyinstaller -q
{{ pip }} install pyinstaller ruff pytest pytest-asyncio -q
echo "Python environment ready."
[windows]
@@ -75,7 +75,7 @@ setup-python:
& "{{ pip }}" install -r {{ backend_dir }}/requirements.txt
& "{{ pip }}" install --no-deps chatterbox-tts
& "{{ pip }}" install git+https://github.com/QwenLM/Qwen3-TTS.git
& "{{ pip }}" install pyinstaller -q
& "{{ pip }}" install pyinstaller ruff pytest pytest-asyncio -q
Write-Host "Python environment ready."
# Install JavaScript dependencies
@@ -234,21 +234,50 @@ build-web:
# ─── Code Quality ────────────────────────────────────────────────────
# Run all checks (lint + format + typecheck)
check:
# Run all checks (JS + Python lint + format)
check: check-js check-python
# JS/TS: lint + format + typecheck (Biome)
check-js:
bun run check
# Lint with Biome
lint:
# Python: lint + format check (ruff)
check-python: _ensure-venv
{{ venv_bin }}/ruff check {{ backend_dir }}
{{ venv_bin }}/ruff format --check {{ backend_dir }}
# Lint with Biome (JS) + ruff (Python)
lint: _ensure-venv
bun run lint
{{ venv_bin }}/ruff check {{ backend_dir }}
# Format with Biome
format:
# Format with Biome (JS) + ruff (Python)
format: _ensure-venv
bun run format
{{ venv_bin }}/ruff format {{ backend_dir }}
# Fix lint + format issues
fix:
# Fix lint + format issues (JS + Python)
fix: _ensure-venv
bun run check:fix
{{ venv_bin }}/ruff check {{ backend_dir }} --fix
{{ venv_bin }}/ruff format {{ backend_dir }}
# Python lint only
lint-python: _ensure-venv
{{ venv_bin }}/ruff check {{ backend_dir }}
# Python format only
format-python: _ensure-venv
{{ venv_bin }}/ruff format {{ backend_dir }}
# Python auto-fix lint issues
fix-python: _ensure-venv
{{ venv_bin }}/ruff check {{ backend_dir }} --fix
{{ venv_bin }}/ruff format {{ backend_dir }}
# Run Python tests
test: _ensure-venv
{{ venv_bin }}/python -m pytest {{ backend_dir }}/tests -v
# ─── Database ─────────────────────────────────────────────────────────