Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Fix dmypy run on Windows#15429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Fix dmypy run on Windows#15429
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This comment has been minimized.
This comment has been minimized.
Avasam commentedJun 13, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
ilevkivskyi commentedJun 13, 2023
OK, great, thanks for confirming! |
Avasam commentedJun 13, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I'd like if someone else can confirm too, since my usage is going through a 3rd party extension. Just to make sure it wasn't a fluke. |
AlexWaygood commentedJun 13, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I can also repro the issue on a Windows machine, and can also confirm that this patch appears to fix it! (I'm running dmypy from the command line.) |
svalentin left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Tested it and seems to work.
before:
PS C:\src\mypy-play> python -m mypy.dmypy run .\test.pyRestarting: configuration changedDaemon stoppedDaemon startedResponse: {'restart': 'configuration changed', 'stdout': '', 'stderr': '', 'platform': 'win32', 'python_version': '3_11', 'roundtrip_time': 0.488344669342041}after applying PR:
PS C:\src\mypy-play> python -m mypy.dmypy run .\test.pyRestarting: configuration changedDaemon stoppedDaemon started←[1m←[92mSuccess: no issues found in 42 source files←[0mPS C:\src\mypy-play> python -m mypy.dmypy run .\test.py←[1m←[92mSuccess: no issues found in 1 source file←[0mPS C:\src\mypy-play>mypy/dmypy_server.py Outdated
| options:Options, | ||
| status_file:str, | ||
| timeout:int|None=None, | ||
| options_snapshot:dict[str,object]|None=None, |
svalentinJun 13, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I accepted it since it work, but thinking out loud, it feels like it shouldn't be necessary to pass both options and options_snapshot. One or the other should be enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Yeah, but then we will need something like "stable compare", which will be a tiny bit slower (this is btw the original way I did it). OTOH, then motivation is much more obvious, so let's go that way indeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@svalentin Could you please test again just in case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Nice!
Still works:
PS C:\src\mypy-play> python -m mypy.dmypy run .\test.pySuccess: no issues found in 1 source fileThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
For what it's worth, I think this is a much more elegant fix
ilevkivskyi commentedJun 14, 2023
@hauntsaninja It looks like |
AlexWaygood commentedJun 14, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
It looks like the issue is that mypy-primer can't install winsdk (maybe it's a Windows-only package?), which is specified as one of the packages needed for typechecking Autosplit. If that is indeed the issue,hauntsaninja/mypy_primer#89 should fix it. winsdk was only added to the mypy-primer recipe for Autosplit yesterday, inhauntsaninja/mypy_primer#87 |
According tomypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |

Uh oh!
There was an error while loading.Please reload this page.
Fixes#10709
Two changes here:
ErrorCodebecause they may appear in options snapshotsOptions.apply_changes()does some unrelated things with flagsBoth are only relevant on Windows where options may roundtrip as:
options -> snapshot -> pickle -> base64 -> unpickle -> apply_changes.