feat(ci): integrate mypy type checker for Python codebase (closes #157) #268

Open
Rockachopa wants to merge 1 commits from step35/157-9-3-type-checker into main
Owner

9.3 — Type Checker Integration

This PR adds static type checking to the Compounding Intelligence Python codebase using mypy.

Problem

The codebase uses type hints extensively (e.g., -> None, Dict[str, List[Any]]) but had no automated type checking in CI. Type errors in annotated code could slip through uncaught.

Solution — Smallest Concrete Fix

  1. Add mypy to requirements.txt (mypy>=1.0)
  2. Create mypy.ini with lenient-but-useful defaults:
    • Python 3.11 target
    • ignore_missing_imports = True (no stubs everywhere)
    • warn_unused_ignores, warn_redundant_casts, warn_return_any
    • Per-module exceptions for test files
  3. Add make typecheck target → mypy scripts/ tests/ --config-file=mypy.ini --show-error-codes
  4. Update CI (.gitea/workflows/test.yml) to run make typecheck before make test

Acceptance Criteria

  • Detects type checker per project: Python → mypy
  • Runs checker: make typecheck (also via CI)
  • Reports: type errors (mypy console output)
  • Output: type error report (mypy --show-error-codes provides structured output)

Impact

  • Type errors in annotated code now fail CI
  • No breaking changes — configuration is intentionally lenient to avoid blocking development
  • Future tightening (disallow_untyped_defs = True) can be done incrementally

Files Changed

requirements.txt    |  1 +
mypy.ini            | 20 +++
Makefile            |  4 ++
.gitea/workflows/test.yml | 5 ++
4 files changed, 28 insertions(+), 1 deletion(-)

Closes #157

## 9.3 — Type Checker Integration This PR adds static type checking to the Compounding Intelligence Python codebase using **mypy**. ### Problem The codebase uses type hints extensively (e.g., `-> None`, `Dict[str, List[Any]]`) but had no automated type checking in CI. Type errors in annotated code could slip through uncaught. ### Solution — Smallest Concrete Fix 1. **Add mypy** to `requirements.txt` (`mypy>=1.0`) 2. **Create `mypy.ini`** with lenient-but-useful defaults: - Python 3.11 target - `ignore_missing_imports = True` (no stubs everywhere) - `warn_unused_ignores`, `warn_redundant_casts`, `warn_return_any` - Per-module exceptions for test files 3. **Add `make typecheck`** target → `mypy scripts/ tests/ --config-file=mypy.ini --show-error-codes` 4. **Update CI** (`.gitea/workflows/test.yml`) to run `make typecheck` before `make test` ### Acceptance Criteria - ✅ Detects type checker per project: Python → mypy - ✅ Runs checker: `make typecheck` (also via CI) - ✅ Reports: type errors (mypy console output) - ✅ Output: type error report (mypy --show-error-codes provides structured output) ### Impact - Type errors in annotated code now fail CI - No breaking changes — configuration is intentionally lenient to avoid blocking development - Future tightening (`disallow_untyped_defs = True`) can be done incrementally ### Files Changed ``` requirements.txt | 1 + mypy.ini | 20 +++ Makefile | 4 ++ .gitea/workflows/test.yml | 5 ++ 4 files changed, 28 insertions(+), 1 deletion(-) ``` Closes #157
Rockachopa added 1 commit 2026-04-26 15:03:42 +00:00
feat(ci): integrate mypy type checker (issue #157)
Some checks failed
Test / pytest (pull_request) Failing after 21s
501ca838c7
- Add mypy>=1.0 to requirements.txt
- Create mypy.ini config (Python 3.11, ignore missing imports, warn_unused_ignores)
- Add `make typecheck` target (runs mypy on scripts/ and tests/)
- Update CI workflow to run typecheck before pytest
- Type checker detected per project (Python → mypy)
- Reports type errors via mypy output

Closes #157
Owner

🛡️ Goblin Patrol Alert 🛡️

Hey brother — this PR has been idle for 6 days and is unassigned.

The goblin fleet has been notified. A goblin may claim this if it remains stale.

— Timmy Goblin Wizard King

🛡️ **Goblin Patrol Alert** 🛡️ Hey brother — this PR has been idle for **6 days** and is unassigned. The goblin fleet has been notified. A goblin may claim this if it remains stale. — Timmy Goblin Wizard King
Some checks failed
Test / pytest (pull_request) Failing after 21s
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin step35/157-9-3-type-checker:step35/157-9-3-type-checker
git checkout step35/157-9-3-type-checker
Sign in to join this conversation.