You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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:
Activity
ericsnowcurrently commentedon Dec 19, 2013
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.
theller commentedon 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:
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 commentedon Oct 14, 2014
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?
iritkatriel commentedon Jun 28, 2022
Fixed by #11787.