AppDeveloper
AppDeveloper

Reputation: 2210

Python generate documentation using pydoc

I have nested folder structure library and the question is about generating documentation from the source-code files.

Folder Structure

  mylib
    ├── foo 
          ├── __init__.py
    │     ├── Foo.py
    ├── bar
    │     ├── __init__py
    │     ├── Bar.py
    ├── baz
    │   ├── qux
    │   │   ├── file1.py
    │   │   ├── file2.py
    │   │   ├── file3.py
    │   │   ├── file4.py
    │   │   ├── file5.py
    │   │   └── __init__.py

Documentation

I was looking for a built-in solution (without downloading 3rd party plugins) to generate documentation for the python library and came across pydoc

Documentation: https://docs.python.org/3/library/pydoc.html

from the documentation I rant this source file

python3 -m pydoc mylib

Issue:

I have only one file generated mylib that lists 3 sub-directories as links

Code

as per the request, here's a sample of code file.

class Foo:
    """
    :class: Foo

    A base `Foo` implementation.
    """

    def __init__(self, name: str = None, data: Any = None):
        """
        Constructor

        :param name: The name of the foo. Defaults to None.
        :type name: str
        :param data: The data. Defaults to None.
        :type data: Any
        """
        super().__init__()
        self.name = name
        self.data = data

Upvotes: 0

Views: 90

Answers (0)

Related Questions