title: Overriding Sphinx autodoc "Alias of" for import of private class?
body: <p>I have a Python package that I am attempting to document with sphinx-autodoc. My python package has an <code>__init__.py</code> file that imports a class out from a submodule to make it accessible at the package level.</p>
  <pre><code>from a.b.c.d import _Foo as Foo
  
  __all__ = [&quot;Foo&quot;]
  </code></pre>
  <p>If I do this, my (html) documentation is as follows:</p>
  <blockquote>
  <p><strong>a.b.c package</strong></p>
  <p><strong>Submodules</strong></p>
  <p><strong>a.b.c.d module</strong></p>
  <p><em>[snip documentation of irrelevant public classes within the a.b.c.d module]</em></p>
  <p><strong>Module contents</strong></p>
  <p>The c module.</p>
  <p>a.b.c.<strong>Foo</strong></p>
  <p>alias of <strong>_Foo</strong></p>
  </blockquote>
  <p>Not super useful since <code>_Foo</code> is (rightly) undocumented as it is a private class within the a.b.c.d submodule.</p>
  <p>I can add the following to my <code>conf.py</code> which ensures that the <em>private</em> class definition in the module is documented.</p>
  <pre><code>def skip(app, what, name, obj, skip, options):
      if name == &quot;_Foo&quot;:
          return False
      return skip
  </code></pre>
  <p>Other alternative, but not great things I've tried:</p>
  <ol>
  <li>Rename <code>a.b.c.d._Foo</code> to <code>a.b.c.d.Foo</code> (and then update the import to <code>from a.b.c.d import Foo</code>) -- but then I get the class documented twice, once under the <strong>a.b.c.d module</strong> heading, and once again under the <strong>Module contents</strong> heading.</li>
  <li>Renaming <code>a.b.c.d.Foo</code> to <code>a.b.c.d.MyFoo</code> and then importing (<code>from a.b.c.d import MyFoo as Foo</code>) results in <code>MyFoo</code> being documented, and <code>Foo</code> being listed as an alias of <code>MyFoo</code>.</li>
  </ol>
  <hr />
  <p>Ideally I'd like the private definition to remain undocumented, but to have the version imported into the package fully documented. Does anyone know how I might achieve this?</p>