-
Notifications
You must be signed in to change notification settings - Fork 432
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
Incompatible method overrides #1149
Comments
Hello @stephenfin, thanks for the report! Our plan for addressing this is to stop using and deprecate e.g. "ListableAPIResource" in a future major version, although a potential alternative could be to parameterize ListableAPIResource with a generic, e.g. Has this caused problems for you as a user of the library? Please detail if so, this would be pretty troubling. Enabling more type checking rules and getting stricter types internally is something we are going to work towards long term, but my hope/assumption has been that this wouldn't really have any affect on the external user experience or the types that users see when type-checking their own projects. |
Hi @richardm-stripe. No, no apparent issues with regards to end-use. I spotted this through code inspection while trying to figure out how the new typing all tied together, and I mainly dropped the ticket as an FYI to you folks. Thanks for the thorough response! |
While we're getting typing issues resolved you can suppress errors by adding [[tool.mypy.overrides]]
module = "stripe.*"
follow_imports = "silent" to your pyproject.toml |
Looked with @pakrym-stripe and it turns out that ^ should not be necessary as mypy has a setting |
Describe the bug
The type hints introduced in 7.3.0 appear to be incomplete and enabling the
reportIncompatibleMethodOverride = true
setting in pyright highlights this (mypy detects this out-of-the-box). For example:The root cause of many of these seems to be that the use of typed dict to define parameters for e.g. delete methods makes child methods more restrictive than the parent method (which is an untyped dict), thus violating the Liskov substitution principle. There are other small examples here though.
To Reproduce
Enable
reportIncompatibleMethodOverride = true
in pyright configuration inpyproject.toml
.Expected behavior
No errors when the
reportIncompatibleMethodOverride = true
option is enabled in pyright.Code snippets
No response
OS
Linux
Language version
Python 3.11
Library version
master
API version
n/a
Additional context
No response
The text was updated successfully, but these errors were encountered: