-
Notifications
You must be signed in to change notification settings - Fork 1
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop using mypy's ignore_missing_imports
option
#225
Comments
ignore_missing_imports
option globallyignore_missing_imports
option for all modules
ignore_missing_imports
option for all modulesignore_missing_imports
option
Actions v0.15.0 removes the cli options from the It looks like the When I added And when I added the option to https://github.com/ASFHyP3/OPERA-DISP-TMS, it allowed I'll try using |
We've merged the latest |
Our v0.14.0
reusable-mypy
action runs the followingmypy
command:I observe some unexpected behavior with
--ignore-missing-imports
and--install-types
. Usingburst2safe
as an example, if I checkout the latestdevelop
commit, build the mamba environment and run the above command, it installstypes-python-dateutil-2.9.0.20241206
and flags no issues.However, if I remove
.mypy_cache/
and re-build the environment, then run the above command without--ignore-missing-imports
, it installslxml-stubs-0.5.1 types-Pygments-2.19.0.20250107 types-colorama-0.4.15.20240311 types-docutils-0.21.0.20241128 types-python-dateutil-2.9.0.20241206 types-setuptools-75.8.0.20250110
and then flags 200 errors in 28 files.Some of these errors do not seem directly related to missing imports, e.g.
src/burst2safe/safe.py:338: error: Cannot determine type of "size_bytes"
for L338, or even if it is, that's not an error that we would want to ignore. I thought that particular error might be related to importingKml
viafrom burst2safe.manifest import Kml, Manifest, Preview
at L14 because perhapsmypy
does not recognize theburst2safe
package, but installing the package viapip install -e .
or using a relative import for that line both did not change the number of errors reported, so I'm not sure what's going on there.Also, if I run the
mypy
command with only--ignore-missing-imports
, then the only error it flags is:which I suppose makes some sense since that's the library for which stubs are installed when I run the full
mypy
command, though I'm not sure why--ignore-missing-imports
doesn't suppress that particular import.So, my main concerns are:
--ignore-missing-imports
prevent installation of stubs for all libraries (other thandateutil
)? I think we want to install as many stubs as possible.I think that the ideal resolution to this issue would be to:
--ignore-missing-imports
from our reusable action, and avoid enabling it inpyproject.toml
for new projects (will need to be added topyproject.toml
for existing projects where removing it would cause many errors).pyproject.toml
for existing projects as time allows.The text was updated successfully, but these errors were encountered: