PyDoc
Next, let's generate some webpages. In the directory with the file, run the following at the standard command prompt:
pydoc -w docs
(NB: note without the .py)
This should produce a docs.html file. Drag it into a web browser to view it. Look at how the program has converted different positions in the documentation into
details on the webpage. A few things have been added. Note that the modules imported have been listed, and the class Calc
notes that it inherits from the generic
class builtins.object
, which is what most invisibly inherit. Note also that PyDoc runs through a module when it imports it to find out what is in it. In practice this means that
any code outside the functions will be run, and you'll notice that PyDoc
has inserted a list of the variables generated at the bottom of the page.
However, the main issue with PyDoc pages, good though they are for a quick look at complicated files, is that they aren't very attractive or easy to navigate. Therefore most people use other documentation generators (list. Probably the most popular is Sphinx.