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

"modernize" the modulefinder module #64219

Closed
ericsnowcurrently opened this issue Dec 19, 2013 · 4 comments
Closed

"modernize" the modulefinder module #64219

ericsnowcurrently opened this issue Dec 19, 2013 · 4 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@ericsnowcurrently
Copy link
Member

BPO 20020
Nosy @theller, @ericsnowcurrently, @berkerpeksag, @matrixise
PRs
  • bpo-35936: Updates to modulefinder #11787
  • bpo-35936: Updates to modulefinder #11787
  • 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 = None
    created_at = <Date 2013-12-19.04:05:25.376>
    labels = ['type-feature', 'library']
    title = '"modernize" the modulefinder module'
    updated_at = <Date 2019-02-08.03:24:32.555>
    user = 'https://github.com/ericsnowcurrently'

    bugs.python.org fields:

    activity = <Date 2019-02-08.03:24:32.555>
    actor = 'brandtbucher'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2013-12-19.04:05:25.376>
    creator = 'eric.snow'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 20020
    keywords = ['patch', 'patch']
    message_count = 3.0
    messages = ['206576', '206608', '229310']
    nosy_count = 5.0
    nosy_names = ['theller', 'Arfrever', 'eric.snow', 'berker.peksag', 'matrixise']
    pr_nums = ['11787', '11787']
    priority = 'low'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue20020'
    versions = ['Python 3.5']

    @ericsnowcurrently
    Copy link
    Member Author

    The modulefinder module (Lib/modulefinder.py) provides a ModuleFinder class (plus 2 helpers) you can use to see what modules a script imports (directly or indirectly). The module's implementation is centered on the old imp.find_/load_module() API (which has been deprecated). The implementation should be refactored to reflect/make use of the newer import-related APIs.

    The documented API for ModuleFinder is very small. However, it has quite a few methods that are "public" in the sense that their names do not start with an underscore. This will make any kind of refactoring trickier.

    @ericsnowcurrently ericsnowcurrently added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Dec 19, 2013
    @theller
    Copy link

    theller commented Dec 19, 2013

    I have written a new modulefinder based on importlib. It is not a refactoring of the old one, so it is no plug-in replacement. Instead it has some new features:

    • Better logging output
    • collects dependencies (self._depgraph maps module names to callers)
    • when run as script, the command line syntax are easier to understand (although parsing is still done by getopt; argparse would be event better)
    • The Module proxies that modulefinder collects give better access to the module's attributes, including the byte code

    It is not yet tested in the wild but I will use it for the Python3 py2exe implementation.

    If anyone wants to take a look the current version is here:

    http://code.google.com/p/ctypes-stuff/source/browse/trunk/mf/py2exe/mf3.py

    @matrixise
    Copy link
    Member

    The code of Thomas has not the same API than the "modulefinder" module.

    If you want a patch, we need to rework the code of Thomas and provide an equivalent API with the existing one.

    What do you suggest?

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @iritkatriel
    Copy link
    Member

    Fixed by #11787.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants