homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Make pydoc list submodules
Type: enhancement Stage:
Components: Demos and Tools Versions: Python 2.6
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, gustavo, pitrou
Priority: normal Keywords: patch

Created on 2007年12月31日 23:52 by gustavo, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pydoc-submodules.diff gustavo, 2007年12月31日 23:52
pydocsubmodules.patch pitrou, 2008年01月20日 15:42
Messages (6)
msg59067 - (view) Author: Gustavo J. A. M. Carneiro (gustavo) * Date: 2007年12月31日 23:52
Often python extension modules define submodules like this:
static PyObject *
initfoo_xpto(void)
{
 PyObject *m;
 m = Py_InitModule3("foo.xpto", foo_xpto_functions, NULL);
 [...]
 return m;
}
PyMODINIT_FUNC
initfoo(void)
{
 PyObject *m;
 PyObject *submodule;
 m = Py_InitModule3("foo", foo_functions, NULL);
 [...]
 submodule = initfoo_xpto();
 Py_INCREF(submodule);
 PyModule_AddObject(m, "xpto", submodule);
}
Unfortunately pydoc does not list these submodules. Attached patch
fixes it.
msg59399 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008年01月06日 17:46
This patch duplicates entries for "package contents" and "submodules";
this is not good. (E.g. for help(email):
NAME
 email - A package for parsing, handling, and generating email messages.
FILE
 /home/gbr/devel/python/Lib/email/__init__.py
PACKAGE CONTENTS
 _parseaddr
 base64mime
 charset
 encoders
 errors
 feedparser
 generator
 header
 iterators
 message
 mime (package)
 parser
 quoprimime
 test (package)
 utils
SUBMODULES
 _parseaddr
 base64mime
 charset
 email
 encoders
 errors
 feedparser
 generator
 header
 iterators
 message
 mime
 parser
 quoprimime
 sys
 utils
)
msg61307 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008年01月20日 15:42
This should be a better patch, although it only applies to the text
formatter of pydoc, not the HTML one (I'm too lazy for this :-)).
msg61408 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008年01月21日 16:44
The patch only amends TextDoc -- what about HtmlDoc?
msg61446 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008年01月21日 20:52
Actually, HtmlDoc already lists all module members in the inspected
module (regardless of whether they are modules imported from outside or
submodules defined inline). You can try it with the updated pydocfodder:
>>> import pydoc
>>> from test import pydocfodder
>>> pydoc.writedoc(pydocfodder)
wrote test.pydocfodder.html
... and check that test.pydocfodder.html contains a reference to
test.pydocfodder.submodule.
msg61449 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008年01月21日 21:06
Well, I believe you. :)
Committed r60178.
History
Date User Action Args
2022年04月11日 14:56:29adminsetgithub: 46056
2008年01月21日 21:06:03georg.brandlsetstatus: open -> closed
resolution: accepted
messages: + msg61449
2008年01月21日 20:52:54pitrousetmessages: + msg61446
2008年01月21日 16:44:38georg.brandlsetmessages: + msg61408
2008年01月20日 15:42:22pitrousetfiles: + pydocsubmodules.patch
nosy: + pitrou
messages: + msg61307
2008年01月06日 17:46:32georg.brandlsetmessages: + msg59399
2008年01月01日 14:46:53christian.heimessetpriority: normal
assignee: georg.brandl
keywords: + patch
nosy: + georg.brandl
2007年12月31日 23:52:12gustavocreate

AltStyle によって変換されたページ (->オリジナル) /