简体   繁体   中英

Do I have to run sphinx-apidoc for each new module (file)?

Trying to get familiar with Sphinx, I am used to documentation using Doxygen where it auto generates stubs and classes from your source.

With Sphinx it seems for each new module/file I have to run sphinx-apidoc -o dir dir just like you have to git add file in git, is this standard or is there a setting flag I am missing.

I know I can automate a bash/bat file to do run each command in sequence. I am curious if I am doing something wrong.

Just in case someone asks I do have those extensions turned on and imported the local path.

conf.py

import os
import sys
sys.path.insert(0, os.path.abspath('.'))
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.coverage',
    'sphinx.ext.viewcode',
]

You don't have to run sphinx-apidoc for each file.

sphinx-apidoc generates source files that use sphinx.ext.autodoc to document all found modules. sphinx-apidoc-manual-page

so if your project is organized as standard python modules, which basically means you've added __init__.py file in each module folder. sphinx-apidoc should find them automatically.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM