Skip to content

TYP: Run pyright_cov in CI, enforce minimum type completeness of 80% #29065

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli commented May 27, 2025

As discussed on Slack: https://numpy-team.slack.com/archives/C01BZCJ6NJ0/p1748280881632649

The idea is to prevent Pyright's type compeleteness from suddenly regressing - if it did, it would indicate an incorrect type (as was fixed in #28908)

Copy link
Member

@jorenham jorenham left a comment

Choose a reason for hiding this comment

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

Maybe we already use basedpyright for this? It has some additional inference and narrowing features that might be helpful here, e.g.
https://docs.basedpyright.com/latest/benefits-over-pyright/improved-generic-narrowing/. And if I understand correctly, then its baseline feature could be used as an alternative to --exclude-like.

It might be possible to replace this with `basedpyright`
https://github.com/DetachHead/basedpyright/issues/125 in the future.
"""
from __future__ import annotations
Copy link
Member

Choose a reason for hiding this comment

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

is this needed?

@jorenham
Copy link
Member

jorenham commented May 27, 2025

Maybe it would be nice if we could have the CI complain if the % drops as a consequence of the changes? Although I'm not sure what the best way to implement something like that 🤔.

@@ -72,3 +72,8 @@ jobs:
- name: Run Mypy
run: |
spin mypy
- name: Check Pyright's type compelteness is above 80%
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- name: Check Pyright's type compelteness is above 80%
- name: Check Pyright's type completeness is above 80%

@MarcoGorelli
Copy link
Member Author

Maybe we already use basedpyright for this? It has some additional inference and narrowing features that might be helpful here, e.g. https://docs.basedpyright.com/latest/benefits-over-pyright/improved-generic-narrowing/. And if I understand correctly, then its baseline feature could be used as an alternative to --exclude-like.

sure but wouldn't we need DetachHead/basedpyright#125 to be closed first?

@jorenham
Copy link
Member

jorenham commented May 27, 2025

Maybe we already use basedpyright for this? It has some additional inference and narrowing features that might be helpful here, e.g. docs.basedpyright.com/latest/benefits-over-pyright/improved-generic-narrowing. And if I understand correctly, then its baseline feature could be used as an alternative to --exclude-like.

sure but wouldn't we need DetachHead/basedpyright#125 to be closed first?

No, --verifytypes already works. The idea behind DetachHead/basedpyright#125 is to make it possible for --verifytypes to be enabled as a diagnostic rule, so we can use e.g. # pyright: ignore[reportVerifyTypes] or pyright: reportVerifyTypes=false to ignore what we need to ignore. That way, we could configure it to only enable the reportVerifyTypes rule, and we just basedpyright numpy (without --verifytypes), which will then fail if any new errors pop up. We could use the baseline feature to generate all of the initial ignore's, so no need for manual labor.

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

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy