you run mypy in the package directory on the __main__.py and at some point your code (or another package's code) imports IPython then I get the following error: __main__.py: error: Source file found ...