Skip to content

Conversation

@dhalperi
Copy link
Member

This PR enables mypy type checking in the pre-commit hooks configuration.

Changes

  • Add mypy hook using the mirrors version for CI compatibility
  • Include all necessary dependencies for proper type checking
  • Configure mypy to run on src/ directory only
  • Use pass_filenames: false to avoid module resolution issues

Benefits

  • Type safety: Catch type-related bugs before they reach the main branch
  • CI integration: Works seamlessly in GitHub Actions and other CI environments
  • Developer experience: Automatic type checking on every commit
  • Code quality: Maintains strict typing standards established in pyproject.toml

Technical Details

  • Uses repo: https://github.com/pre-commit/mirrors-mypy for CI compatibility
  • Includes comprehensive additional_dependencies list for all project imports
  • Configured with args: [src/] and pass_filenames: false to handle package structure correctly
  • Runs mypy v1.18.1 with strict type checking settings from pyproject.toml

Testing

  • ✅ All 138 source files in src/ pass mypy type checking
  • ✅ All pre-commit hooks work together successfully
  • ✅ Configuration tested locally and ready for CI

The test files in tests/ have 126+ type issues that would require significant refactoring, so they are excluded for now but could be addressed in a future PR.

- Add mypy hook with mirrors version for CI compatibility
- Include all necessary dependencies for type checking
- Run on src/ directory only (tests have 126+ type issues)
- Use pass_filenames: false to avoid module resolution issues
Only run mypy when Python files in src/ are actually changed,
avoiding unnecessary type checking on README/config changes.
@dhalperi dhalperi enabled auto-merge (squash) September 18, 2025 07:05
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.57%. Comparing base (65c3867) to head (22ac2ac).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #89   +/-   ##
=======================================
  Coverage   83.57%   83.57%           
=======================================
  Files          86       86           
  Lines        3902     3902           
=======================================
  Hits         3261     3261           
  Misses        641      641           
Flag Coverage Δ
unittests 83.57% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dhalperi dhalperi merged commit 2b582be into main Sep 18, 2025
101 checks passed
@dhalperi dhalperi deleted the update-precommit-hooks branch September 18, 2025 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants