Doxygen (python) 忽略模块文档字符串

发布于 2025-01-12 05:15:37 字数 1767 浏览 2 评论 0原文

我还通过 Doxygen (1.9.1) 从文档字符串生成 Python 代码的文档与 doxypypy (从今天开始的 git 版本)。

我的问题是 a 的文档字符串没有出现在生成的 HTML 中。这是一个示例

# -*- coding: utf-8 -*-
"""This is mypackage.a
"""
import mypackage


def bar(bar):
    """
    This is the function named bar.

    The function calls `mypackage.foo()` and returns an 'a'.

    Paramters:
        bar (str): Just a parameter.

    Returns:
        str: Just an 'a'.
    """
    mypackage.foo(bar)
    return('a')

函数 bar() 在 Doxygen HTML 输出中有详细记录。但是该 py 文件第二行中的字符串 This is mypackage.a 没有出现在任何地方。

Doxyfile 相当大,所以我只向您展示我使用的一些选项。

BRIEF_MEMBER_DESC      = YES
REPEAT_BRIEF           = YES
ALWAYS_DETAILED_SEC    = NO
FULL_PATH_NAMES        = YES
JAVADOC_AUTOBRIEF      = NO
PYTHON_DOCSTRING       = YES
OPTIMIZE_OUTPUT_FOR_C  = NO
OPTIMIZE_OUTPUT_JAVA   = YES
OPTIMIZE_FOR_FORTRAN   = NO
OPTIMIZE_OUTPUT_VHDL   = NO
OPTIMIZE_OUTPUT_SLICE  = NO
MARKDOWN_SUPPORT       = YES
EXTRACT_ALL            = YES
EXTRACT_PRIVATE        = YES
EXTRACT_PACKAGE        = YES
EXTRACT_STATIC         = YES
EXTRACT_LOCAL_CLASSES  = YES
EXTRACT_LOCAL_METHODS  = YES
EXTRACT_ANON_NSPACES   = NO
RESOLVE_UNNAMED_PARAMS = YES
HIDE_UNDOC_MEMBERS     = NO
HIDE_UNDOC_CLASSES     = NO
HIDE_FRIEND_COMPOUNDS  = NO
HIDE_IN_BODY_DOCS      = NO
INPUT                  = ../src/mypackage
FILE_PATTERNS          =
RECURSIVE              = YES
FILTER_PATTERNS        = *.py=./py_filter
GENERATE_HTML          = YES

使用 FILTER_PATTERNS 是因为 doxypypy。但如果我不使用这个过滤器,也会出现这个问题。所以我认为这个问题与 doxypypy 无关。

I generate the documentation of my Python code from the docstrings via Doxygen (1.9.1) in addition with doxypypy (git version from today).

My problem is that the docstrings of a do not appear in the generated HTML. This is an example

# -*- coding: utf-8 -*-
"""This is mypackage.a
"""
import mypackage


def bar(bar):
    """
    This is the function named bar.

    The function calls `mypackage.foo()` and returns an 'a'.

    Paramters:
        bar (str): Just a parameter.

    Returns:
        str: Just an 'a'.
    """
    mypackage.foo(bar)
    return('a')

The function bar() is well documented in Doxygen HTML ouptut. But the String This is mypackage.a from the second line of that py-file do not appear anywhere.

The Doxyfile is quite big so I just show you a selection of the options I use.

BRIEF_MEMBER_DESC      = YES
REPEAT_BRIEF           = YES
ALWAYS_DETAILED_SEC    = NO
FULL_PATH_NAMES        = YES
JAVADOC_AUTOBRIEF      = NO
PYTHON_DOCSTRING       = YES
OPTIMIZE_OUTPUT_FOR_C  = NO
OPTIMIZE_OUTPUT_JAVA   = YES
OPTIMIZE_FOR_FORTRAN   = NO
OPTIMIZE_OUTPUT_VHDL   = NO
OPTIMIZE_OUTPUT_SLICE  = NO
MARKDOWN_SUPPORT       = YES
EXTRACT_ALL            = YES
EXTRACT_PRIVATE        = YES
EXTRACT_PACKAGE        = YES
EXTRACT_STATIC         = YES
EXTRACT_LOCAL_CLASSES  = YES
EXTRACT_LOCAL_METHODS  = YES
EXTRACT_ANON_NSPACES   = NO
RESOLVE_UNNAMED_PARAMS = YES
HIDE_UNDOC_MEMBERS     = NO
HIDE_UNDOC_CLASSES     = NO
HIDE_FRIEND_COMPOUNDS  = NO
HIDE_IN_BODY_DOCS      = NO
INPUT                  = ../src/mypackage
FILE_PATTERNS          =
RECURSIVE              = YES
FILTER_PATTERNS        = *.py=./py_filter
GENERATE_HTML          = YES

The FILTER_PATTERNS is used because of doxypypy. But the problem also occurs if I do not use this filter. So I would assume this problem is not related to doxypypy.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌上青苔 2025-01-19 05:15:37

有点晚了。尝试以下文档字符串。它只需要!在引号之后被 doxygen 拾取。使用@param和@return获取生成文档​​中的参数和返回值高亮显示。

def bar(bar):
    """!
    This is the function named bar.

    The function calls `mypackage.foo()` and returns an 'a'.

    @param bar (str): Just a parameter

    @return str: just an 'a'

    str: Just an 'a'.
    """
    mypackage.foo(bar)
    return('a')

A bit late. Try the following docstring. It just needs the ! after the quotes to get picked up by doxygen. Use @param and @return to get the parameter and return value highlights in the generated document.

def bar(bar):
    """!
    This is the function named bar.

    The function calls `mypackage.foo()` and returns an 'a'.

    @param bar (str): Just a parameter

    @return str: just an 'a'

    str: Just an 'a'.
    """
    mypackage.foo(bar)
    return('a')
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文