Skip to main content

dynamic module importer

Project description

dynaport

Dynaport serves as a python module that will enable you to dynamically import modules from anywhere on the filesystem. This module acts as a wrapper of the python import library to offer an easy to use syntax for dynamically importing modules in python.

basic usage

dp = Dynaport()
my_module = dp.get_module(name="module_name", location="/path/to/module.py")
my_module.my_func()

dp_config = Dynaport("my_config.json")
my_other_module = dp_config.get_module(name="module_name") # path is retrieved from the config file
my_other_module.my_func()

config file

Dyanport is able to use a json configuration file to define filepaths to modules you want to import.

The current format of the configuration file is as follows:

{
    "modules": {
        "module_name": "/path/to/module.py"
    }
}

future work

  • expand on the ability to define configuration files to quickly import modules
  • allow paths with environment variables to be passed into the program
  • creating compatible versions for both python2 and python3
  • uploading the package to pip for easier access to its functionality

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

dynaport-0.0.1.tar.gz (2.1 kB view hashes)

Uploaded Source

Built Distribution

dynaport-0.0.1-py3-none-any.whl (6.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