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.
Another thing that people may find useful...make sure to leave off ".py" from your module name. For example, if you are trying to generate documentation for 'original' in 'original.py':
As RocketDonkey suggested, your module itself needs to have some docstrings.
For example, in
myModule/__init__.py
:You'd also want to generate documentation for each file in
myModule/*.py
usingto make sure the generated files match the ones that are referenced from the main module documentation file.
pydoc is fantastic for generating documentation, but the documentation has to be written in the first place. You must have docstrings in your source code as was mentioned by RocketDonkey in the comments:
The first docstring provides instructions for creating the documentation with pydoc. There are examples of different types of docstrings so you can see how they look when generated with pydoc.
use pydoc.doc() can show docstring, can be class, module, etc.