Message205771
In the last Python releases, particularly 3.3 and 3.4, we've made improvements to the import machinery that render (at least) portions of pkgutil obsolete. Here's a breakdown of the public API of pkgutil:
get_importer() - duplicate of PathFinder._path_importer_cache()
iter_importers() - yields the path entry finder for each path entry
find_loader() - a parent-importing wrapper around (deprecated) importlib.find_loader()
get_loader() - looks at module.__loader__ or calls find_loader()
walk_packages() - loader-focused
iter_modules() - loader-focused
get_data() - a wrapper around the InspectLoader.get_data() API
read_code() - duplicates importlib functionality
extend_path() - no longer needed (namespace packages)
ImpImporter - already deprecated in favor of importlib
ImpLoader - already deprecated in favor of importlib
I would expect that nearly all of the module could be deprecated and any gaps in functionality ported to importlib.util.
Is it worth it to go to the effort? To me the biggest thing would be identifying what functionality (e.g. locating all packages within a directory) in pkgutil is still relevant and should be distilled into public APIs in importlib. The job of actually deprecating and porting code would mostly be mechanical and not even a large amount of work. |
|
Date |
User |
Action |
Args |
2013-12-10 05:54:42 | eric.snow | set | recipients:
+ eric.snow, brett.cannon, pje, ncoghlan |
2013-12-10 05:54:41 | eric.snow | set | messageid: <1386654881.95.0.820542970377.issue19939@psf.upfronthosting.co.za> |
2013-12-10 05:54:41 | eric.snow | link | issue19939 messages |
2013-12-10 05:54:40 | eric.snow | create | |
|