/doc/plugins/documenting.rst

https://bitbucket.org/jpellerin/nose/ · ReStructuredText · 62 lines · 42 code · 20 blank · 0 comment · 0 complexity · 4b22128111312de886100ebd7070b1ac MD5 · raw file

  1. Documenting plugins
  2. ===================
  3. A parable. If a plugin is released on pypi without any documentation, does
  4. anyone care?
  5. To make it easy to document your plugins, nose includes a `Sphinx`_ extension
  6. that will automatically generate plugin docs like those for nose's builtin
  7. plugins. Simply add 'nose.sphinx.pluginopts' to the list of extensions in your
  8. conf.py::
  9. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx',
  10. 'nose.sphinx.pluginopts']
  11. Then in your plugin documents, include a title and the ``.. autoplugin``
  12. directive::
  13. My Cool Plugin
  14. ==============
  15. .. autoplugin :: package.module.with.plugin
  16. :plugin: PluginClass
  17. The ``:plugin:`` option is optional. In most cases, the directive will
  18. automatically detect which class in the named module is the plugin to be
  19. documented.
  20. The output of the directive includes the docstring of the plugin module, the
  21. options defined by the plugin, `autodoc`_ generated for the plugin class, and
  22. the plugin module source. This is roughly equivalent to::
  23. My Cool Plugin
  24. ==============
  25. .. automodule :: package.module.with.plugin
  26. Options
  27. -------
  28. .. cmdoption :: --with-coolness
  29. Help text of the coolness option.
  30. .. cmdoption ::
  31. Plugin
  32. -------
  33. .. autoclass :: package.module.with.plugin.PluginClass
  34. :members:
  35. Source
  36. ------
  37. .. include :: path/to/package/module/with/plugin.py
  38. :literal:
  39. Document your plugins! Your users might not thank you -- but at least you'll
  40. *have* some users.
  41. .. _`Sphinx` : http://sphinx.pocoo.org/
  42. .. _`autodoc`: http://sphinx.pocoo.org/ext/autodoc.html