sphinx-contrib / matlabdomain

A Sphinx extension for documenting Matlab code
http://sphinxcontrib-matlabdomain.readthedocs.io/
Other
70 stars 45 forks source link

Sphinx 1.7 broke autodoc :members: functionality. #66

Closed sglvladi closed 6 years ago

sglvladi commented 6 years ago

Hi there,

I followed the tutorial step by step and managed to get sphinx to successfully build the html.

However, when I run make html, I get a load of warnings as follows:

Running Sphinx v1.7.1
WARNING: while setting up extension sphinxcontrib.matlab: directive 'automodule' is already registered, it will be overridden
WARNING: while setting up extension sphinxcontrib.matlab: directive 'autoclass' is already registered, it will be overridden
WARNING: while setting up extension sphinxcontrib.matlab: directive 'autoexception' is already registered, it will be overridden
WARNING: while setting up extension sphinxcontrib.matlab: directive 'autodata' is already registered, it will be overridden
WARNING: while setting up extension sphinxcontrib.matlab: directive 'autofunction' is already registered, it will be overridden
WARNING: while setting up extension sphinxcontrib.matlab: directive 'automethod' is already registered, it will be overridden
WARNING: while setting up extension sphinxcontrib.matlab: directive 'autoattribute' is already registered, it will be overridden
WARNING: while setting up extension sphinxcontrib.matlab: directive 'autoinstanceattribute' is already registered, it will be overridden
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 1 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index
generating indices... genindex mat-modindex
writing additional pages... search
copying static files... done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
build succeeded, 8 warnings.

The HTML pages are in _build\html.

What is more, when I view index.html, it looks like autodoc only generates the documentation for the class, but not the member methods (get_x and my_static_function). Here's the relevant part of the produced html (after that comes the "indices-and-tables" section):


<div class="section" id="test-data">
   <h1>Test Data<a class="headerlink" href="#test-data" title="Permalink to this headline">¶</a></h1>
   <p>This is the test data module.</p>
   <span class="target" id="module-test_data"></span><p><a class="reference internal" href="#module-test_data" title="test_data"><code class="xref mat mat-mod docutils literal notranslate"><span class="pre">test_data</span></code></a> is a really cool module.</p>
   <div class="section" id="my-handle-class">
      <h2>My Handle Class<a class="headerlink" href="#my-handle-class" title="Permalink to this headline">¶</a></h2>
      <p>This is the handle class definition.</p>
      <dl class="class">
         <dt id="test_data.MyHandleClass">
         <em class="property">class </em><code class="descclassname">test_data.</code><code class="descname">MyHandleClass</code><span class="sig-paren">(</span><em>x</em><span class="sig-paren">)</span><a class="headerlink" href="#test_data.MyHandleClass" title="Permalink to this definition">¶</a></dt>
         <dd><p>Bases: <code class="xref mat mat-class docutils literal notranslate"><span class="pre">handle</span></code>, <code class="xref mat mat-class docutils literal notranslate">
         <span class="pre">my.super.Class</span></code></p>
         <p>a handle class</p>
         <table class="docutils field-list" frame="void" rules="none">
         <col class="field-name" />
         <col class="field-body" />
         <tbody valign="top">
         <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body">
             <strong>x</strong> – a variable</td>
         </tr>
         </tbody>
         </table>
         </dd>
      </dl>
   </div>
</div>

As you can see, no documentation is printed for the member methods/property of the class. Here's my index.rst file:


.. test documentation master file, created by
   sphinx-quickstart on Tue Mar 13 22:10:50 2018.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to test's documentation!
================================

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

Test Data
=========
This is the test data module.

.. automodule:: test_data

:mod:`test_data` is a really cool module.

My Handle Class
---------------
This is the handle class definition.

.. autoclass:: MyHandleClass
   :show-inheritance:
   :members:
   :undoc-members: 

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

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

and MyHandleClass.m file:

classdef MyHandleClass < handle & my.super.Class
    % a handle class
    %
    % :param x: a variable

    %% some comments
    properties
        x % a property
    end
    methods
        function h = MyHandleClass(x)
            h.x = x
        end
        function x = get.x(obj)
        % how is this displayed?
            x = obj.x
        end
    end
    methods (Static)
        function w = my_static_function(z)
        % A static function in :class:`MyHandleClass`.
        %
        % :param z: input z
        % :returns: w

            w = z
        end
    end
end

I am running Python 3.6.2, Sphinx 1.7.1 and sphinxcontrib-matlabdomain 0.2.16 on Windows 10.

Any help would be much appreciated.

joeced commented 6 years ago

The warnings are cannot be avoided (see #63). I will try this out, on my own machine.

sglvladi commented 6 years ago

@joeced First of all thanks for the swift response.

I am not that bothered about the warnings, but I thought I'd mention them in case they had something to do with the issue. If they don't matter, then that's fine.

Let me know how it goes.

joeced commented 6 years ago

I can confirm that this is a real issue. When I use Sphinx 1.6.5 with sphinxcontrib-matlabdomain 0.2.13, the member documentation is rendered as expected. Version 0.2.13 was the last version before merging a pull request that solved a Sphinx 1.7 issue. Apparently, this is not the only issue. Thanks for reporting this. 👍

joeced commented 6 years ago

I'm working on a fix. First I have released a version (0.2.17) using Sphinx < 1.7. Next (probably tomorrow) I'll release a 0.3 version which requires Sphinx > 1.7.