Description
I was just sprucing up EDMarketConnector's new Build-exe-and-msi.py
which invokes py2exe.freeze()
and noticed PyCharm was unhappy with the types for the console=
and windows=
arguments.
We have:
windows=[
{
'dest_base': appname,
'script': APP,
'icon_resources': [(0, f'{appname}.ico')],
'other_resources': [(24, 1, open(f'{appname}.manifest').read())],
}
],
console=[
{
'dest_base': appcmdname,
'script': APPCMD,
'other_resources': [(24, 1, open(f'{appcmdname}.manifest').read())],
}
],
which works perfectly fine. PyCharm notes that the declared types of those arguments are list[str]
, and the documentation says:
console (list of str): paths of the Python files that will be frozen as console (CLI) executables.
windows (list of str): paths of the Python files that will be frozen as windows (GUI) executables.
However, e.g. https://github.com/py2exe/py2exe/blob/master/tests/functional/bundlefiles0_sqlite_test/freeze.py has:
freeze(console=[{ "script": "bundlefiles0_sqlite_test.py"}],
...
So this list[dict[...]]
form does seem to be correct.
I do note that https://github.com/py2exe/py2exe/blob/master/py2exe/__init__.py#L16 doesn't actually declare types, so I can only assume PyCharm is picking this up from the docstring. mypy
doesn't complain.