文档

这是用生成的pyglet文档 Sphinx

详细信息:

日期

2024/04/02 18:33:19

pyglet版

2.0.15

备注

请参阅 Sphinx warnings log file 对于错误。

编写文档

熟悉你自己 SphinxreStructuredText

文学

首页是 pyglet/doc/index.rst 。此文件创建三个目录树:

  • 编程指南

  • API文档

  • 您现在正在阅读的开发指南

源代码

API文档通过以下方式从源代码文档字符串生成 autodoc 和一些定制的扩展。

示例:
class Class1():
'''Short description.

Detailed explanation, formatted as reST.
Can be as detailed as it is needed.

:Ivariables:
   `arg1`
       description

.. versionadded:: 1.2

'''

attribute1 = None
'''This is an attribute.

More details.
'''

#: This is another attribute.
attribute2 = None

def __init__(self):
    '''Constructor

    :parameters:
       `arg1` : type
          description
    '''

    self.instance_attribute = None
    '''This is an instance attribute.
    '''

def method(self):
    '''Short description.

    :returns: return description
    :rtype: returned type
    '''

def _get_property1(self):
    '''Getter Method contains docstrings for a property

    :return: property1 value
    :rtype: property1 type
    '''

def _set_property1(self, value):
    '''Setter Method docstrings are ignored
    '''

property1 = property(_get_property1, _set_property1,
                  doc='''Override docstring here if you want''')

小矮人对贬低有特殊的作用, :deprecated:

来源

输出

:deprecated: Do not use

警告

已弃用。不要使用

建房

可以使用以下命令生成完整的文档 sphinx 。确保按照中所述准备您的环境 开发环境

要构建文档,请执行::

./make.py docs --open

备注

由于Sphinx中的错误,文档生成目前只能使用Python3.x。

如果构建成功,则网页位于 doc/_build/html

或者,构建文档的独立方法是通过 setup.pymake

# using setup.py (output dir: _build in project root)
python setup.py build_sphinx

# make (make.bat for windows)
cd doc
make html

超文本标记语言主题

备注

自定义主题在2019年被禁用,取而代之的是标准的Read the Docs主题 sphinx_rtd_theme

自定义狮身人面像主题位于 ext/theme 文件夹。