Сфинкс в Windows не создает документы для модулей - PullRequest
0 голосов
/ 09 ноября 2019

Я пытаюсь создать документы для своего проекта, используя sphinx. Моя структура проекта выглядит следующим образом.

Project_root
|-docs
  |-_build
  |-_static
  |-_template
  |-rst
  |-conf.py
  |-Makefile
  |-make.bat
  |-index.rst
|-modules
  |-__init__.py
  |-module1.py
  |-module2.py

Я получил эту настройку dir, запустив sphinx-quickstart в моем docs dir и modules dir содержит мои программные модели, которые нужны для создания документов. Файлы для создания автоматических документов имеют такую ​​же последовательность документов.

"""Class represent a sentence of a comment of a bug report

Parameters
----------
sentence_id : str
    sentence_id is a combination of turn_id and the sequence number
    (ex: 1.3 means turn 1 and 3rd sentence of the turn)
text : str
    orginal sentence text as appeared in the bug report
cleaned_text : str
    cleaned text after removing irrelevant characters, stop words,
    turning to lower case and lemmatizing
tags :list of str
    tags indicate the type of the sentence (description, clarification,
    plan, resolution) and/or picked by certain algorithm
"""

Я изменил путь в conf.py следующим образом.

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

Когда я запускаю sphinx-apidoc -o rst ..\models, он создает только модели.rst и modules.rst. Первого не было создано для module1.py и module2.py.

Интересно, что происходит с моей конфигурацией.

Редактировать: Я забыл добавить ` init .py в мое дерево каталогов.

1 Ответ

0 голосов
/ 10 ноября 2019

Попробуйте abspath('../'), потому что Python не заботится о обратной косой черте Windows для каталогов.

...