Skip to content

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

Closed as not planned

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 .

Activity

  1. changed the title [-]types-setuptools 80.9.0.20251223 triggers spurious type error on package_data[/-] [+]types-setuptools 80.9.0.20251223 triggers spurious type error on package_data in setup.py[/+] on Jan 5, 2026
  2. srittau commented on Jan 6, 2026

    @srittau
    Collaborator

    mypy 0.991 is ancient (over three years old). We only guarantee type packages to work with the latest type checker versions at the time a package is released. (The actual versions are part of the type package's description, in the case of types-setuptools 80.9.0.20251223 that's mypy 1.18.2.) I just checked your example with mypy 1.19.1, and there are no type errors.

    In this particular case, I expect the problem is a conflict between the setuptools types and the stdlib that was shipped with mypy 0.991.

  3. DrPyser commented on Jan 7, 2026

    @DrPyser
    Author

    mypy 0.991 is ancient (over three years old). We only guarantee type packages to work with the latest type checker versions at the time a package is released. (The actual versions are part of the type package's description, in the case of types-setuptools 80.9.0.20251223 that's mypy 1.18.2.) I just checked your example with mypy 1.19.1, and there are no type errors.

    In this particular case, I expect the problem is a conflict between the setuptools types and the stdlib that was shipped with mypy 0.991.

    Thanks for the feedback.
    Makes sense, updating the mypy version does solve the issue (while bringing a few new actual errors).
    We'll be updating our mypy linters to a more recent version.

    Sorry we didn't check the compatibility requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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