Skip to content

chore: limit pre-push mypy to .py/.pyi files - #120760

Open
armenzg wants to merge 1 commit into
masterfrom
chore/mypy-pre-push-py-only
Open

chore: limit pre-push mypy to .py/.pyi files#120760
armenzg wants to merge 1 commit into
masterfrom
chore/mypy-pre-push-py-only

Conversation

@armenzg

@armenzg armenzg commented Jul 28, 2026

Copy link
Copy Markdown
Member

This happened to me because the pre-commit push hook gets triggered for bin/ scripts while the CI does not get triggered by this, thus, when someone touches bin/ files and I merge master I get all their untyped changes.

Summary

  • Add files: \.pyi?$ to the pre-push mypy hook so only extension-bearing Python files are typechecked.
  • Aligns pre-push file selection with CI’s .py/.pyi discovery and avoids __main__ collisions from extensionless bin/ scripts.

Test plan

  • SENTRY_MYPY_PRE_PUSH=1 .venv/bin/prek run mypy --files bin/mock-event --stage pre-push skips the extensionless script
  • SENTRY_MYPY_PRE_PUSH=1 .venv/bin/prek run mypy --files <some>.py --stage pre-push still runs mypy
  • Pushing a branch that touches extensionless bin/ scripts no longer fails mypy solely due to those paths

Made with Cursor

Align file selection with CI discovery so extensionless bin/ scripts are not passed to mypy.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 28, 2026
@armenzg armenzg self-assigned this Jul 28, 2026
@armenzg
armenzg marked this pull request as ready for review July 28, 2026 17:54
@armenzg
armenzg requested review from a team as code owners July 28, 2026 17:54

@joshuarli joshuarli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we just be ignoring bin/ instead?

@armenzg

armenzg commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

shouldn't we just be ignoring bin/ instead?

That would also work. What would you prefer?

@joshuarli

Copy link
Copy Markdown
Member

shouldn't we just be ignoring bin/ instead?

That would also work. What would you prefer?

ignoring bin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants