Skip to main content

NEW in 1.10: @whenImported can now be used as a decorator for lazy imports

Need to import an object when all you’ve got is its name? Need to lazily import modules, such that they don’t actually get loaded until you use them? Want to have some code in a module that only gets run if another module is imported? Then you need the “Importing” toolkit.

Installing the toolkit (using "easy_install Importing" or "setup.py install") allows you to access the peak.util.imports module. This module was previously bundled for years inside of the general PEAK distribution, but is now available as a standalone module for your convenience.

The “Importing” toolkit does not install or use any special import hooks, and is compatible with zipfile imports, py2exe, etc. Lazy and weak imports should be compatible with almost any import hooks or hacks, as long as they have reasonable support for the reload() builtin. The dynamic import utilities, however, require only that __import__() work correctly, and so should work anywhere that normal Python imports work.

NOTE: The 1.9.2 release uses a new version of setuptools (0.6b3) that fixes a previous problem with .pth files on Windows with the Importing egg. See more info on how to fix your existing installation, if you experienced this problem with a previous version.

Python 2.3 users: If you are using weak or lazy importing with zipfiles (e.g. eggs) you must have Python 2.3.5. Lesser versions of 2.3 have a bug in the reload() implementation which prevents correct operation of weak and lazy imports for modules that are inside zipfiles.

Metadata

Release files for Importing 1.10

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

Source distribution (sdist)

Source distribution for Importing 1.10
File Size Uploaded Provenance Actions
Importing-1.10.zip 17.1 kB Without provenance Details for Importing-1.10.zip

Release files / Importing-1.10.zip

Download URL Importing-1.10.zip
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e61348d8d37b20b69c887ded5378ca99f2588e177133a06607130e6a5515062f
BLAKE2b-256 checksum
How to use checksums
4ec3a171c3577bb96d284f4cb1d52d599db787c8e179778b39409e1ccf83dab2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for Importing 1.10

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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