Django-stubs не игнорирует импорт

Я пытался настроить pre-commit + mypy + django-stubs, поэтому у меня возникает ошибка при попытке фиксации.

ModuleNotFoundError: Нет модуля с именем 'environ'

Мои конфигурации:

.pre-commit-config.yaml

  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: ''
    hooks:
      - id: mypy
        exclude: "[a-zA-Z]*/(migrations)/(.)*"
        args: [--config=setup.cfg,
               --no-strict-optional,
               --ignore-missing-imports]
        additional_dependencies: [django-stubs]

setup.cfg

[mypy]
allow_redefinition = True
check_untyped_defs = True
ignore_missing_imports = True
incremental = True
strict_optional = True
show_traceback = True
warn_no_return = False
warn_unused_ignores = True
warn_redundant_casts = True
warn_unused_configs = True
plugins = mypy_django_plugin.main
show_column_numbers = True

[mypy.plugins.django-stubs]
django_settings_module = config.settings.local

[mypy_django_plugin]
ignore_missing_model_attributes = True

[mypy-*.migrations.*]
# Django migrations should not produce any errors:
ignore_errors = True

Похоже, что mypy игнорирует опцию ignore_missing_imports = True. Есть ли у кого-нибудь идеи?

Полная трассировка ошибки:

Я должен написать здесь еще немного текста, потому что stackoverflow получает ошибку: много кода, добавьте детали.

Вернуться на верх