728x90
반응형
SMALL
포괄적인 API 참조 생성 (Generating comprehensive API references)
sphinx.ext.autodoc를 사용하면 코드와 문서의 동기화를 훨씬 쉽게 유지할 수 있지만 auto* 문서화하려는 모든 개체에 대한 지시문을 작성해야 한다. Sphinx는 또 다른 수준의 자동화인 자동 요약 확장을 제공한다.
지시문은 autosummary필요한 모든 autodoc지시문을 포함하는 문서를 생성한다. 이를 사용하려면 먼저 자동 요약 확장을 활성화한다.
extensions = [
'sphinx.ext.duration',
'sphinx.ext.doctest',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
]
api.rst다음 으로 다음 내용으로 새 파일을 만든다.
API
===
.. autosummary::
:toctree: generated
lumache
루트 toctree에 새 문서를 포함해야 한다.
Contents
--------
.. toctree::
usage
api
마지막으로 실행 중인 HTML 문서를 빌드하면 두 개의 새 페이지가 포함된다.
|
요약 페이지의 각 링크는 해당 autodoc지시문을 원래 사용했던 위치 (이 경우 usage.rst문서에서)로 이동한다.
Automatic documentation generation from code — Sphinx documentation
Automatic documentation generation from code In the previous section of the tutorial you manually documented a Python function in Sphinx. However, the description was out of sync with the code itself, since the function signature was not the same. Besides,
www.sphinx-doc.org
728x90
반응형
LIST
'Python Library' 카테고리의 다른 글
[Sphinx] Sphinx 프로젝트 온라인 배포 (2) (0) | 2022.05.02 |
---|---|
[Sphinx] Sphinx 프로젝트 온라인 배포 (1) (0) | 2022.05.02 |
[Sphinx] 코드에서 자동 문서 생성 (1) (0) | 2022.05.02 |
[Sphinx] Describing code in Sphinx (Other languages) (2) (0) | 2022.05.02 |
[Sphinx] Describing code in Sphinx (Python) (1) (0) | 2022.05.02 |