pythondocumentationpython-3.xdocumentation-generationpydoc

How do I create documentation with Pydoc?


I'm trying to create a document out of my module. I used pydoc from the command-line in Windows 7 using Python 3.2.3:

python "<path_to_pydoc_>\pydoc.py" -w myModule

This led to my shell being filled with text, one line for each file in my module, saying:

no Python documentation found for '<file_name>'

It's as if Pydoc's trying to get documentation for my files, but I want to autocreate it. I couldn't find a good tutorial using Google. Does anyone have any tips on how to use Pydoc?

If I try to create documentation from one file using

python ... -w myModule\myFile.py

it says wrote myFile.html, and when I open it, it has one line of text saying:

# ../myModule/myFile.py

Also, it has a link to the file itself on my computer, which I can click and it shows what's inside the file on my web browser.


Solution

  • As RocketDonkey suggested, your module itself needs to have some docstrings.

    For example, in myModule/__init__.py:

    """
    The mod module
    """
    

    You'd also want to generate documentation for each file in myModule/*.py using

    pydoc myModule.thefilename
    

    to make sure the generated files match the ones that are referenced from the main module documentation file.