Objective: Refactor the single tests.yml workflow into multiple dedicated-purpose workflows following Python development best practices.
Current State Analysis:
- Existing
tests.ymlworkflow has mixed responsibilities (testing, linting, type checking) - Linting/type checking currently uses
continue-on-error: truewhich allows broken code to pass - Need separation of concerns and proper failure handling
Proposed Workflow Structure:
-
tests.yml- Dedicated Python Testing- Purpose: Run pytest with coverage across Python versions
- Name: "Tests"
- Triggers: push to main/develop, PRs to main
- Matrix: Python 3.11, 3.12, 3.13
- Steps: checkout → setup Python → install deps → run pytest with coverage → upload coverage (Python 3.12 only)
- Behavior: Fail fast if tests fail
-
ci.yml- Dedicated Code Quality & Type Checking- Purpose: Auto-fix then validate code quality
- Name: "Code Quality"
- Triggers: push to main/develop, PRs to main
- Matrix: Single Python version (3.12)
- Steps:
- Auto-fixers: black (format), isort (import sort) - commit changes if any
- Validators: flake8 (style), mypy (types) - fail workflow if issues found
- Behavior: Must pass completely or workflow fails (remove
continue-on-error)
Key Improvements:
- Separation of concerns: Testing vs Code Quality
- Fail fast: Code quality failures block commits
- Auto-fixing: Black/isort auto-format before validation
- Simplified: Each workflow has single, clear purpose
- Best practices: Follow GitHub Actions naming conventions
Implementation Plan:
- ✅ Set up local pre-commit environment for testing
- ✅ Update PLANNING.md with detailed plan
- ✅ Get user acceptance and commit to new branch
- ✅ Delete existing
tests.yml - ✅ Create new
tests.ymlworkflow - ✅ Create new
ci.ymlworkflow - ✅ Test workflows locally and via GitHub Actions
- Target: A modern, robust Python project template.
- Purpose: To provide a high-quality starting point for new Python applications, with best practices for tooling, testing, and automation built-in.
- Tools: Pytest, GitHub Actions, pre-commit, black, isort, flake8, mypy.
pyproject.toml- The central configuration file for project metadata and tools.src/hello_world/- The main application package.tests/- The test suite for the application..github/workflows/- The CI/CD pipeline definition.README.md,CHANGELOG.md,PLANNING.md- Project documentation.
- Analyze Ruff Integration: Investigate using Astral's Ruff to potentially replace black, isort, and flake8. The goal is to simplify the