-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Split out protocol required members from reportGeneralTypeIssues #6072
Comments
Could someone from the pylance team please transfer this to the pyright project since it's a core type checking feature request? Thanks! |
I agree that the Protocols are a relatively advanced type checking feature, so I'm surprised that you want to make use of protocols and enforce them but then ignore more fundamental type violations. |
I mostly write Rust but also have a Django project. Makes it really hard to use Also looked at this but it's a runtime error: https://stackoverflow.com/a/54814371/5679413 And honestly protocols seem much simpler than whatever this is: https://stackoverflow.com/a/75253599/5679413 |
As I mentioned, if you're going to use a type checker in Python, the most basic of errors are simple type violations that will be reported in the I'm going to close this issue because I don't think it makes sense to move protocol required members to a separate diagnostic rule. |
I understand it's your decision, but I literally just described my usecase. If I had the option I would absolutely set up a commit hook to check for protocol violations but ignore |
Abstract properties are very hard to accomplish in python. There are some methods based around abstract classes and descriptor chaining, but descriptor chaining is going away and generally only worked at instantiation/access time (no type errors). I haven't found anything clean that errors at declaration or import time.
Protocols are a decent way of catching unimplemented abstract properties early. python/cpython#89519 (comment)
"Class derives from one or more protocol classes but does not implement all required members" is currently a
reportGeneralTypeIssues
error, which are a bit of a catchall and very tempting to disable. Unimplemented required protocol members are almost always going to be addressed, though.If we could split it out to it's own error it would be great for checking implementations and configs and stuff before runtime.
The text was updated successfully, but these errors were encountered: