classification
Title: "modernize" the modulefinder module
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, berker.peksag, eric.snow, matrixise, theller
Priority: low Keywords: patch, patch

Created on 2013-12-19 04:05 by eric.snow, last changed 2019-02-08 03:24 by brandtbucher.

Pull Requests
URL Status Linked Edit
PR 11787 merged brandtbucher, 2019-02-08 03:24
PR 11787 merged brandtbucher, 2019-02-08 03:24
Messages (3)
msg206576 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2013-12-19 04:05
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.
msg206608 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2013-12-19 12:20
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
msg229310 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2014-10-14 16:35
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?
History
Date User Action Args
2019-02-08 03:24:33brandtbuchersetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request11789
2019-02-08 03:24:25brandtbuchersetkeywords: + patch
stage: needs patch -> needs patch
pull_requests: + pull_request11788
2015-10-04 02:14:25Arfreversetnosy: + Arfrever
2014-10-14 17:36:21berker.peksagsetnosy: + berker.peksag
2014-10-14 16:35:47matrixisesetnosy: + matrixise
messages: + msg229310
2014-09-01 10:29:35berker.peksagsetstage: needs patch
2013-12-19 12:20:25thellersetnosy: + theller
messages: + msg206608
2013-12-19 04:05:25eric.snowcreate