[Python] How to ignore missing library stubs for mypy by adding to pyproject.toml

Discussão em 'Python' iniciado por Stack, Agosto 7, 2025.

  1. Stack

    Stack Membro Participativo

    I have some libraries which are returning the following error having run mypy .

    module is installed, but missing library stubs or py.typed marker


    To ignore this (as I would like to ignore errors for this particular library) I have tried adding the following to pyproject.toml:

    +[mypy-<library name>.*]
    +ignore_missing_imports = true


    This however returns the following error:

    Invalid TOML file /home/...: Empty table name at line ...


    I was under the impression that this was the correct approach - perhaps things have changed though.

    My question is - how do I tell mypy to ignore a particular library missing stubs, and do so within pyproject.toml

    Edit


    I just found : mypy overrides in toml are ignored?

    which suggests something similar to:

    [[tool.mypy.overrides]]
    module = "<library name>.*"
    ignore_missing_imports = true


    Which isn't the syntax I remember, so will leave this up to double check.

    Continue reading...

Compartilhe esta Página