sphinxcontrib-matlabdomain

A Sphinx extension for documenting Matlab code

https://github.com/sphinx-contrib/matlabdomain

Science Score: 51.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    2 of 26 committers (7.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.3%) to scientific vocabulary

Keywords

matlab python sphinx sphinx-extension sphinxcontrib

Keywords from Contributors

neuroscience bids closember fmri neuroimaging mri quality-control
Last synced: 6 months ago · JSON representation ·

Repository

A Sphinx extension for documenting Matlab code

Basic Info
Statistics
  • Stars: 81
  • Watchers: 8
  • Forks: 46
  • Open Issues: 33
  • Releases: 64
Topics
matlab python sphinx sphinx-extension sphinxcontrib
Created over 8 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License Citation Authors

README.rst

.. |github-action-badge| image:: https://github.com/sphinx-contrib/matlabdomain/actions/workflows/python-package.yml/badge.svg
   :align: middle

.. |rtd-badge| image:: https://readthedocs.org/projects/sphinxcontrib-matlabdomain/badge/?version=latest
   :target: https://sphinxcontrib-matlabdomain.readthedocs.io/en/latest/?badge=latest
   :alt: Documentation Status
   :align: middle

+----------------------+-----------------------+
+ Github Actions       | |github-action-badge| |
+----------------------+-----------------------+
+ Documentation Status | |rtd-badge|           |
+----------------------+-----------------------+

sphinxcontrib-matlabdomain -- Sphinx domain for auto-documenting MATLAB
=======================================================================

This extension provides a `Sphinx `_
*domain* for automatically generating doumentation from MATLAB source files.
It is modelled after the `Python autodoc `_.

The extension allows you to have your documentation and source files together
and use the powerful `Sphinx `_
documentation tool. All your MATLAB file help text can be automatically
included in the your documentation and output as for instance HTML.

The extension works really well with `sphinx.ext.napoleon
`_.

Recent `Changes `_.


Usage
=====

The Python package must be installed with::

   pip install sphinxcontrib-matlabdomain

In general, the usage is the same as for documenting Python code. The package
is tested with Python >= 3.8 and Sphinx >= 4.5.0.

For a Python 2 compatible version the package must be installed with::

   pip install sphinxcontrib-matlabdomain==0.11.8


Configuration
-------------
In your Sphinx ``conf.py`` file add ``sphinxcontrib.matlab`` to the list of
extensions. ::

   extensions = ['sphinxcontrib.matlab', 'sphinx.ext.autodoc']

For convenience the `primary domain `_
can be set to ``mat`` with.::

   primary_domain = "mat"


Additional Configuration
~~~~~~~~~~~~~~~~~~~~~~~~

``matlab_src_dir``
   In order for the Sphinx MATLAB domain to auto-document MATLAB source code,
   set the config value of ``matlab_src_dir`` to an absolute path or a path
   relative to the source directory. Currently only one MATLAB path can be
   specified, but that folder and all the subfolders in that tree will be
   searched.

``matlab_short_links``
   Shorten all class, package and functions to the minimum length. This assumes
   that everything is in the path as we would expect it in MATLAB. This will
   resemble a more MATLAB-like presentation. If it is ``True`` is forces
   ``matlab_keep_package_prefix = False``. Further, it allows for much shorter
   and cleaner references. Example, given a path to classes like
   ``target.subfolder.ClassFoo`` and ``target.@ClassFolder.Classfolder``

   * With ``False``::

      :class:`target.subfolder.ClassFoo`

      :class:`target.@ClassFolder.Classfolder`

   * With ``True``::

      :class:`ClassFoo`

      :class:`ClassFolder`

   Default is ``False``. *Added in Version 0.19.0*.

