Создание документации по Python Sphinx с использованием руководства по стилю Google - PullRequest
0 голосов
/ 24 ноября 2018

Я довольно новичок в Python и поэтому использовал руководства по стилю google (https://github.com/google/styleguide/blob/gh-pages/pyguide.md), чтобы получить красивый и чистый код. Теперь я столкнулся с проблемой, что я хочу создать документацию изэти комментарии для методов и модулей и выяснили, что Sphinx, по-видимому, является инструментом для его использования.

Кроме того, я обнаружил, что следующее расширение для Sphinx может быть использовано для создания документации из него с использованием Google Pythonруководство по стилю: https://www.sphinx -doc.org / ru / master / use / extensions / napoleon.html

Однако у меня не получается с двумя точками:

  1. Как мне включить это расширение для правильной работы?
  2. Как мне вызвать Sphinx, чтобы получить полную документацию о моих методах и модулях?
  3. (необязательно) Есть лиспособ интегрировать его в PyCharm (профессиональный)?

Ниже вы можете найти один из моих методов (только комментарии), для которых я пытаюсь сгенерировать документацию:

    def _get_lifecycle_environments(self: object) -> dict:
    """Gets all lifecycle environments
    Gets all lifecycle environment from the Satellite server

    Args:

    Returns:
        dict: The name and IDs of all lifecycle environments of the Satellite server. If there are no lifecycle
        environments an empty dictionary is returned.

        Example of a dict with lifecycle environments and their IDs:
            {
                'Library': 1,
                'lce-default-dev': 2,
                'lce-default-prod': 3,
                'lce-default-test': 4
            }

    Raises:
        RuntimeError: If the API call fails for some reason
        KeyError: If the expected key 'results' is not in the result
        KeyError: If the expected key 'name' is not in the result of a lifecycle environment or is None
        TypeError: If the expected key 'name' is not a string
        KeyError: If the expected key 'id' is not in the result of a lifecycle environment or is None
        TypeError: If the expected key 'id' is not a integer
    """
...