Skip to content

Disabling mypy for certain modules? #545

Closed
@gvanrossum

Description

@gvanrossum

I thought it used to be the case that mypy only checked modules that explicitly import [from] typing. That gave a nice "out" for existing code that uses annotations with different conventions. But checking with the most recent version I found that it no longer does this -- all imported modules get checked, and all annotations it doesn't understand get flagged. I worry that this will upset people who have put efforts into their own system using annotation, and I think it's at least reasonable to be able to flag such code as "don't look here".

You can probably do this using a stub module, but perhaps it should be possible to just write something like

import foo  # type: Any

Or some other syntax at the importing site?

We can also think about disabling mypy checking for a smaller scope, e.g. a class or function -- maybe a class annotation @dont_type_check?

(Hm... Did I already bring this up earlier? If so please just close as duplicate.)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions