Skip to content

Add pyright type-checking #1172

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 5 commits into
base: main
Choose a base branch
from
Open

Add pyright type-checking #1172

wants to merge 5 commits into from

Conversation

tjkuson
Copy link
Contributor

@tjkuson tjkuson commented Jul 24, 2025

Hello, I was working with this plugin and encountered this issue.

I added pyright as a tox test matching the mypy hook.

This reveals one error involving function.parent possibly being None. I resolved this by adding an assertion, as that appears to be most consistent with the rest of the codebase.

Closes #731

@tjkuson tjkuson marked this pull request as draft July 24, 2025 17:19
@tjkuson
Copy link
Contributor Author

tjkuson commented Jul 24, 2025

I'll close this for now, there's an issue with pyright and pre-commit CI: RobertCraigie/pyright-python#345

@tjkuson tjkuson closed this Jul 24, 2025
@seifertm
Copy link
Contributor

seifertm commented Jul 28, 2025

Rather than running pyright in pre-commit, we can consider running it in a dedicated tox environment. This would give us the benefit of having a pyright check for the code base, while 90% of typing issues should still be caught by the mypy pre-commit hook.

@tjkuson Do you think this approach would side-step the issue?

@tjkuson tjkuson reopened this Jul 30, 2025
@tjkuson tjkuson changed the title Add pyright hook Add pyright type-checking Jul 30, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jul 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.88%. Comparing base (07cb01f) to head (5ad6dab).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1172      +/-   ##
==========================================
+ Coverage   88.16%   88.88%   +0.72%     
==========================================
  Files           2        2              
  Lines         397      405       +8     
  Branches       44       44              
==========================================
+ Hits          350      360      +10     
  Misses         35       35              
+ Partials       12       10       -2     

☔ 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.

@tjkuson
Copy link
Contributor Author

tjkuson commented Jul 30, 2025

@seifertm I've moved the pyright check from pre-commit to tox and re-opened the PR.

@tjkuson tjkuson marked this pull request as ready for review July 30, 2025 00:56
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.

Decorator type signatures not recognized by pyright
3 participants