Skip to content

shaypal5/lazyimport

Repository files navigation

lazyimport

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
  """
)

Install lazyimport with:

pip install lazyimport

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
  """
)

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.

About

lazyimport lets you import python modules lazily.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages