Skip to content

exclude should imply a per-module follow import skip for matching modules #10377

Description

@jwodder

Bug Report

I recently converted this project (linked to at the most recent commit) from a plain script to a Python package. This included adding an un-annotated _version.py file generated by versioneer to the package. mypy (when run as mypy src) now reports errors due to _version.py lacking any type annotations, and I cannot get it to ignore that file.

What I've tried:

  • Adding exclude = _version.py to the [mypy] section in setup.cfg
  • Adding exclude = src/tinuous/_version.py to the [mypy] section
  • Adding exclude = src/tinuous/_(version|_init__).py to the [mypy] section
  • Running just mypy src/tinuous/__main__.py
  • Running mypy --exclude _version.py src

In all of these cases, mypy spits out errors relating to _version.py even though I thought I told it to ignore that file.

Your Environment

  • Mypy version used: 0.812
  • Mypy command-line flags: --exclude or nothing
  • Mypy configuration options from mypy.ini (and other config files):
[mypy]
ignore_missing_imports = True
disallow_untyped_defs = True
disallow_incomplete_defs = True
no_implicit_optional = True
warn_redundant_casts = True
warn_return_any = True
warn_unreachable = True
local_partial_types = True
no_implicit_reexport = True
strict_equality = True
show_error_codes = True
show_traceback = True
pretty = True
plugins = pydantic.mypy
# Various "exclude" options (see above)
  • Python version used: 3.9.4
  • Operating system and version: macOS 11.2.1

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

    bugmypy got something wrongtopic-configurationConfiguration files and flags

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions