PyDoc: How to exclude from x import * objects?

Mike C. Fletcher mcfletch at home.com
Wed Jul 4 07:21:55 EDT 2001


I know, I know, terribly rude to respond to my own post...  I wound up
putting together something to get the PyOpenGL documentation to basically
work, likely wind up doing a CSS/style based formatter eventually, but for
now I can at least generate the entire documentation set fairly easily.

class PackageDocumentationGenerator:
	"""A package document generator creates documentation
	for an entire package using pydoc's machinery.

	baseModules -- modules which will be included
		and whose included and children modules will be
		considered fair game for documentation
	destinationDirectory -- the directory into which
		the HTML documentation will be written
	recursion -- whether to add modules which are
		referenced by and/or children of base modules
	exclusions -- a list of modules whose contents will
		not be shown in any other module, commonly
		such modules as OpenGL.GL, wxPython.wx etc.
	recursionStops -- a list of modules which will
		explicitly stop recursion (i.e. they will never
		be included), even if they are children of base
		modules.
	formatter -- allows for passing in a custom formatter
		see DefaultFormatter for sample implementation.
	"""
	def __init__ (
		self, baseModules, destinationDirectory = ".",
		recursion = 1, exclusions = (),
		recursionStops = (),
		formatter = None
	):


For sample of generating documentation for the PyOpenGLSWIG and
OpenGLContext projects (there are modules that fail, but 101 documents do
get generated, and the rest seem to be modules which will not properly
import due to code in them which assumes they are always run as scripts...

if __name__ == "__main__":
	excludes = [
		"OpenGL.GL",
		"OpenGL.GLU",
		"OpenGL.GLUT",
		"OpenGL.GLE",
		"OpenGL.GLX",
		"wxPython.wx",
		"Numeric",
		"_tkinter",
		"Tkinter",
	]

	modules = [
		"OpenGLContext",
		"wxPython.glcanvas",
		"OpenGL.Tk",
		"OpenGL",
	]
	PackageDocumentationGenerator(
		baseModules = modules,
		destinationDirectory = "z:\\temp",
		exclusions = excludes,
	).process ()


If anyone else is interested, give me a shout and I'll see about packaging
it up.  Nice little system Ka-Ping Lee, very cool results for a single
evening's fooling about.  I'm thinking that a system that allowed for such
things as generating css code that collapsed inherited methods would be cool
as well.

Enjoy yourselves,
Mike


-----Original Message-----
From: python-list-admin at python.org
[mailto:python-list-admin at python.org]On Behalf Of Mike C. Fletcher
Sent: July 4, 2001 00:32
To: Python List (E-mail)
Subject: PyDoc: How to exclude from x import * objects?
...
<me kvetching and being too lazy to sit down and do the work>
...





More information about the Python-list mailing list