Generate Python Auto Documentation using MkDocs Material

Viewed 21

I have recently started exploring automate code documentation using MkDocs.

When i perform mkdocs serve with main.py file, Mkdocs application is up and running at port 8000. But when i add a config_data.py to the MkDocs system application got stuck at DEBUG - mkdocstrings: Collecting data.

The following is the project structure.

src:.
|   main.py
|   mkdocs.yml
|   requirements.txt
|   __init__.py
|
\---docs
|       index.md
|       configdata.md
|   
\---utils
        config_data.py
        __init__.py

Following is the mkdocs.yml data

site_name: Docs
site_url: http://localhost:2022/

plugins:
  - search
  - mkdocstrings

theme:
  name: "material"

nav:
  - Home: index.md
  - Config Data: configdata.md

Following is the index.md file data:

::: main

Following is the configdata.md file data:

::: utils.config_data.ConfigData

But if i modify my project structure as following and run the mkdocs serve it is working fine.

src:.
    |   main.py
    |   mkdocs.yml
    |   config_data.py
    |   requirements.txt
    |   __init__.py
    |
    \---docs
            index.md
            configdata.md

So i come to know that my configuration is not correct for sub modules. Could you please help me to generate docs for the first shown project structure.

0 Answers
Related