Skip to content

types-setuptools 80.9.0.20251223 triggers spurious type error on package_data in setup.py #15220

@DrPyser

Description

@DrPyser

Given python 3.11

❯ python --version
Python 3.11.14

Given mypy 0.991.

❯ mypy --version
mypy 0.991 (compiled: yes)

Given types-setuptools in latest version 80.9.0.20251223.

❯ pip show types-setuptools
Name: types-setuptools
Version: 80.9.0.20251223

Given a setup.py specifying package_data with a dictionary value: https://github.com/wazo-platform/wazo-calld/blob/b21ab4d2ad61b8eab6f64efcf373071259cc27fc/setup.py#L15-L17 .

setup(
    ...
    package_data={
         'wazo_calld.plugins': ['*/api.yml'],
    },

mypy finds an error:

$ mypy --exclude='build' --exclude='integration_tests' .
setup.py:15: error: Argument "package_data" to "setup" has incompatible type "Dict[str, List[str]]"; expected "_DictLike[str, List[str]]"  [arg-type]
setup.py:15: note: Following member(s) of "Dict[str, List[str]]" have conflicts:
setup.py:15: note:     Expected:
setup.py:15: note:         def get(self, str, Optional[Any] = ..., /) -> Optional[List[str]]
setup.py:15: note:     Got:
setup.py:15: note:         @overload
setup.py:15: note:         def get(self, str, /) -> Optional[List[str]]
setup.py:15: note:         @overload
setup.py:15: note:         def [_T] get(self, str, Union[List[str], _T], /) -> Union[List[str], _T]
Found 1 error in 1 file (checked 206 source files)

This can be reproduced in a fresh virtual environment, see attached archive for minimal reproduction scenario.

reproduction.tar.gz

Probably related to changes in #15146 and #15161 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions