Skip to main content

lazyimport lets you import python modules lazily.

Project description

PyPI-Status PyPI-Versions Build-Status Codecov LICENCE

lazyimport lets you import python modules lazily.

from lazyimport import lazyimport
lazyimport(globals(), """
  from mypackage import submodule
  import another_package
  """
)

1 Installation

Install lazyimport with:

pip install lazyimport

2 Use

The lazyimport function taks two parameters:

  • scope - The scope into which the given imports are imported. A common use case is to provide this parameter with the global scope by assigning scope=globals().

  • text - The string giving the import code to perform lazily. For example, "from pandas import DataFrame".

Example use:

from lazyimport import lazyimport
lazyimport(globals(), """
  from mypackage import submodule
  import another_package
  """
)

3 Credits

Written by John Arbash Meinel, Martin von Gagern, Martin Packman and others as part of the the GNU Bazaar revision control system.

As such, lazyimport is distributed under the GNU General Public License v3, like GNU Bazzar itself.

Slightly adapted to package form by Shay Palachy.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

lazyimport-0.0.4-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file lazyimport-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for lazyimport-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 076a7dbda122119a5ef23a2e32d08261b0c61c6e4ef74927061a19027467cdb1
MD5 8fea359bde2ac7a99ce3410a26caac79
BLAKE2b-256 4cb07c85e795766bbed23fbbb5e9bb2ed78b8ff0b47854f958f1728a1611bd92

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page