473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

What tools are used to write and generate Python Librarydocumentation.

I have a module I'd like to document using the same style...

Thanks,
Ken
Sep 27 '05 #1
9 1731
Do you think of pydoc? Just make comments in your code this way:

def add10(x):
"""this function adds ten to the given variable"""

Then save this into add.py and now (in the same directory):

pydoc add

Voila, your documentation.

Sep 27 '05 #2
Unfortunately, none of the documentation tools that use documentation
strings are suitable for full, serious documentation. There are a
number of reasons for this, and I'll touch on a few.

The obvious one is that there is no standard format for docstrings,
and this creates problems when trying to achieve a uniform look
across python documentation.

More seriously, there is a major problem with docstrings in that they
can only document something that has a docstring; classes, functions,
methods, and modules. But what if I have constants that are
important? The only place to document them is in the module
docstring, and everything else--examples, concepts, and so on--must
be thrown in there as well. But there are no agreed on formats and
processing pipelines that then allow such a large module docstring,
plus other docstrings, to produce a good final document.

I do tech writing for a living, so I have some idea of what I'm
talking about, I think :-)

It's too bad that there is no equivalent of d'oxygen for Python. That
is a _nice_ program.
Thanks for the advice,
Ken
On Sep 27, 2005, at 1:21 AM, beza1e1 wrote:
Do you think of pydoc? Just make comments in your code this way:

def add10(x):
"""this function adds ten to the given variable"""

Then save this into add.py and now (in the same directory):

pydoc add

Voila, your documentation.

--
http://mail.python.org/mailman/listinfo/python-list


Sep 27 '05 #3
Kenneth McDonald wrote:
More seriously, there is a major problem with docstrings in that they
can only document something that has a docstring; classes, functions,
methods, and modules. But what if I have constants that are
important? The only place to document them is in the module
docstring, and everything else--examples, concepts, and so on--must
be thrown in there as well. But there are no agreed on formats and
processing pipelines that then allow such a large module docstring,
plus other docstrings, to produce a good final document.
fwiw, that's one of reason why I developed PythonDoc (which supports
JavaDoc-style documentation for all the usual suspects, but also for con-
stants, attributes, and variables)
It's too bad that there is no equivalent of d'oxygen for Python. That
is a _nice_ program.


doesn't doxygen support Python?

</F>

Sep 27 '05 #4
Fredrik Lundh wrote:
Kenneth McDonald wrote:
More seriously, there is a major problem with docstrings in that they
can only document something that has a docstring; classes, functions,
methods, and modules. But what if I have constants that are
important? The only place to document them is in the module
docstring, and everything else--examples, concepts, and so on--must
be thrown in there as well. But there are no agreed on formats and
processing pipelines that then allow such a large module docstring,
plus other docstrings, to produce a good final document.


fwiw, that's one of reason why I developed PythonDoc (which supports
JavaDoc-style documentation for all the usual suspects, but also for con-
stants, attributes, and variables)


The one thing I dislike about PythonDoc is that it puts everything into
comments and thus docstrings are usually neglected. I spend my entire
work day at an ipython shell, which makes querying docstrings very easy.

In [1]: set?
Type: type
Base Class: <type 'type'>
String Form: <type 'set'>
Namespace: Python builtin
Docstring:
set(iterable) --> set object

Build an unordered collection.

It disappoints me when I have to go open the ElementTree documentation
instead of querying the methods themselves.

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter

Sep 27 '05 #5
You get to spend all day in ipython?

Can I have your job?

Sep 27 '05 #6
On Sep 27, 2005, at 12:45 PM, Kenneth McDonald wrote:
It's too bad that there is no equivalent of d'oxygen for Python. That
is a _nice_ program.


I've been using epydoc (http://epydoc.sourceforge.net) for a while now,
and it's really nice. The output is very much in the style of Javadoc.
Its markup language lets you document module, class, and instance
variables and constants by mentioning them in the module or class's
docstring. It has its own markup languge (very JavaDoc-ish), but it
also supports JavaDoc and reStructuredText syntax.

- Michael

Sep 27 '05 #7
Robert Kern wrote:
The one thing I dislike about PythonDoc is that it puts everything into
comments and thus docstrings are usually neglected.


teaser:
from elementtree import ElementTree
help(ElementTree) Help on module ElementTree:

NAME
ElementTree

DESCRIPTION
# ElementTree
# $Id: ElementTree.py 2324 2005-03-16 15:49:27Z fredrik $
#
# light-weight XML support for Python 1.5.2 and later.
...

CLASSES
Element
ElementTree
QName
TreeBuilder
XMLParser
iterparse

class Element
| Methods defined here:
|
| __delitem__(self, index)
|
| __delslice__(self, start, stop)
|
| __getitem__(self, index)
|
| __getslice__(self, start, stop)
...
import pythondoc
help(ElementTree)

Help on module ElementTree:

NAME
ElementTree

DESCRIPTION
The Element type is a flexible container object, designed to
store hierarchical data structures in memory.

CLASSES
Element
ElementTree
QName
TreeBuilder
XMLParser
iterparse

class Element
| Element class.
|
| Methods defined here:
|
| __delitem__(self, index)
| Deletes the given subelement.
|
| __delslice__(self, start, stop)
| Deletes a number of subelements.
|
| __getitem__(self, index)
| Returns the given subelement.
|
| __getslice__(self, start, stop)
| Returns a list containing subelements in the given range.
...

now, if I could only motivate myself to write a PEP on adding a __help__
hook to pydoc, so that the "help" command can be taught to do this all by
itself...

</F>

Sep 27 '05 #8
Brett Hoerner wrote:
You get to spend all day in ipython?

Can I have your job?


Well, I use the terms "work" and "day" rather loosely. I'm a graduate
student in geophysics. Somehow it rarely happens during daylight hours
and quite possibly wouldn't be called working by an outside observer.

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter

Sep 27 '05 #9
Kenneth McDonald wrote:
I have a module I'd like to document using the same style...


The Python Library documentation is written in LaTeX and converted to
HTML with latex2html. The relevant style and source files are in the
Python CVS tree.

Reinhold
Sep 28 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
54
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO...
11
by: Leo | last post by:
hi there for somebody who wants tostart small/medium GUI apps with python: what's the best toolkit: tkinter, wxPython or what? stability, ease of use and portability between mac and windows...
3
by: Chris Cioffi | last post by:
I started writing this list because I wanted to have definite points to base a comparison on and as the starting point of writing something myself. After looking around, I think it would be a...
137
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very...
28
by: john_sips_tea | last post by:
Just tried Ruby over the past two days. I won't bore you with the reasons I didn't like it, however one thing really struck me about it that I think we (the Python community) can learn from. ...
23
by: Xah Lee | last post by:
The Concepts and Confusions of Pre-fix, In-fix, Post-fix and Fully Functional Notations Xah Lee, 2006-03-15 Let me summarize: The LISP notation, is a functional notation, and is not a...
1
by: jmalone | last post by:
I have a python script that I need to freeze on AIX 5.1 (customer has AIX and does not want to install Python). The python script is pretty simple (the only things it imports are sys and socket)....
0
by: =?iso-8859-1?q?KLEIN_St=E9phane?= | last post by:
Hi, I've looked http://www.umlgraph.org/ tools. I think it's great to generate UML Diagram from source code and comment's. I read there are "Python version" of this tools : PyUMLGraph...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.