Skip to content

Alternative Python Type-checkers #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yangm2
Copy link
Contributor

@yangm2 yangm2 commented Jun 24, 2025

  • add alternative typecheckers to Makefile & README.md
  • add type-simplejson
  • some annotations and ignores in session.py

This does not enable the other type-checkers in PR Checks. The 3 type-checkers flag different issues. mypy is the grand-daddy of Python type-checking and is probably the most complete. pyrefly is a new implementation, similar in vintage to ty but they each flag (or not) different issues.

This may be useful for folks who are adding type annotations (e.g. #121)

@yangm2 yangm2 self-assigned this Jun 24, 2025
@yangm2 yangm2 added enhancement New feature or request backend Bot implementation and other backend concerns labels Jun 24, 2025
@yangm2 yangm2 marked this pull request as ready for review June 24, 2025 03:45
@yangm2 yangm2 requested a review from apkostka June 24, 2025 03:45
@yangm2 yangm2 linked an issue Jun 24, 2025 that may be closed by this pull request
Copy link
Member

@KentShikama KentShikama left a comment

Choose a reason for hiding this comment

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

Imo lets just stick with one and enforce that.

@leekahung
Copy link
Contributor

Is there one type-checker be configured to cover all three?

If not all three, we could select either the strictest one or the one most relevant to other PRs?

@yangm2
Copy link
Contributor Author

yangm2 commented Jun 25, 2025

We could stick with mypy since that is the most mature type-checker, but it is flagging a bunch of errors that need to be fixed in the current code (but probably a bunch more on branches/PRs). Introducing this without enforcement lets folks writing new code/refactoring opt-in gradually.

Copy link
Member

@KentShikama KentShikama left a comment

Choose a reason for hiding this comment

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

My 2 cents would be to just introduce mypy without enforcement then

@yangm2 yangm2 force-pushed the add-types-simplejson branch from 2c5998c to 203f6b0 Compare June 25, 2025 18:27
Copy link
Contributor

@apkostka apkostka left a comment

Choose a reason for hiding this comment

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

Happy to approve this, I'll fix any type issues in a new PR, then we could add it as a PR action. I might also add ruff check as a precommit action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Bot implementation and other backend concerns enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve the PR and deploy actions with more testing
4 participants