Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pydoc list submodules #46056

Closed
gustavo mannequin opened this issue Dec 31, 2007 · 6 comments
Closed

Make pydoc list submodules #46056

gustavo mannequin opened this issue Dec 31, 2007 · 6 comments
Assignees
Labels
type-feature A feature request or enhancement

Comments

@gustavo
Copy link
Mannequin

gustavo mannequin commented Dec 31, 2007

BPO 1715
Nosy @birkenfeld, @pitrou
Files
  • pydoc-submodules.diff
  • pydocsubmodules.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/birkenfeld'
    closed_at = <Date 2008-01-21.21:06:03.812>
    created_at = <Date 2007-12-31.23:52:12.588>
    labels = ['type-feature']
    title = 'Make pydoc list submodules'
    updated_at = <Date 2008-01-21.21:06:03.811>
    user = 'https://bugs.python.org/gustavo'

    bugs.python.org fields:

    activity = <Date 2008-01-21.21:06:03.811>
    actor = 'georg.brandl'
    assignee = 'georg.brandl'
    closed = True
    closed_date = <Date 2008-01-21.21:06:03.812>
    closer = 'georg.brandl'
    components = ['Demos and Tools']
    creation = <Date 2007-12-31.23:52:12.588>
    creator = 'gustavo'
    dependencies = []
    files = ['9038', '9246']
    hgrepos = []
    issue_num = 1715
    keywords = ['patch']
    message_count = 6.0
    messages = ['59067', '59399', '61307', '61408', '61446', '61449']
    nosy_count = 3.0
    nosy_names = ['georg.brandl', 'gustavo', 'pitrou']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue1715'
    versions = ['Python 2.6']

    @gustavo
    Copy link
    Mannequin Author

    gustavo mannequin commented Dec 31, 2007

    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.

    @gustavo gustavo mannequin added the type-feature A feature request or enhancement label Dec 31, 2007
    @birkenfeld
    Copy link
    Member

    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
    )

    @pitrou
    Copy link
    Member

    pitrou commented Jan 20, 2008

    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 :-)).

    @birkenfeld
    Copy link
    Member

    The patch only amends TextDoc -- what about HtmlDoc?

    @pitrou
    Copy link
    Member

    pitrou commented Jan 21, 2008

    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.

    @birkenfeld
    Copy link
    Member

    Well, I believe you. :)

    Committed r60178.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants