将特定方法或函数参数标记为在Sphinx中已弃用

问题描述

我正在使用Sphinx记录python 3类,并且该类中的某些方法具有不再使用的参数值。将这些标记为不推荐使用的参数的最佳方法是什么?有在线文档提到将整个方法标记为已弃用,但对于继续处于活动状态但其参数已更改的方法,我没有发现任何东西。在我的情况下,将这些参数标记为仅关键字可能会有所帮助。

添加:我正在声明这样的参数:

Some function description

:param bool param_a: If True,do something.
:param bool param_b: Deprecated since 0.2.4 - how should I mark this?
:return: An integer.
:rtype: int

解决方法

使用deprecated directive

.. deprecated:: 3.1
    Use ``arg`` instead.