[Epydoc-devel] epydoc 2.1 can't handle PyGetSetDefs?
Brought to you by:
edloper
From: Barry W. <ba...@py...> - 2006-07-10 21:12:45
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi all, I've just started to use epydoc 2.1 to document the API for a tool that has a lot of Python code but is also extended/embedded. In general, it seems like a great tool and is producing nice output with the Epytext markup. Nice job! I've had a few minor problems along the way, and some ideas that I'll share later, but I wanted to ask a quick question for my current blocker. It appears that epydoc cannot handle class attributes defined in extension modules with PyGetSetDef. We define almost all of our attributes this way and all I get are things like getset_descriptor | alias_limit = <attribute 'alias_limit' of '...' This even though alias_limit's PyGetSetDef structure contains a docstring and in fact you can get the __doc__ of that descriptor just fine. I think you can prove this to yourself with standard Python 2.4 with the following: >>> from epydoc.html import HTMLFormatter >>> import array >>> HTMLFormatter.format(array.array.typecode) Now, at this point you'll get an exception because the TypeError uses a local variable before its assignment. Okay, that's easily fixed (use type(object) instead of type(link) on line 3381 of epydoc/ html.py). But that just means you'll get the TypeError that was intended: TypeError: You must use a Link or UID object to specify a getset_descriptor which I think indicates that epydoc 2.1 doesn't know how to handle PyGetSetDefs. I haven't dug into epydoc enough to figure out what needs to be changed in order to handle these built-in Python objects. If you have any hints, I'd love to hear them! I wonder if the problem isn't in inspect or pydoc since the interactive prompt's help() doesn't much like these objects either. Try >>> import array >>> help(array.array.typecode) to see the docstring ignoring help output. Thoughts? Clues? Thanks! - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (Darwin) iQCVAwUBRLLCw3EjvBPtnXfVAQK/ewP/Y2RwHBvFBbtLkxs1NhGhPI6OFLITJeFN 1c710JRjaRW1vdFXJDFoxpvuF3JRZ3vUcikVu5i6MzMD9wEBVzjpS5UPNA1z0TMt 5ZGFjvEv3kwNj7GHHnREBG4FhVLyIDgWvY3lXWpkryBtQV8ZUDxEcG3m5vI94SeP jAsx1XysQ0M= =Wv4W -----END PGP SIGNATURE----- |