Reputation: 2210
I have nested folder structure library and the question is about generating documentation from the source-code files.
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
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
I have only one file generated mylib that lists 3 sub-directories as links
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