Skip to content

Whitelisting skipped modules #2541

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

Closed
JukkaL opened this issue Dec 9, 2016 · 1 comment
Closed

Whitelisting skipped modules #2541

JukkaL opened this issue Dec 9, 2016 · 1 comment

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Dec 9, 2016

Currently when using --silent-imports (or the new alternative that is being worked on in #2513) mypy won't catch misspelled module names, and will silently accept them. Instead of skipping all modules that we can't find, another alternative would be to allow users to explicitly specify which modules don't exist or are missing a stub, and only skip imports of/from these modules.

A few ways this could be supported:

  1. Add a command line and config file option to enumerate skipped modules.
  2. Support partially-defined stubs through def __getattr__(name) -> Any: ... (defined in PEP 484). If this is defined for a stub, we should perhaps also allow arbitrary submodules to be imported. We could define local minimal stubs with only this __getattr__ definition for things for which there's no real stub.

I prefer option 2 since we already have a pretty large number of command-line options and this behavior is defined by PEP 484 (except for the behavior of submodules).

This is based on an issue reported by a user.

@msullivan
Copy link
Collaborator

This can be accomplished with per-module values for ignore_missing_imports/follow_imports

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