haystack icon indicating copy to clipboard operation
haystack copied to clipboard

docs: Add inherited methods to API reference documentation

Open bogdankostic opened this issue 2 years ago • 3 comments

Related Issues

  • fixes #4598

Proposed Changes:

This PR adds the custom loader CustomPythonLoader for pydoc-markdown and sets it as the loader for all documentation config files. CustomPythonLoader extends PythonLoader in such a way that the loaded classes not only contain the methods that are directly defined in them, but also their inherited methods from parent classes. The inherited methods are added recursively to make sure to display methods from all inheritance levels, not just direct inheritance.

As an example, here is the generated file for DocumentStore API docs: document_store_api.md

How did you test it?

I manually ran the pydoc-markdown.sh script.

Notes for the reviewer

There was a formatting error in Pipeline.run docstring, so I needed to fix that.

Checklist

bogdankostic avatar Jul 04 '23 16:07 bogdankostic

Pull Request Test Coverage Report for Build 5456810715

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 43.864%

Totals Coverage Status
Change from base Build 5454588927: 0.0%
Covered Lines: 10094
Relevant Lines: 23012

💛 - Coveralls

coveralls avatar Jul 04 '23 16:07 coveralls

Let's just figure out if we want to use this opportunity to hide abstract classes/methods and avoid duplication...

I would tackle this in a separate PR.

bogdankostic avatar Jul 05 '23 12:07 bogdankostic

Let's wait until @dfokina is back to get her view on this topic.

bogdankostic avatar Jul 06 '23 07:07 bogdankostic

This is how the DocumentStore API docs would look like if we would merge this PR now: document_store_api.md

bogdankostic avatar Aug 02 '23 15:08 bogdankostic