수색…


비고

이 섹션은 파이썬 - 스핑크스가 무엇인지, 왜 개발자가 그것을 사용하고 싶어하는지에 대한 개요를 제공합니다.

또한 파이썬 - 스핑크스 내의 큰 주제를 언급하고 관련 주제에 링크해야합니다. python-sphinx에 대한 문서는 새로운 것이므로 관련 주제의 초기 버전을 만들어야 할 수도 있습니다.

설치 또는 설정

SphinxPython Package Index 에서 사용할 수 있으므로 pip를 사용하여 설치할 수 있습니다.

pip install Sphinx

또는 easy_install을 사용하여 설치할 수도 있습니다.

easy_install -U sphinx

그런 다음 다음 명령을 실행하여 올바르게 설치되었는지 확인할 수 있습니다.

> sphinx-quickstart --version
Sphinx v1.4.1

계속 진행하기 전에 파이썬 PEP 8의 특정 코드 스타일을 따라야합니다. PEP 8 가이드 라인을 준수했다면 스핑크스에서 문서 구조정의하고 문서 작성을 시작할 수 있습니다 .

빠른 시작

시작하려면 프로젝트 디렉토리의 루트로 가서 다음을 실행하십시오 :

$ sphinx-quickstart

프로젝트의 문서를 만들 수있는 옵션이 제공됩니다. 기본 설정의 경우 다음 명령을 따르십시오.

Prompt    Choice
> Root path for the documentation [.]:    <ENTER>
> Separate source and build directories (y/N) [n]:    y
> Name prefix for templates and static dir [_]:    <ENTER>
> Project name:    an_example_pypi_project
> Author name(s):    Andrew Carter
> Project version:    0.0.1
> Project release [0.0.1]:    <ENTER>
> Source file suffix [.rst]:    <ENTER>
> Name of your master document (without suffix) [index]:    <ENTER>
> autodoc: automatically insert docstrings from modules (y/N) [n]:    y
> doctest: automatically test code snippets in doctest blocks (y/N) [n]:    n
> intersphinx: link between Sphinx documentation of different projects (y/N) [n]:    y
> todo: write “todo” entries that can be shown or hidden on build (y/N) [n]:    n
> coverage: checks for documentation coverage (y/N) [n]:    n
> pngmath: include math, rendered as PNG images (y/N) [n]:    n
> jsmath: include math, rendered in the browser by JSMath (y/N) [n]:    n
> ifconfig: conditional inclusion of content based on config values (y/N) [n]:    y
> Create Makefile? (Y/n) [y]:    n
> Create Windows command file? (Y/n) [y]:    n

성공적으로 실행되면 프로젝트의 doc / source 디렉토리에있는 config.py 파일을 발견 할 수 있습니다. 이 파일은 아래와 같이 빌드 명령을 실행할 때 문서 생성 방법의 기본 구조를 제어합니다.

$ sphinx-build -b html sourcedir builddir

자세한 안내는 https://pythonhosted.org/an_example_pypi_project/sphinx.html을 참조하십시오.



Modified text is an extract of the original Stack Overflow Documentation
아래 라이선스 CC BY-SA 3.0
와 제휴하지 않음 Stack Overflow