[Python] VSCode Ignores Mypy Type Hints When Using Django Plugins

Discussão em 'Python' iniciado por Stack, Fevereiro 17, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using VSCode with the mypy plugin in my Django project. My pyproject.toml configuration looks like this (following the Django Stubs README):

    [tool.mypy]
    mypy_path = "."
    python_version = "3.13"
    strict = true
    plugins = ["mypy_django_plugin.main"]

    [tool.django-stubs]
    django_settings_module = "conf.settings"


    When I run mypy in the terminal, everything works fine, and I get proper type checking.

    However, in VSCode, I don't get any type hints at all. If I comment out the plugins line, mypy starts working in VSCode again.

    What I've Tried:

    1. Running mypy manually in the terminal → Works as expected
    2. Commenting out plugins → VSCode starts showing hints again
    3. Checking that VSCode uses the correct mypy config (it's picking up pyproject.toml)

    Any insights would be greatly appreciated!

    Continue reading...

Compartilhe esta Página