斯芬克斯部分生成文档

2024-04-25 00:08:29 发布

您现在位置:Python中文网/ 问答频道 /正文

作为make html命令的结果,Sphinx只为一些模块生成文档。其他模块仍然没有记录在案。你知道吗

项目结构:

|- my-project
|--| my_project
|--| docs
|----| _build
|------| ...
|----| _static
|------| ...
|----| _templates
|------| ...
|---- conf.py
|---- index.rst
|---- Makefile
|---- source
|-----| modules.rst
|-----| ...

conf.py

import os
import sys
sys.path.insert(0, os.path.abspath('../'))
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.autosummary',
    'sphinx.ext.viewcode',
    'sphinx.ext.napoleon',
]
autosummary_generate=True
source_suffix = '.rst'

index.rst

.. toctree::
   :maxdepth: 2
   :caption: Contents:

   ./source/modules


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

source/modules.rst

my_project
==========

.. toctree::
   :maxdepth: 4

   my_project

请考虑查看github上的源代码:https://github.com/mxmaslin/Test-tasks/tree/removeme/tests_python/my-project


Tags: 模块pyimportprojectrefmodulessourceindex