CynthiaWahome
## Summary The CI workflow in `.github/workflows/tests.yml` is misaligned with the current tooling configured in the template. This breaks all new project builds and causes false negatives in linting and formatting checks. ## Problem Statement **The project has been modernized** to use `uv` for dependency management and `ruff` for both linting & formatting (see `.pre-commit-config.yaml` and `pyproject.toml`). - Broken CI Workflow (`.github/workflows/tests.yml`): - Still uses Poetry instead of uv. - Attempts to run a black check that no longer exists. - Runs on Python 3.11, but the project requires >=3.12. - Redundant Config (`pyproject.toml`): - Contains a [tool.isort] section that conflicts with Ruff's built-in import sorting. - Outdated Migration Hooks (`alembic.ini`): - The post-write hook still calls black to format new database migrations, not ruff. **Result:** - Lint checks fail with errors about missing hooks and misconfigured tooling (not due to code issues, but workflow errors). - Projects generated from the template inherit a broken setup unless the workflow file is manually fixed after generation. ## Evidence - In `.pre-commit-config.yaml`, defined hooks are: `ruff-format`, `ruff`, `mypy` — all run using `uv`. - In `.github/workflows/tests.yml`, matrix still includes `black` and all commands run through `poetry`. Steps explicitly include installing Poetry and running `poetry run` commands. - Template's `pyproject.toml` shows no use of Poetry; dependency management is handled by UV features and requires Python `>=3.12`. - alembic.ini: Explicitly configured to run black after creating a migration. ## Suggested Resolution 1. **Update the workflow**: - Replace Poetry install/setup/commands with `uv` equivalents (`astral-sh/setup-uv` and `uv sync`). - Update the `python-version` for all jobs to `'3.12'`. - Remove all `black` references from the matrix; use `ruff-format`, `ruff`, and `mypy` steps only. - Delete the entire [tool.isort] section to remove the conflict with Ruff. - Update the `pre-commit` run commands to invoke the correct hooks, e.g., `uv run pre-commit run -a <hook>`. - Ensure the CI is consistent with the `.pre-commit-config.yaml` and actual project dependencies. 2. **(Optional) Expose as CLI Option:** Consider prompting users at project setup to choose between UV and other managers (for future flexibility), and select preferred formatter (Ruff vs Black), ensuring generated workflows match that choice. ## Impact - Currently, CI pipelines fail for all new projects, potentially misleading contributors and reducing trust in the template automation. - Maintaining outdated workflows increases onboarding friction and erodes DevOps best practices across downstream adopters. ## References - [pre-commit-config.yaml](https://github.com/s3rius/FastAPI-template/blob/main/fastapi_template/template/%7B%7Bcookiecutter.project_name%7D%7D/.pre-commit-config.yaml) - [tests.yml (broken workflow)](https://github.com/s3rius/FastAPI-template/blob/main/fastapi_template/template/%7B%7Bcookiecutter.project_name%7D%7D/.github/workflows/tests.yml) - [pyproject.toml](https://github.com/s3rius/FastAPI-template/blob/main/pyproject.toml) --- **Happy to submit a PR to address this and test proposed changes. Please assign this issue to me if accepted!** /cc @CynthiaWahome