代码之家  ›  专栏  ›  技术社区  ›  ted

斯芬克斯API文档未将包放在一起

  •  0
  • ted  · 技术社区  · 6 年前

    背景

    我的代码具有以下结构:

    .
    └── my_package
        ├── __init__.py
        ├── classif
        │   ├── __init__.py
        │   ├── inference.py
        │   └── models.py
        ├── datasets
        │   ├── __init__.py
        │   └── datasets.py
        └── matching
            ├── __init__.py
            ├── elastic.py
            └── search.py
    

    A之后 sphinx-quickstart autodoc )我跑了 sphinx-apidoc 如下:

    sphinx-apidoc -f -o source my_package -e -M
    

    我现在有以下文件:

    .
    ├── Makefile
    ├── build
    ├── my_package
    │   ├── __init__.py
    │   ├── __pycache__
    │   ├── classif
    │   ├── datasets
    │   └── matching
    └── source
        ├── _static
        ├── _templates
        ├── conf.py
        ├── index.rst
        ├── modules.rst
        ├── my_package.classif.inference.rst
        ├── my_package.classif.models.rst
        ├── my_package.classif.rst
        ├── my_package.datasets.datasets.rst
        ├── my_package.datasets.rst
        ├── my_package.matching.elastic.rst
        ├── my_package.matching.rst
        ├── my_package.matching.search.rst
        └── my_package.rst
    

    我也修改了 conf.py 要添加:

    import os
    import sys
    sys.path.insert(0, os.path.abspath('.'))
    sys.path.insert(0, os.path.abspath('..'))
    

    并添加了 modules index.rst :

    .. toctree::
       :maxdepth: 2
       :caption: Contents:
    
       modules
    
    # [more lines]
    

    现在是问题所在

    运行后 make clean ; make html 我收到警告:

    /path/to/my_package.classif.rst: WARNING: document isn't included in any toctree
    /path/to/my_package.datasets.rst: WARNING: document isn't included in any toctree
    /path/to/my_package.matching.rst: WARNING: document isn't included in any toctree
    

    这是有道理的 Sphinx Apidoc没有在 my_package.rst . 我怎么解决这个问题?

    1 回复  |  直到 6 年前
        1
  •  0
  •   ted    6 年前