Skip to content

dmypy run won't run, prints "Restarting: configuration changed" when ignore_missing_imports = True is configured #10709

Closed

Description

@tadeu

Bug Report

Since at least v0.902, executing dmypy run in a project that has ignore_missing_imports = True in mypy.ini is not working anymore.

To Reproduce

(Write your steps here:)

  1. Create src/something.py with some code in it, and create mypy.ini with:
[mypy]
files = src
ignore_missing_imports = True
  1. Run dmypy run

Expected Behavior

dmypy run should execute correctly, outputting something like:

Daemon started
src\something.py:1: error: Incompatible types in assignment (expression has type "str", variable has type "int")
Found 1 error in 1 file (checked 26 source files)

Actual Behavior

dmypy run keeps showing:

Restarting: configuration changed
Daemon stopped
Daemon started
Response: {'restart': 'configuration changed', 'platform': 'win32', 'python_version': '3_9', 'roundtrip_time': 0.5543885231018066}

even when trying to run it again.

Your Environment

  • Mypy version used: v0.902, v0.910 and 0.920+dev.379622de482ec16dd1676ad6d183dcfca5203194
  • Mypy command-line flags: dmypy run
  • Mypy configuration options from mypy.ini (and other config files):
[mypy]
files = src
ignore_missing_imports = True
  • Python version used: 3.9.5
  • Operating system and version: Windows 10 21H1

Activity

  1. tadeu commented on Jun 24, 2021

    @tadeu
    ContributorAuthor
  2. tadeu commented on Jun 24, 2021

    @tadeu
    ContributorAuthor

    A workaround, for now, is to use this undocumented option together:

    ignore_missing_imports_per_module = True

    as in:

    [mypy]
    files = src
    ignore_missing_imports = True
    ignore_missing_imports_per_module = True
  3. JukkaL commented on Jun 24, 2021

    @JukkaL
    Collaborator

    I can't reproduce this issue, at least on macOS and Python 3.9.0. Can you provide an example file under src/ that triggers the issue? Also can you try this out in a fresh virtualenv?

  4. tadeu commented on Jun 24, 2021

    @tadeu
    ContributorAuthor

    I was trying it in a fresh venv, the source was just a dummy file something.py with

    something: int = "something"

    Perhaps it's only in Windows? There are some if sys.platform == 'win32': in dmypy :)

  5. emmatyping commented on Jun 25, 2021

    @emmatyping
    Member

    I can indeed repro this on Windows with the latest mypy in a fresh venv... strange

    It also appears the .dmypy.json file sticks around afterwards as well...

  6. adam-grant-hendry commented on Jun 22, 2022

    @adam-grant-hendry

    It's on my machine on Windows too.

  7. adam-grant-hendry commented on Jun 22, 2022

    @adam-grant-hendry

    Interestingly, the "temporary" fix does not work if

    enable_error_code = ignore-without-code

    is also set.

  8. MartinBernstorff commented on Mar 10, 2023

    @MartinBernstorff

    I'm getting this same error on windows. The same project works fine on MacOS :-)

  9. Avasam commented on Jun 13, 2023

    @Avasam
    SponsorContributor

    It appears to also be the case with --follow-imports=silent

    Edit: nvm [info] dmypy: follow-imports=silent not supported

  10. ilevkivskyi commented on Jun 13, 2023

    @ilevkivskyi
    Member

    OK, I think I figured it out, Options() object may not equal to itself after a pickle roundtrip (which is what we use to communicate with the daemon on Windows), because of two reasons:

    • There is a nontrivial bit of code applied to ignore_missing_imports after upnickling that also sets ignore_missing_imports_per_module
    • ErrorCode class doesn't have an __eq__().

    The tricky part is that I don't have a Windows machine, but I guess I can tweak Linux code to use Windows logic (and in CI we have Windows).

  11. ilevkivskyi commented on Jun 13, 2023

    @ilevkivskyi
    Member

    Can someone who has a Windows machine please check if #15429 fixes their issue?

  12. added a commit that references this issue on Jun 14, 2023
    cdddc50
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions