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

pkgutil docs should reference glossary terms not PEP 302 #65041

Closed
ncoghlan opened this issue Mar 3, 2014 · 15 comments
Closed

pkgutil docs should reference glossary terms not PEP 302 #65041

ncoghlan opened this issue Mar 3, 2014 · 15 comments
Labels
docs Documentation in the Doc dir easy type-feature A feature request or enhancement

Comments

@ncoghlan
Copy link
Contributor

ncoghlan commented Mar 3, 2014

BPO 20842
Nosy @ncoghlan, @orsenthil, @merwok, @vadmium, @kushaldas, @orenmn, @ultimatecoder
Files
  • issue20842_v1.diff
  • issue20842_v2.diff
  • issue20842-v3.patch
  • issue20842-3.3-v5.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 = None
    closed_at = <Date 2016-09-06.00:20:27.441>
    created_at = <Date 2014-03-03.11:33:20.621>
    labels = ['easy', 'type-feature', 'docs']
    title = 'pkgutil docs should reference glossary terms not PEP 302'
    updated_at = <Date 2016-09-07.07:53:45.261>
    user = 'https://github.com/ncoghlan'

    bugs.python.org fields:

    activity = <Date 2016-09-07.07:53:45.261>
    actor = 'python-dev'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2016-09-06.00:20:27.441>
    closer = 'orsenthil'
    components = ['Documentation']
    creation = <Date 2014-03-03.11:33:20.621>
    creator = 'ncoghlan'
    dependencies = []
    files = ['43521', '43721', '44381', '44383']
    hgrepos = []
    issue_num = 20842
    keywords = ['patch', 'easy']
    message_count = 15.0
    messages = ['212630', '213382', '269126', '269151', '269227', '269235', '270005', '270424', '270551', '272150', '274464', '274474', '274477', '274478', '274775']
    nosy_count = 9.0
    nosy_names = ['ncoghlan', 'orsenthil', 'eric.araujo', 'docs@python', 'python-dev', 'martin.panter', 'kushal.das', 'Oren Milman', 'jaysinh.shukla']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'commit review'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue20842'
    versions = ['Python 3.5', 'Python 3.6']

    @ncoghlan
    Copy link
    Contributor Author

    ncoghlan commented Mar 3, 2014

    The pkgutil docs still point at PEP-302 when mentioning loaders, importers, etc. They should reference the glossary terms (:term:`loader`, etc) instead.

    @ncoghlan ncoghlan added docs Documentation in the Doc dir type-feature A feature request or enhancement labels Mar 3, 2014
    @kushaldas
    Copy link
    Member

    Will submit a patch for this.

    @ultimatecoder
    Copy link
    Mannequin

    ultimatecoder mannequin commented Jun 23, 2016

    Submitting the patch for this issue. I observed the last message of respected Kushal but because the message was posted too earlier decided to submit patch. Thanks!

    @vadmium
    Copy link
    Member

    vadmium commented Jun 24, 2016

    See also bpo-26896. Apparently some of the terms you are linking are used wrongly.

    @ultimatecoder
    Copy link
    Mannequin

    ultimatecoder mannequin commented Jun 25, 2016

    Dear Martin,
    I observed your comment. I can see, issue mentioned by you http://bugs.python.org/issue26896 contains patch of clarifying the reference of Importer, Finder. The issue-26896 is still under review phase. It will be good step to update doc in this issue according to http://bugs.python.org/file42666/issue.diff patch?

    Thanks!

    @vadmium
    Copy link
    Member

    vadmium commented Jun 25, 2016

    I’m not sure what the best solution is. I am just pointing out the problem. It seems an “importer” as mentioned in PEP-302 is more general than the current glossary definition. E.g. ImpImporter() returns an object that has a find_module() method (which partially makes it both a “meta path finder” and a “path entry finder”), but it has no load_module() method. So it fails the “importer” definition according to the current glossary.

    @orenmn
    Copy link
    Mannequin

    orenmn mannequin commented Jul 8, 2016

    Note that http://bugs.python.org/issue26896 is now closed (the patches proposed in it (with some minor changes) were committed).

    @ultimatecoder
    Copy link
    Mannequin

    ultimatecoder mannequin commented Jul 14, 2016

    Adding updated patch after merging bpo-26896. Requesting to review. Thanks!

    @vadmium
    Copy link
    Member

    vadmium commented Jul 16, 2016

    I still think the links are too dense. Three links to the same term in two short paragraphs is too much. Do you think it would be okay to just link the first occurrence for pkgutil.ImpImporter?

    Also, there is still a problem at least the definition of “finder” used by the ImpImporter documentation. In PEP-302, “a finder object has a single method: finder.find_module(fullname, path=None)”. This seems to be a pretty good description of the ImpImporter API. However, by dropping the reference to PEP-302, and linking to the glossary definition, we are suggesting that ImpImporter implements importlib.abc.MetaPathFinder and/or importlib.abc.PathEntryFinder. Both these APIs require some sort of find_spec() method, which is not provided by ImpImporter.

    As I see it, either Python’s “finder” glossary entry should be adjusted to accommodate PEP-302, or we should retain the PEP-302 reference and not point at the wrong definition of “finder”.

    @orenmn
    Copy link
    Mannequin

    orenmn mannequin commented Aug 8, 2016

    ImpImporter was first added in changeset 37808 (https://hg.python.org/cpython/rev/ccc0b5412799) and updated a day later in changeset 37821 (https://hg.python.org/cpython/rev/3135648026c4).
    Both of these commits were introduced to support PEP-302.
    Since then, ImpImporter remained quite the same, and was never changed to suit later relevant PEPs (e.g. PEP-420 and PEP-451).

    Thus, IMHO, we should go with your second option, Martin, and retain the PEP-302 reference in ImpImporter documentation.

    With regard to the accuracy of Python's 'finder' glossary entry, it was updated recently, in changeset 99434 (https://hg.python.org/cpython/rev/88cee7d16ccb), to suit PEP-302, PEP-420 and PEP-451, so ISTM there is no need to adjust it.

    @orsenthil
    Copy link
    Member

    I agree with the comment made by Oren. Not all instances of finder should be referenced as generic finder. Some classes and functions are are still PEP-302 specific finder.

    In the commit, 3987667bf98f Nick Coghlan modified the following functions to to use importlib module, thus serving the PEP-302 bind. So these can refer to glossary entry for finder. The documentation has been updated with version changed information.

    • get_importer (by the underlying change of using only sys.path_importer_cache and removing the use of ImpImporter)
    • iter_importers (by using importlib.import_module)

    The glossary entry for both finder and loader has been updated to include both PEP-302 finder, and with PEP-420 and PEP-451.

    With these changes already in place, I updated the patch to reflect the current state.

    I am proceed with the commit as this is a non-controversial change. If there are comments, please share and I will address them.

    @orsenthil
    Copy link
    Member

    For 3.5 version of patch, we have bring in some additional changes from bpo-26896 which properly clarified finder from importer. These changes are not required in the default branch.

    @orsenthil
    Copy link
    Member

    This is 3.3 version of patch attached.

    @orsenthil
    Copy link
    Member

    Change committed.

    • 3.5 * 103098:ecbad01262c8
    • default * 103099:ee58ece83391

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 7, 2016

    New changeset a4360b1b45a8 by Senthil Kumaran in branch 'default':
    bpo-20842 - null merge with 3.5
    https://hg.python.org/cpython/rev/a4360b1b45a8

    @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
    docs Documentation in the Doc dir easy type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    5 participants