List dictionaries in documentation with Sphinx
<p>I have a project with a few .py files that only contains a few dictionaries. Like this:</p>

<pre><code># My file
dictionary = {'key1': 'value1', 'key2: 'value2'}
</code></pre>

<p>But much larger and longer and I would like to document this with Sphinx but I can't get it to work properly. </p>

<p>The files are found by Sphinx just fine and show up under Modules as folder.file but they are all empty? What am I doing wrong? Why won't the dictionaries show up?</p>

<p>in the .rst file for the folder it shows: </p>

<pre><code>    folder.file module
--------------------

.. automodule:: folder.file
    :members:
    :undoc-members:
    :show-inheritance:
</code></pre>

<p>Am I missing something? Thanks in advance!</p>

<p>Sphinx does require extra docstrings for all members that are not classes or methods. You probably don't want to edit <code>autodoc</code> (even though this can come handy for individualization under certain conditions), you can overcome this issue by adding a docstring <strong>below</strong> the variable:</p>

<pre><code># My file
dictionary = {'key1': 'value1', 'key2': 'value2'}
'''A dictionary containing secret values.

Do not expose this dictionary's values to the public. By default, the 
keys 'key1' and 'key2' are available.'''
</code></pre>

python dictionary documentation python-sphinx autodoc