Skip to content

Feat: Implement Developer Experience (DX) and Automated Quality Checks

Kushal Lagichetty requested to merge feat/dx into develop

Summary

This MR introduces a comprehensive Developer Experience (DX) suite to the project. The goal is to automate code quality, formatting, type checking, and testing to ensure the codebase remains maintainable and consistent.

All tools are integrated directly into the project's standard lifecycle — no new specialized commands are required for developers to get started.


Key Changes

1. Unified Tooling Configuration (pyproject.toml)

  • Integrated Ruff, Mypy, Pytest, and pre-commit directly into the main project dependencies.
  • Configured Ruff for linting, formatting, and dead-code detection (120-character line limit).
  • Configured Mypy for static type analysis.
  • Configured Pytest-cov for automated test coverage reporting.

2. Streamlined 3-Stage CI/CD Pipeline (.gitlab-ci.yml)

Stage Tools Purpose
lint Ruff + Mypy Linting, formatting, dead-code detection, and type checking
test Pytest + Coverage Test suite execution and coverage reporting
build Docker Final image construction
  • Optimized for speed using uv and GitLab caching.
  • Configured regex to display coverage percentage directly in the MR widget.

3. Comprehensive Git Hooks (.pre-commit-config.yaml)

  • Pre-commit: Automatically runs Ruff, Mypy, and Prettier (for Markdown/YAML/JSON) before changes are recorded.
  • Commit-msg: Enforces Semantic Commits (Conventional Commits) to keep project history clean.
  • Pre-push: Runs the full test suite locally as a final safety net.

4. Code Quality Fixes

  • Added missing import os in main.py (fixed potential crash).
  • Modernized FastAPI patterns using the Annotated syntax.
  • Resolved various linting issues and removed dead code (unused imports and variables).

How to Use

DX tools are installed automatically alongside the project:

# Standard install — no extra steps required
pip install -e .
# OR
uv pip install -e .

Git hooks are initialized automatically. Note that the pre-push hook requires your virtual environment to be active or accessible at .venv/.


Checklist

  • All checks (linting, type-checking, testing) pass locally.
  • Pre-commit, commit-msg, and pre-push hooks are functional.
  • GitLab CI configuration follows the requested 3-stage structure.
  • Test coverage tracking integrated for MR visualization.

Closes #2 (closed)

Edited by Kushal Lagichetty

Merge request reports

Loading