python-sphinxautodocsphinx-apidoc

Setting up Sphinx Autodoc with existing project


I'm am completely new to Sphinx and have watched hours of tutorials, but could not find the answer to my issue

I have a current project structure like the following

-project folder
 |-sub folder 1
 | |- sub folder 1.a
 |    | - ...
 |-sub folder 2
 | |- sub folder 2.a
 |    | - ...
 |-sub folder 3
 | |- sub folder 3.a
 |    | - ...
 |- .py files
 |...
 |- conf.py
 |- index.rst
 |- Makefile
 |- _build/
 |  |-doctrees/
 |  |-html/
 |    |...(all the html files generated by "make html")

I have included the following in my conf.py

extensions = ['autoapi.extension']
# Document Python Code
autoapi_type = 'python'
autoapi_dir = '../project folder'

inside each of the sub folders i have .py files that contain classes, functions, modules, members that all need to be documented. Is there a way that sphinx will parse through the current project folder and all of its subdirectories in search for .py files to autodoc? If so, how would I have to set up my index.rst and conf.py file to make this happen?

The error I am seeing is as follows:

Removing everything under '_build'...
Running Sphinx v1.8.5  
making output directory...  

Extension error: 
You must configure an autoapi_dirs setting  
Makefile:19: recipe for target 'html' failed 
make: *** [html] Error 2 

Solution

  • The error is explicit: You must configure an autoapi_dirs setting. You have a typo in your conf.py setting, omitting the "s" in your setting autoapi_dir. See configuration value of autoapi_dirs for autoapi.