title: Sphinx: how to show attributes as in scipy
body: <p>Let's say we have the following module <code>testmodule.py</code> with a <code>TestClass</code> definition:</p>
  <pre class="lang-py prettyprint-override"><code>&quot;&quot;&quot;This is a test module&quot;&quot;&quot;
  
  class TestClass:
      &quot;&quot;&quot;
      This is a simple description.
  
      Attributes
      ----------
      egg : int
          An egg. Should be from a chiken.
      animal : str
          The animal that laid the egg.
  
      &quot;&quot;&quot;
  
      def __init__(self, egg, animal):
          self.animal = animal
          if self.is_chicken(animal):
              self.egg = egg
          else:
              self.egg = 0
  
      def is_chicken(self, animal):
          &quot;&quot;&quot;Checks if the animal is a chicken.
  
          Returns True if it is, False otherwise
  
          Parameters
          ----------
          animal : str
              An animal that lays eggs
  
          Returns
          -------
          bool
              True if `animal` is chicken. False otherwise.
          &quot;&quot;&quot;
          if animal == 'chicken':
              return True
          else:
              return False
  
  </code></pre>
  <p>Using Sphinx 3.5.4 with <code>autodoc</code> and <code>napoleon</code> extensions, and <code>pydata_sphinx_theme</code> as the theme in <code>conf.py</code>, I get the doc for the class shown below.</p>
  <p>I used <code>.. automodule:: testmodule</code> in a test.rst file, that index.rst references, with <code>:member:</code> and <code>:show-inheritance:</code>.</p>
  <p><a href="https://i.stack.imgur.com/FD0Qn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FD0Qn.png" alt="enter image description here" /></a></p>
  <p>But I would actually like something more like Scipy has for the attributes.</p>
  <p><a href="https://i.stack.imgur.com/PAAPh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PAAPh.png" alt="enter image description here" /></a></p>
  <p>The closest I can get is by setting <code>napoleon_use_ivar = True</code> in <code>conf.py</code>, which outputs something close, except that we get &quot;Variables&quot; instead of &quot;Attributes&quot; and the definition is inlined with the attribute name and type.</p>
  <p><a href="https://i.stack.imgur.com/4k5Pv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4k5Pv.png" alt="enter image description here" /></a></p>