Sphinx autodoc集成了装饰属性

neu*_*ino 6 python sqlalchemy properties decorator python-sphinx

我开始使用Sphinx来记录我的sqlalchemy驱动的应用程序.

SA在属性操作中的一个典型用法是使用hybrid-property装饰器.

现在我的问题是我没有获得doc条目name:

class User(GeneralTable):
    '''User'''
    ...
    @hybrid_property
    def name(self):
        '''
        User name

        :rtype: unicode
        '''
        if self._name is None:
            return 'anonymous'
        else:
            return self._name

    @name.setter
    def name(self, name):
        '''
        :type name: unicode
        '''
        self._name = name
Run Code Online (Sandbox Code Playgroud)

hybrid_property改为标准时,property我会记录下来.

有没有办法扩展Sphinx采用hybrid_property相同的property行为?

我目前的解决方法是.. attribute::User类doc中添加一个名称条目.