13

I want to generate documentation for my package. Every file in the project contains extensive documentation. Is there a way to quickly add my entire project to the documetation index?

I'd like to automatically generate some documentation for the entire project with as little as possible work. I started by adding the following to index.rst:

.. automodule:: mymodulename
    :members:

All that seems to have done is document elenments in the __init__.py file (just a docstring) - is there any way I can make it document everything else? I'm looking to add absolutely everything defined in my package and have every single class, constant, function (etc) in the package be added to the appropriate index.

Can this be done?

filmor
  • 30,840
  • 6
  • 50
  • 48
Salim Fadhley
  • 22,020
  • 23
  • 75
  • 102

1 Answers1

19

You can use sphinx-apidoc.
From the official documentation: sphinx-apidoc is a tool for automatic generation of Sphinx sources that, using the autodoc extension, document a whole package in the style of other automatic API documentation tools.

An usage example could be (from your project root directory):

$ sphinx-apidoc . --full -o doc -H 'MyProject' -A 'MyName' -V '1.0'

A doc directory would be created with everything ready inside.
You can also adjust the settings of your documentation editing the auto-generated conf.py file.

Other useful information can be found in similar question posted here.

bad_coder
  • 11,289
  • 20
  • 44
  • 72
Rik Poggi
  • 28,332
  • 6
  • 65
  • 82