title: How to ignore 'src' directory in python project when making sphinx autodoc
body: <p>(alternative description could be 'how to rename a sphinx-autodoc package name?')</p>
  
  <p>using sphinx version 1.7 on Python 2.7.13</p>
  
  <hr>
  
  <p>I would like to automatically create documentation using docstrings and <code>sphinx-apidoc</code>.</p>
  
  <p>My project structure is as follows:</p>
  
  <pre><code>myPythonProject      &lt;- my Python package name and git repository.
  |-- docs
  |   |-- _build
  |   |   |-- html     &lt;- where final HTML doc is created.
  |   |   
  |   |-- apidocs      &lt;- contains the autodoc created '.rst' files.
  |   |-- _static
  |   |-- _templates
  |   |
  |   | conf.py        &lt;- 4 Sphinx doc files, auto generated with sphinx-quickstart.
  |   | index.rst      &lt;-
  |   | make.rst       &lt;-
  |   | Makefile       &lt;-
  |
  |
  |-- src
  |   | __init__.py    &lt;- important for 'setup.py'.
  |   | myModule1.py
  |   | myModule2.py
  |   | myModule3.py
  |
  | setup.py
  </code></pre>
  
  <p>The <code>myModule</code> files contain docstrings.</p>
  
  <p>After performing the <code>sphinx-quickstart</code> with quite standard options <em>(extensions autodoc and intersphinx. No separated source and build directories. Adding <code>make.bat</code> and <code>Makefile</code> files.)</em>
  And some minor change to the <code>conf.py</code> where I uncommented and changed:</p>
  
  <pre><code># If extensions (or modules to document with autodoc) are in another directory,
  # add these directories to sys.path here. If the directory is relative to the
  # documentation root, use os.path.abspath to make it absolute, like shown here.
  
  import os
  import sys
  sys.path.insert(0, os.path.abspath('../'))
  </code></pre>
  
  <p>When running:
  <code>sphinx-apidoc -f -o docs/apidocs src</code></p>
  
  <p>The docstrings are found but it is convinced <strong>src</strong> is my package name. It clearly does not observe my <code>setup.py</code> file or something. It does look at <strong>__init__.py</strong> though, if I remove it I can create docs with only modules, no package at all. But also this is not desired, but closer at least.</p>
  
  <p>The content of <strong>src</strong> is installed as 'MyPythonProject'. Therefore <code>Setup.py</code> is configured as follows to install this package and leaving out the 'src' reference when importing:</p>
  
  <pre><code>from setuptools import setup
  
  setup(
      name='MyPythonProject',
  
      packages={'MyPythonProject': 'src'},
      package_dir={'MyPythonProject': 'src'},
  </code></pre>
  
  <p>(Is this an unorthodox structure? Otherwise I would also be interested in a more common layout which autodoc does support.)</p>
  
  <hr>
  
  <p>Currently </p>
  
  <pre><code>sphinx-apidoc -f -o docs/apidocs src
  sphinx-build -a -b html docs/ docs/_build/html
  </code></pre>
  
  <p>returns the following document:
  <a href="https://i.stack.imgur.com/4yD6I.png" rel="nofollow noreferrer">you can ignore the red.</a></p>
  
  <h2>Question</h2>
  
  <p>How can I create documentation showing <code>myPythonProject.myModule1.def1()</code> it's docstring, and not <code>src.myModule1.def1()</code>?</p>