Sphinx documentation: how to reference a Python property?

python, python-sphinx

Solution

You should use `:py:attr:` instead. This example works fine for me:

class SomeClass(object):
    """This is the docstring of SomeClass."""

    @property
    def some_property(self):
        """This is the docstring of some_property"""
        return None

    def some_method(self):
        """This is the docstring of some_method.

        And this is a reference to :py:attr:`~some_property`
        """

Problem

How can I reference a method, decorated with `@property`? For simple methods, `:py:meth:` is working fine, but not for properties: it does not create a link to them.

Original source