title: How do I correctly set MYPYPATH to pick up stubs for mypy?
body: <p>I can't for the life of me get MyPy to find stubs that aren't colocated with their source code. Here's the structure I have for my project:</p>
  
  <pre><code>trymypy/
  |- stubs/
  |  \- foo.pyi
  |- __init__.py
  |- usefoo.py
  \- foo.py
  </code></pre>
  
  <pre class="lang-py prettyprint-override"><code># foo.py
  def foofunc(x):
      return str(x)
  </code></pre>
  
  <pre class="lang-py prettyprint-override"><code># usefoo.py
  from trymypy.foo import foofunc
  
  print(foofunc(5) + 5)
  </code></pre>
  
  <pre class="lang-py prettyprint-override"><code># stubs/foo.pyi
  def foofunc(x: int) -&gt; str: ...
  </code></pre>
  
  <p>I have set the <code>MYPYPATH</code> environment variable to <code>/full/path/to/trymypy/stubs</code>, so that MyPy should look inside the <code>stubs</code> directory for my <code>.pyi</code> files.</p>
  
  <p>This should not pass typechecking. MyPy should flag the error as such:</p>
  
  <pre><code>../trymypy/usefoo.py:3: error: Unsupported operand types for + ("str" and "int")
  </code></pre>
  
  <p>Instead, MyPy does not flag any errors, because it is not reading the stub file. If I move the stub file <code>foo.pyi</code> to the root project of the directory, colocated with <code>foo.py</code>, it correctly flags, which indicates to me that the <code>MYPYPATH</code> isn't getting picked up, or isn't being defined correctly.</p>
  
  <p>I have also tried setting <code>mypy_path</code> in a config file <code>mypy.ini</code>:</p>
  
  <pre><code>[mypy]
  python_version = 3.7
  mypy_path = /full/path/to/trymypy/stubs
  </code></pre>
  
  <p>Other config options in <code>mypy.ini</code> do get picked up (e.g. <code>python_version</code>), so MyPy is seeing the file and reading it.</p>
  
  <p>Totally stumped here. This is a (very) simple example that seems like it should be working as documented by MyPy. I've run out of variables to experiment on to get it working.</p>
  
  <p>I am using Python 3.7 and working in a virtual environment that has only mypy installed.</p>