title: Customize module search path (PYTHONPATH) via pipenv
body: <p>I have a Python project consisting of a Jupyter notebook, several scripts in a <code>bin</code> directory and modules in a <code>src</code> directory, with dependencies in a <code>Pipfile</code>:</p>
  
  <pre><code>myproject
  ├── myproject.ipynb
  ├── Pipfile
  ├── Pipfile.lock
  ├── bin
  │   ├── bar.py
  │   └── foo.py
  └── src
      ├── baz.py
      └── qux.py
  </code></pre>
  
  <p>The scripts <code>foo.py</code> and <code>bar.py</code> use the standard shebang</p>
  
  <pre><code>#!/usr/bin/env python
  </code></pre>
  
  <p>and can be run with <code>pipenv shell</code>:</p>
  
  <pre><code>mymachine:myproject myname$ pipenv shell
  (myproject-U308romt) bash-3.2$ bin/foo.py
  foo
  </code></pre>
  
  <p>However, I can't easily access the modules in <code>src</code> from the scripts. If I add</p>
  
  <pre><code>import src.baz as baz
  </code></pre>
  
  <p>to <code>foo.py</code>, I get:</p>
  
  <pre><code>ModuleNotFoundError: No module named 'src'
  </code></pre>
  
  <p>One solution I tried is to add a <code>.env</code> file under <code>myproject</code>:</p>
  
  <pre><code>PYTHONPATH=${PYTHONPATH}:${PWD}
  </code></pre>
  
  <p>This works thanks to <code>pipenv</code>'s <a href="https://github.com/pypa/pipenv/blob/master/docs/advanced.rst#-automatic-loading-of-env" rel="noreferrer">automatic loading of <code>.env</code></a>, but checking the <code>.env</code> file into the git distribution of the project would collide with the traditional use of <code>.env</code> to store secrets such as passwords -- in fact, my default <code>.gitignore</code> for Python projects already excludes <code>.env</code> for just this reason.</p>
  
  <pre><code>$ git add .env
  The following paths are ignored by one of your .gitignore files:
  .env
  Use -f if you really want to add them.
  </code></pre>
  
  <p>Alternatively, I could move <code>src</code> under <code>bin</code>, but then the Jupyter notebook would have to reference the modules as <code>bin.src.baz</code> etc., which is also a hassle.</p>
  
  <p>My current workaround is just to add a symlink:</p>
  
  <pre><code>myproject
  ├── Pipfile
  ├── Pipfile.lock
  ├── bin
  │   ├── bar.py
  │   ├── foo.py
  │   └── src -&gt; ../src
  └── src
      ├── baz.py
      └── qux.py
  </code></pre>
  
  <p>This works, and I suppose has the benefit of being transparent, but it seems like there should be some way to leverage <code>pipenv</code> to solve the same problem.</p>
  
  <p>Is there a portable, distributable way to put these modules on the search path?</p>