mkdocstrings / griffe

Signatures for entire Python programs. Extract the structure, the frame, the skeleton of your project, to generate API documentation or find breaking changes in your API.
https://mkdocstrings.github.io/griffe
ISC License
315 stars 44 forks source link

numpy: Cross-references for functions/classes signatures (docstring sections) #200

Open pawamoy opened 1 year ago

pawamoy commented 1 year ago

Support automatic cross-references for documented functions/methods and classes signatures through the corresponding docstring sections.

Boost priority

Fund with Polar

Simon-Bru commented 9 months ago

Not sure what you mean exactly , but I got cross-reference working in my docstring using the TOC entry. This part of the doc got me on the track : https://mkdocstrings.github.io/python/

image

Then I managed to reference a method of separate class in docstring using [Link Label][my_package.module.function]

Hope i'm not totally off subject and that can help

pawamoy commented 9 months ago

Thanks for helping!

Here's what I meant. In your docstrings, you can write sections to document available classes, functions or methods:

class Flags:
    ...

class A:
    """Class A.

    Methods
    -------
    method_a(value)
        Method a.
    method_b(flag=Flags.NONE, store=False)
        Method b.
    """
    def method_a(self, value: str):
        """Method a."""

    def method_b(self, flag: int, store: bool):
        """Method b."""

The goal here is to re-parse these signatures (method_a(value) and method_b(flag=Flags.NONE, store=False)), which are just text in the docstring, as Griffe expressions, which will allow the renderer to automatically add cross-references to the parameters (value maybe, flag and store for sure) or values (flags.None).