Skip to main content

automatic importing for Python modules

Project description

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

Project details


Download files

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

Source Distribution

smart_imports-0.2.3.tar.gz (5.6 MB view hashes)

Uploaded Source

Built Distribution

smart_imports-0.2.3-py3-none-any.whl (31.5 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