Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A script to backport the full importlib to 2.x

Project Description

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 (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.

Release History

Release History

This version
History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
backport_importlib-0...1.tar.gz (4.6 kB) Copy SHA256 Checksum SHA256 Source Jul 16, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting