title: How can I include the parent folder structure on a library distribution in Python 3.6 using setuptools?
body: <p>I am using setuptools to distribute a Python library. I have the following directory structure:</p>
  
  <pre><code>  /src
      /production
        setup.py
        /prod-library
          /package1
          /package2
  </code></pre>
  
  <p>The folder structure has to stay like this because there will be multiple libraries living under src in the future and need to have their own setup.py files. So the traditional answer of having 1 parent folder and moving out setup.py to the root folder will not work in this case.</p>
  
  <p>I am using the following in the setup.py of the library to export the library (which is working)</p>
  
  <pre><code>    package_dir={'': '.'},
      packages=find_packages()
  </code></pre>
  
  <p>Inside the project tar.gz it looks like this: </p>
  
  <pre><code>    /prod-library
        /package1
        /package2
  </code></pre>
  
  <p>But inside the prod-library package Python files, imports referencing other modules need to be structured as follows:</p>
  
  <pre><code>    import src.production.prod-library.package1
      import src.production.prod-library.package2
  </code></pre>
  
  <p>The problem: 
  After importing one of those libraries to a different project, errors are raised as follows:</p>
  
  <p><code>ModuleNotFoundError: No module named 'src.production'</code></p>
  
  <p>Since the build only drops in the /prod-library package, the project importing the code fails due to the missing folder structure (src/production) since the built distribution only has /prod-library.</p>
  
  <p>What I need to do is include the src/production folder in the distribution build so the resulting tar.gz file looks like this: </p>
  
  <pre><code>   /src
       /production
         /prod-library
            /package1
            /package2
  </code></pre>
  
  <p>I am not sure how I can get those in the build structure since they are above the setup.py location. How can that be accomplished?</p>
  
  <p>If it can’t, then I am open to suggestions about fixing the imports if that can be a solution. </p>