Skip to main content

lazyimport lets you import python modules lazily.

Project description

lazyimport
##########
|PyPI-Status| |PyPI-Versions| |Build-Status| |Codecov| |LICENCE|


``lazyimport`` lets you import python modules lazily.

.. code-block:: python

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

.. contents::

.. section-numbering::


Installation
============

.. ``lazyimport`` is tested on Python 2.7, 3.4, 3.5 and 3.6.

Install ``lazyimport`` with:

.. code-block:: bash

pip install lazyimport


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:

.. code-block:: python

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


Credits
=======

.. .. Written by Paul Ivanov - https://github.com/ivanov - for the nitime library - https://github.com/nipy/nitime.
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 <http://www.shaypalachy.com>`_.

.. alternative:
.. https://badge.fury.io/py/yellowbrick.svg

.. |PyPI-Status| image:: https://img.shields.io/pypi/v/lazyimport.svg
:target: https://pypi.org/project/lazyimport

.. |PyPI-Versions| image:: https://img.shields.io/pypi/pyversions/lazyimport.svg
:target: https://pypi.org/project/lazyimport

.. |Build-Status| image:: https://travis-ci.org/shaypal5/lazyimport.svg?branch=master
:target: https://travis-ci.org/shaypal5/lazyimport

.. |LICENCE| image:: https://img.shields.io/badge/License-GNU3-yellow.svg
:target: https://github.com/shaypal5/lazyimport/blob/master/LICENSE

.. .. |LICENCE| image:: https://github.com/shaypal5/lazyimport/blob/master/mit_license_badge.svg
:target: https://pypi.python.org/pypi/lazyimport

.. https://img.shields.io/pypi/l/lazyimport.svg

.. |Codecov| image:: https://codecov.io/github/shaypal5/lazyimport/coverage.svg?branch=master
:target: https://codecov.io/github/shaypal5/lazyimport?branch=master


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.3-py3-none-any.whl (9.3 kB view hashes)

Uploaded Python 3

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