Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[autodoc] Private (double-underscore) inner class not documented #11181

Open
ipilcher opened this issue Feb 7, 2023 · 0 comments
Open

[autodoc] Private (double-underscore) inner class not documented #11181

ipilcher opened this issue Feb 7, 2023 · 0 comments

Comments

@ipilcher
Copy link

ipilcher commented Feb 7, 2023

Describe the bug

I am attempting to document a private (name begins with 2 underscores) inner class.

"""A module to test Sphinx.

.. autoclass:: _Foo
   :members:

.. autoclass:: sphinxtest._Foo._Foo__Bar
   :members:
"""

import enum

class _Foo(object):
    """A class to test Sphinx.

    :param name: The name of the Foo.
    :type name: str
    """

    def __init__(self, name):
        self.__name = name

    class __Bar(enum.Enum):
        """A private inner class."""
        BAZ = None
        """A ``BAZ`` is a baz."""

Note that the class name in the autoclass directive is the mangled name.

The only mention of the inner class in the generated HTML is:

<dl class="py attribute">
<dt class="sig sig-object py" id="sphinxtest._Foo._Foo__Bar">
<span class="sig-prename descclassname"><span class="pre">sphinxtest._Foo.</span></span><span class="sig-name descname"><span class="pre">_Foo__Bar</span></span><a class="headerlink" href="#sphinxtest._Foo._Foo__Bar" title="Permalink to this definition"></a></dt>
<dd><p>alias of <code class="xref py py-class docutils literal notranslate"><span class="pre">__Bar</span></code></p>
</dd></dl>

Neither the docstring of the inner class nor its member are documented.

How to Reproduce

See Python module (sphinxtest.py) above.

index.rst:

.. SphinxTest documentation master file, created by
   sphinx-quickstart on Mon Feb  6 10:28:42 2023.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to SphinxTest's documentation!
======================================

.. toctree::
   :maxdepth: 2
   :caption: Contents:



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

conf.py:

# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# 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('../..'))


# -- Project information -----------------------------------------------------

project = 'SphinxTest'
copyright = '2023, Ian Pilcher'
author = 'Ian Pilcher'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [ 'sphinx.ext.autodoc' ]

# Add any paths that contain templates here, relative to this directory.
templates_path = [ '_templates' ]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
#import sphinx_py3doc_enhanced_theme
#html_theme = 'sphinx_py3doc_enhanced_theme'
#html_theme_path = [ sphinx_py3doc_enhanced_theme.get_html_theme_path() ]

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = [ '_static' ]

Environment Information

Platform:              linux; (Linux-6.1.9-200.fc37.x86_64-x86_64-with-glibc2.36)
Python version:        3.11.1 (main, Jan  6 2023, 00:00:00) [GCC 12.2.1 20221121 (Red Hat 12.2.1-4)])
Python implementation: CPython
Sphinx version:        6.1.3
Docutils version:      0.19
Jinja2 version:        3.1.2
Pygments version:      2.14.0

Sphinx extensions

extensions = [ 'sphinx.ext.autodoc' ]

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants