Introduced in Python 3.1, the importlib package provides a pure Python implementation of the import machinery. It is also available on PyPI as a [very] watered down backport.
The backport_importlib package provides a script that will backport the full importlib package to 2.x. Keep in mind that the backport is quite naive and likely incomplete. However, it passes the rudimentary tests included in the script.
The script is optparse-based and the “-h” flag should be sufficient to see how to use it. For information on how to use importlib, please refer to the current 3.x stdlib documentation. The script will update the importlib modules in-place, and will not install importlib for you. Also, you have to provide your own copy of the 3.x importlib, which you can get from hg.python.org/cpython (under Lib).
If you find cases where the backport could be improved please let me know. Also, it probably won’t work for Python earlier than 2.4, so keep that in mind.
One last thing. A big reason that importlib was not released on PyPI as a full backport was to encourage adoption of 3.x. I stand with Brett on that choice. This tool is meant for the desparate only. In truth, importlib provides very little that you don’t already have in the 2.x import machinery, so if you think you need it you’re probably wrong.
TODO: Figure out how to actually get changelog content.
Changelog content for this version goes here.