Skip to content

Cannot compile Mypy with Mypyc #18107

@agriyakhetarpal

Description

@agriyakhetarpal

Bug Report

Hi there, I'm unable to compile Mypy with Mypyc (i.e., with MYPY_USE_MYPYC enabled) using the standard pip install -e . invocation – I first noticed this in pyodide/pyodide#5124 where it's breaking our CI, but it happens locally on conventional targets on a macOS device, and in CI as well: https://github.com/agriyakhetarpal/mypy/actions/runs/11692836659/job/32563074252

To Reproduce

In a terminal, run the following command:

MYPY_USE_MYPYC=1 pip install -e .

Expected Behavior

The expected behaviour is that Mypy compiles with Mypyc.

Actual Behavior

I think it's a setuptools problem – here's an excerpt from the logs:

mypyc/build.py:280: error: Argument "sources" to "Extension" has incompatible type "list[str]"; expected "list[str | PathLike[str]]"  [arg-type]
mypyc/build.py:280: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
mypyc/build.py:280: note: Consider using "Sequence" instead, which is covariant
mypyc/build.py:316: error: Argument "sources" to "Extension" has incompatible type "list[str]"; expected "list[str | PathLike[str]]"  [arg-type]
mypyc/build.py:316: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
mypyc/build.py:316: note: Consider using "Sequence" instead, which is covariant

I haven't had a chance to bisect so far. I don't see a difference between the dependencies downloaded yesterday versus those downloaded today, either.

Your Environment

  • Mypy version used: master branch/development version (and the latest release version)
  • Mypy command-line flags: MYPY_USE_MYPYC set to 1
  • Python version used: 3.12.6

Additional context

xref: pyodide/pyodide#5160

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions