Skip to main content

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.

Metadata

Release files for backport_importlib 0...1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for backport_importlib 0...1
File Size Uploaded Provenance
backport_importlib-0...1.tar.gz 4.6 kB Without provenance Details

Release files / backport_importlib-0...1.tar.gz

Download URL backport_importlib-0...1.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6df9c805df87c59ef3e5d28bdd64995b1a103594489eabc6b5a3289013619fd1
BLAKE2b-256 checksum
How to use checksums
59be4b1f09c557dd485f368b8df6e34ab414acf276b874a8d31840d50852234b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for backport_importlib 0...1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0...1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page