Skip to content
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

Support disallow_untyped_decorators = false option for 3rd party libraries #9442

Open
mvoitko opened this issue Sep 15, 2020 · 3 comments
Open

Comments

@mvoitko
Copy link

mvoitko commented Sep 15, 2020

Feature

Support disallow_untyped_decorators option for 3rd party libraries
Example:

[mypy-pytest-asyncio]
disallow_untyped_decorators = false

Pitch

Example
pytest decorators are widely used in the testing of Python code. pytest is still untyped for now.
It would be nice to have the possibility to check the typing of own decorators but ignore untyped decorators of some 3rd party libraries.

@gvanrossum
Copy link
Member

You can already specify this flag on a per-module or per-package basis. How is your proposal different?

@mvoitko
Copy link
Author

mvoitko commented Sep 16, 2020

@gvanrossum There is an example described here, where it suppresses any error messages generated when the codebase tries importing the module.
I would like to use the same approach to suppress error messages, not about all decorators in my module or my package, but to suppress the error messages for all decorators from 3rd party library, but still detect my own untyped decorators.

@gvanrossum
Copy link
Member

Oh, so you want something like this:

from some_third_party_package import decorator_one  # Untyped
from my_own_library import decorator_two  # Also untyped

# No error here
@decorator_one
def foo() -> None: ...

# But report an error here
@decorator_two
def bar() -> None: ...

That's not going to be an easy feature to add; I don't even know where to begin.

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

No branches or pull requests

2 participants