module name assumed is __main__ for .pyw files on windows
Bug Report
On windows, .pyw is a valid extension for Python files (to be executed by pythonw.exe).
mypy however assumes files with .pyw extension to have module name __main__.
This results in a False negative when 2 or more .pyw files are checked by mypy.
To Reproduce
Have mypy check 2 or more files with .pyw extension on windows.
Expected Behavior
No mypy issue.
Actual Behavior
application_2.pyw: error: Duplicate module named "__main__" (also at "application_1.pyw")
application_2.pyw: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#mapping-file-paths-to-modules for more info
application_2.pyw: note: Common resolutions include: a) using `--exclude` to avoid checking one of them, b) adding `__init__.py` somewhere, c) using `--explicit-package-bases` or adjusting MYPYPATH
Found 1 error in 1 file (errors prevented further checking)
Your Environment
Python 3.12.5 mypy==1.11.1 mypy-extensions==1.0.0 typing_extensions==4.12.2
Please run the attached windows batch file to reproduce.
Probably because it's not part of the files extensions checked by default: https://mypy.readthedocs.io/en/stable/running_mypy.html#:~:text=If%20you%20pass,passed.
If you pass a file not ending in
.py[i], the module name assumed is__main__(matching the behavior of the Python interpreter), unless --scripts-are-modules is passed.
So at the same time, I'd like .pyw files to be picked-up by default as well if it's possible. While I can pass it explicitly, I didn't find a way to add custom file extensions to autodiscovery.