[Python] Sphinx autosummary - module name repeated instead of function names

Discussão em 'Python' iniciado por Stack, Abril 7, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using sphinx-build 7.4.7

    Python 3.9.11

    I'm trying the most basic build. Just a module with a file of functions. However, when I make the html and look at the module, the webpage has simply repeats the name of the module for each function

    my_package
    |--- utils
    |---- __init__.py
    |---- utils.py
    |--- docs
    |---- Makefile
    |---- build
    |---- make.bat
    |---- source
    |---- conf.py
    |---- index.rst
    |---- _static
    |---- _templates
    |---- custom-class-template.rst
    |---- custom-module-template.rst
    |---- layout.html


    conf.py
    --------------------
    import sys
    import os
    from pathlib import Path
    sys.path.insert(0, os.path.abspath('../..'))

    ....
    extensions = ['sphinx.ext.duration',
    'sphinx.ext.doctest',
    'sphinx.ext.autodoc',
    'sphinx.ext.autosummary',
    ....
    autosummary_generate = True

    templates_path = ['_templates']


    init.rst
    ---------------

    .. autosummary::
    :toctree: _autosummary
    :template: custom-module-template.rst
    :recursive:

    utils


    utils.py
    ---------

    """package utilities"""

    def get_name() :
    """
    Get name

    :returns: name
    """
    return(0)

    def get_type() :
    """
    Get type

    :returns: type
    """
    return(0)


    The web html output isn't what I expected. [​IMG]

    Any help is appreciated!

    Continue reading...

Compartilhe esta Página