``matlab_auto_link``
   Automatically convert the names of known entities (e.g. classes, functions,
   properties, methods) to links. Valid values are ``"basic"``
   and ``"all"``.

   * ``"basic"`` - Auto-links (1) known classes, functions, properties, or
     methods that appear in docstring lines that begin with "See also" and any
     subsequent lines before the next blank line (unknown names are wrapped in
     double-backquotes), and (2) property and method names that appear in lists
     under " Properties:" and " Methods:" headings in class
     docstrings.

   * ``"all"`` - Auto-links everything included with ``"basic"``, plus all known
     classes and functions everywhere else they appear in any docstring, any
     fully qualified (including class name) property or method names, any
     names ending with "()" within class, property, or method docstrings that
     match a method of the corresponding class, and any property or method names
     in their own docstrings. Note that a non-breaking space before or after
     a name will prevent auto-linking.

   Default is ``None``. *Added in Version 0.20.0*.

``matlab_show_property_default_value``
   Show property default values in the rendered document. Default is ``False``,
   which is what MathWorks does in their documentation. *Added in Version
   0.16.0*.

``matlab_show_property_specs``
   Show property *specifiers*, the size, class and validators, in the rendered
   document. Default is ``False``, which is what MathWorks does in their
   documentation. *Added in Version 0.22.0*.

``matlab_class_signature``
   Shows the constructor argument list in the class signature if ``True``.
   Default is ``False``. *Added in Version 0.20.0*.

``matlab_keep_package_prefix``
   Determines if the MATLAB package prefix ``+`` is displayed in the generated
   documentation.  Default is ``False``.  When ``False``, packages are still
   referred to in ReST using ``+pakage.+subpkg.func`` but the output will be
   ``pakage.subpkg.func()``. Forced to ``False`` if  ``matlab_short_links`` is
   ``True``. *Added in Version 0.11.0*.

``matlab_src_encoding``
   The encoding of the MATLAB files. By default, the files will be read as utf-8
   and parsing errors will be replaced using ? chars. *Added in Version 0.9.0*.

If you want the closest to MATLAB documentation style, use ``matlab_short_links
= True`` and ``matlab_auto_link = "basic"`` or ``matlab_auto_link = "all"`` in
your ``conf.py`` file.


Roles and Directives
--------------------

Please see `Sphinx Domains `_ and
`sphinx.ext.autodoc
`_ for
documentation on the use of roles and directives. MATLAB code can be documented
using the following roles and directives:

====================================  ===========================================
Directive                             MATLAB object
====================================  ===========================================
``.. module:: foldername``            **folders, packages and namespaces**
``.. currentmodule:: foldername``     * set folder but do not link
``.. automodule:: foldername``        * auto-document
``:mod:`foldername```                 * reference
``.. function:: funcname``            **function definition and signature**
``.. autofunction:: funcname()``      * auto-document
``:func:`funcname```                  * reference
``.. script:: scriptname``            **script definition**
``.. autoscript:: scriptname``        * auto-document
``:scpt:`scriptname```                * reference
``.. class:: classname()``            **class definition and optional signature**
``.. autoclass:: classname``          * auto-document
``:class:`classname```                * reference
``.. method:: methname()``            **method definition and signature**
``.. automethod:: methname``          * auto-document
``:meth:`methname```                  * reference
``.. staticmethod:: statmethname()``  **static method definition and signature**
``.. automethod:: statmethname``      * auto-document
``:meth:`methname```                  * reference
``.. attribute:: attrname``           **property definition**
``.. autoattribute:: attrname``       * auto-document
``:attr:`attrname```                  * reference
``.. application:: appname``          **application definition**
``.. autoapplication:: appname``      * auto-document
``:app:`appname```                    * reference
====================================  ===========================================

Several options are available for auto-directives.

* ``:members:`` auto-document public members
* ``:show-inheritance:`` list bases
* ``:undoc-members:`` document members without docstrings
* ``:annotation:`` specifies attribute annotation instead of default

There are also several config values that can be set in ``conf.py`` that will
affect auto-docementation.

* ``autoclass_content`` can be set to ``class``, ``both`` or ``init``, which
  determines which docstring is used for classes. The constructor docstring
  is used when this is set to ``init``.
* ``autodoc_member_order`` can be set to ``alphabetical``, ``groupwise`` or
  ``bysource``.
* ``autodoc_default_flags`` can be set to a list of options to apply. Use
  the ``no-flag`` directive option to disable this config value once.

.. note::

    The module roles and directives create a psuedo namespace for MATLAB
    objects, similar to a package. They represent the path to the folder
    containing the MATLAB object. If no module is specified then Sphinx will
    assume that the object is a built-in.

Example: given the following MATLAB source in folder ``test_data``::

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

        %% some comments
        properties
            x % a property

            % Multiple lines before a
            % property can also be used
            y
        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

Use the following to document::

    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:

In version 0.19.0 the ``.. automodule::`` directive can also take a ``.`` as
argument, which allows you to document classes or functions in the root of
``matlab_src_dir``.


Module Index
------------

Since version 0.10.0 the *MATLAB Module Index* should be linked to with::

   `MATLAB Module Index `_

Older versions, used the *Python Module Index*, which was linked to with::

   :ref:`modindex`


Documenting Python and MATLAB sources together
==============================================

Since version 0.10.0 MATLAB and Python sources can be (auto-)documented in the same
Sphinx documentation. For this to work, do not set the `primary domain `_.

Instead use the ``mat:`` prefix before the desired directives::

   .. automodule:: func
   .. autofunction:: func.main

   .. mat:automodule:: matsrc
   .. mat:autofunction:: matsrc.func


Online Demo
===========

.. warning::

   The online demo is highly outdated!

The test docs in the repository are online here:
http://bwanamarko.alwaysdata.net/matlabdomain/

.. note::

    Sphinx style markup are used to document parameters, types, returns and
    exceptions. There must be a blank comment line before and after the
    parameter descriptions.


Users
=====

* `Cantera `_
* `CoSMo MVPA `_
* `The Cobra Toolbox `_
* `The RepLAB Toolbox `_


Citation
========
.. image:: https://zenodo.org/badge/105161090.svg
   :target: https://zenodo.org/badge/latestdoi/105161090

Owner

  • Name: sphinx-contrib
  • Login: sphinx-contrib
  • Kind: organization

A collection of Sphinx extensions maintained by their respective authors. It is not an official part of Sphinx.

Citation (CITATION.bib)

