Skip to content
smart import for Python
Python
Branch: master
Clone or download
Pull request Compare This branch is 3 commits ahead, 1 commit behind develop.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
smart_imports
.gitignore
.travis.yml
CHANGELOG.rst
LICENSE
MANIFEST.in
README.rst
setup.py

README.rst

Smart import for Python

Latest version released on PyPi Supported Python versions Test coverage in develop

Automatically discovers & imports entities, used in current module.

No magic or monkey patching. Only standard Python functionality.

Before After
import math
from my_project import calc
# 100500 other imports

def my_code(argument, function=calc):
    return math.log(function(argument))
import smart_imports
smart_imports.all()
# no any other imports

def my_code(argument, function=calc):
    return math.log(function(argument))

Short summary

  • Get source code of module, from which smart_imports has called;
  • Parse it, find all not initialized variables;
  • Search imports, suitable for found variables;
  • Import them.

Process only modules, from which smart_imports called explicitly.

See also

You can’t perform that action at this time.