Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow stub files to be --excluded #10842

Description

@jdferreira

Feature

Disclaimer: I'm not sure this is a feature request or a bug report.

Allow the user to tell mypy where stubs are located but hide the errors found in there.

Pitch

I've generated thousands of stub files (with stubgen) to easily (if crudely) be able to type-check my code. But those files are not fully compliant with mypy's type checks (things like using modules without type checks, redefining variables with values of different types, functions seemingly missing from the scope, etc.). I believe the modules are correct (to the point of usability, at least), and I'm not interested in tuning those files anyway. When more manual .pyi files are created by those package owners, I'll use them instead, but for now I'm happy with the automatically generated stub.

Given that, I get hundreds of errors in my output that are useless to me, and make it harder to spot my own type errors.

However, if I run mypy --mypy-path .mypy_stubs --exclude .mypy_stubs, these errors still appear in the output. I'd like them to be hidden.

My guess is that mypy needs to check the stub files to be able to check my actual source (so they cannot be actually excluded), but the errors could be hidden from the output. Is this something that is reasonable? I could (in theory) try to look at the code and see if I can help with that, but I don't have a lot of experience contributing to open-source code.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions