This is the pyglet documentation, generated with Sphinx.


Date 2018/04/13 15:14:34
pyglet version 1.3.2


See the Sphinx warnings log file for errors.

Writing documentation

Familiarize yourself with Sphinx and reStructuredText.


The home page is pyglet/doc/index.rst. This file create three toctrees:

  • The programming guide
  • The API docs
  • The development guide, which you are reading now

Source code

The API documentation is generated from the source code docstrings via autodoc and a few custom extensions.

class Class1():
'''Short description.

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


.. versionadded:: 1.2


attribute1 = None
'''This is an attribute.

More details.

#: This is another attribute.
attribute2 = None

def __init__(self):

       `arg1` : type

    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''')

Pyglet has a special role for deprecations, :deprecated:.

Source Output
:deprecated: Do not use


Deprecated. Do not use


The complete documentation can be generated using sphinx. Make sure you prepare your environment as stated in Development environment.

To build the documentation, execute:

./ docs


Due to a bug in Sphinx, documentation generation currently only works using Python 3.x.

If the build succeeds, the web pages are in doc/_build/html.

HTML Theme

The custom sphinx theme is in the ext/theme folder.