Skip to content

Using base class docstring does not work for properties #4126

@kvalev

Description

@kvalev

Subject: Docstring for Python properties that do not have one should be inherited from the same property in the parent class.

Problem

I checked out the latest Sphinx version to test out the generation of docstrings for methods and properties that do not have one declared explicitly, but there is one in the base class (#3140). It seems that the docstring generation works for methods, but it does not for properties

Expected results

That both methods and properties inherit their documentation from the respective property/method in the parent class (currently only methods does so).

Reproducible project / your project

class Base(object):
    @property
    # it does not work with or without the abstractmethod decorator
    #@abc.abstractmethod
    def my_property(self):
        """int: Some value"""
        raise NotImplementedError

    def my_method(self):
        """My method that does nothing"""
        raise NotImplementedError

class Ext(Base):
    @property
    def my_property(self):
        return 0

    def my_method(self):
        pass

Environment info

  • OS: macOS
  • Python version: 2.7.13
  • Sphinx version: Sphinx-1.7.dev20171008

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions