python / python/mypy

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

Offen
#10,377 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug topic-configuration
Vorherrschende Sprache
Python
Sterne
20.6k
Forks
3.3k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere den Bericht mit mypy 0.812 unter Verwendung von mypy src und den in setup.cfg oder mypy.ini gezeigten exclude-Einstellungen, mit Fokus auf src/tinuous/_version.py. Verfolge, wie --exclude und importierte Module behandelt werden, und überprüfe anschließend, dass passende Module ohne Fehler übersprungen werden, während andere Module in src weiterhin geprüft werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.