title: Type-check Jupyter Notebooks with mypy
body: <p>I have a project containing a bunch of Python modules (<code>.py</code> files) and a bunch of Jupyter Notebooks (<code>.ipynb</code> files) which import things from the Python modules.</p>
  
  <p>I can (assuming I've got <code>__init__.py</code> files in all subfolders) type-check all the <code>.py</code> files by simply running <code>mypy .</code> from the root of the project. But I'd like to also be able to type-check my Jupyter Notebooks.</p>
  
  <p>An ideal solution would:</p>
  
  <ul>
  <li>type check all Python code in my Jupyter Notebooks,</li>
  <li>be able to follow imports of <code>.py</code> modules from within Jupyter Notebooks when type-checking, just like imports in <code>.py</code> files,</li>
  <li>let me type-check the whole project from the command line, so that I can run type-checking as part of a test suite or a pre-commit hook, and</li>
  <li>in some way meaningfully report the locations of type errors within my Notebooks, analogously to how mypy prints line numbers for errors in <code>.py</code> files.</li>
  </ul>
  
  <p>How can I do this?</p>