@software{jorgen_cederberg_2023_7747374,
  author    = {Jørgen Cederberg and
               Mark Mikofski and
               Denis Rosset and
               Isaac Lenton and
               Neururer Martin and
               Mathew Topper and
               Chris Markiewicz and
               Christoph Boeddeker and
               Claudio Vergari and
               cleobis and
               David Stansby and
               florianjacob and
               PekaryGergelyR and
               Hugo Leblanc and
               Marc-Henri Bleu-Laine and
               Nikolaas N. Oosterhof and
               ptitrex and
               Marshall J. Styczinski},
  title     = {sphinx-contrib/matlabdomain: 0.22.0},
  month     = jul,
  year      = 2024,
  publisher = {Zenodo},
  version   = {0.22.0},
  doi       = {10.5281/zenodo.7746009},
  url       = {https://github.com/sphinx-contrib/matlabdomain}
}

GitHub Events

Total
  • Issues event: 7
  • Watch event: 12
  • Delete event: 1
  • Issue comment event: 19
  • Push event: 1
  • Pull request event: 2
  • Fork event: 1
  • Create event: 1
Last Year
  • Issues event: 7
  • Watch event: 12
  • Delete event: 1
  • Issue comment event: 19
  • Push event: 1
  • Pull request event: 2
  • Fork event: 1
  • Create event: 1

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 296
  • Total Committers: 26
  • Avg Commits per committer: 11.385
  • Development Distribution Score (DDS): 0.395
Past Year
  • Commits: 15
  • Committers: 3
  • Avg Commits per committer: 5.0
  • Development Distribution Score (DDS): 0.4
Top Committers
Name Email Commits
Jørgen Cederberg j****n@c****e 179
bwanamarko b****o@y****m 67
Ray Zimmerman r****n 10
Jørgen Cederberg j****e@w****m 6
Remi Gau r****u@h****m 5
bwanamarko b****o@y****m 3
Mathew Topper d****e@y****k 3
Denis Rosset p****s@d****m 2
Isaac Lenton i****c@i****m 2
Luis Altenkort 6****s 2
Martin Neururer m****r@g****m 2
Dan O'Shea d****a@g****m 1
Florian Jacob d****l@l****t 1
Anton Edvinovich Pozharskiy a****i@g****m 1
Chris Markiewicz e****s@g****m 1
Christoph c****j@m****e 1
Claudio Vergari c****i@g****m 1
Cleobis c****s@g****m 1
David Stansby d****y@g****m 1
Florian Jacob f****n@w****e 1
GulyasGergelyR g****2@g****m 1
Hugo Leblanc d****n@g****m 1
Marc-Henri Bleu-Laine m****l@m****m 1
Nikolaas N. Oosterhof n****f@u****t 1
Stefan Tibus 3****s 1
ptitrex t****r@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 102
  • Total pull requests: 95
  • Average time to close issues: 12 months
  • Average time to close pull requests: 4 days
  • Total issue authors: 48
  • Total pull request authors: 18
  • Average comments per issue: 3.54
  • Average comments per pull request: 1.05
  • Merged pull requests: 91
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 11
  • Pull requests: 2
  • Average time to close issues: about 1 hour
  • Average time to close pull requests: 9 minutes
  • Issue authors: 9
  • Pull request authors: 2
  • Average comments per issue: 1.82
  • Average comments per pull request: 0.5
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • joeced (19)
  • rdzman (13)
  • denisrosset (5)
  • BuildingAtom (4)
  • Remi-Gau (4)
  • willem-pennings (3)
  • luhuhis (2)
  • changlichun (2)
  • apozharski (2)
  • Funky185540 (2)
  • fndrplayer39 (2)
  • mikofski (2)
  • cvergari (2)
  • TobiasHolicki (2)
  • jdillard (2)
Pull Request Authors
  • joeced (70)
  • rdzman (11)
  • apozharski (6)
  • H0R5E (3)
  • itsmoosh (2)
  • stibus (2)
  • Remi-Gau (2)
  • Fabian-Geyer (2)
  • denisrosset (2)
  • ilent2 (2)
  • mikofski (1)
  • changlichun (1)
  • luhuhis (1)
  • ptitrex (1)
  • effigies (1)
Top Labels
Issue Labels
enhancement (7) bug (7) help wanted (4) minor (2) 0.3 (1) src (1) proposal (1)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 8,850 last-month
  • Total dependent packages: 5
    (may contain duplicates)
  • Total dependent repositories: 107
    (may contain duplicates)
  • Total versions: 80
  • Total maintainers: 3
pypi.org: sphinxcontrib-matlabdomain

Sphinx "matlabdomain" extension

  • Versions: 79
  • Dependent Packages: 5
  • Dependent Repositories: 107
  • Downloads: 8,850 Last month
Rankings
Dependent repos count: 1.4%
Dependent packages count: 1.9%
Downloads: 3.4%
Average: 4.4%
Forks count: 6.3%
Stargazers count: 8.8%
Maintainers (3)
Last synced: 6 months ago
proxy.golang.org: github.com/sphinx-contrib/matlabdomain
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago

Dependencies

.github/workflows/python-package.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • pypa/gh-action-pypi-publish release/v1 composite
dev-requirements.txt pypi
  • flake8 * development
  • pylint * development
  • pytest * development
  • sphinx_rtd_theme * development
  • sphinxcontrib-napoleon * development
rtd-requirements.txt pypi
  • sphinx_rtd_theme *
  • sphinxcontrib-napoleon *
.github/workflows/pre-commit.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • pre-commit/action v3.0.0 composite
setup.py pypi