orsinium-labs / deferred-import

Lazy import and install on demand Python packages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

deferred-import

Lazy import and install on demand Python packages.

  1. Package will be loaded only when you use it in the first time. Deferring it makes module loading much faster.
  2. If module is missed, the package will be automatically installed. It allows to make some project dependencies optional and install them on demand.

Installation

python3 -m pip install --user deferred-import

Usage

from deferred_import import deferred_import

requests = deferred_import('requests')
attr = deferred_import('attr', package='attrs')

requests.get('http://httpbin.org/status/200')
# <Response [200]>

About

Lazy import and install on demand Python packages

License:MIT License


Languages

Language:Python 100.0%