Debian Codegraph @

docs/dev/documenting_plugins.rst

raw
1 ===================
2 Documenting plugins
3 ===================
4
5 You should do it. Nobody will use your plugins if you don't. Or if
6 they do use them, they will curse you whenever things go wrong.
7
8 One easy way to document your plugins is to use nose2's `Sphinx`_
9 extension, which provides an ``autoplugin`` directive that will
10 produce decent reference documentation from your plugin classes.
11
12 To use it, add ``nose2.sphinxext`` to the ``extensions`` list in the
13 ``conf.py`` file in your docs directory.
14
15 Then add an ``autoplugin`` directive to a ``*.rst`` file, like this::
16
17 .. autoplugin :: mypackage.plugins.PluginClass
18
19 This will produce output that includes the config vars your plugin
20 loads in ``__init__``, as well as any command line options your plugin
21 registers. This is why you *really* should extract config vars and
22 register command-line options in ``__init__``.
23
24 The output will also include an ``autoclass`` section for your plugin
25 class, so you can put more narrative documentation in the plugin's
26 docstring for users to read.
27
28 Of course you can, and should, write some words before the reference
29 docs explaining what your plugin does and how to use it. You can put
30 those words in the ``*.rst`` file itself, or in the docstring of the module
31 where your plugin lives.
32
33 .. _Sphinx : http://sphinx.pocoo.org/