Dynamically load modules from directories
Project description
py_load_modules
Description
py_load_modules is a python3 library which takes a class, and a list of directories. It will search within those directories (without any recursive searching) for classes which implement the argument class. It will return a list of instances of those classes for use.
Installation
python3 -m pip install git+https://github.com/rhhayward/py_load_modules.git@master
Usage
Assuming a directory structure like this:
from load_modules import load_modules
modules = load_modules.load(SuperClass, ['/path/to/py_files/', 'relative_path/to/py_files'])
for module in modules:
module.class_method()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
load_modules-0.0.1.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for load_modules-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e089d566228e9a9083bc1769eacff7353236e9ca7e9270c3db42eed09c02d8b |
|
MD5 | ee6005eb95f5c830858d6861268f6021 |
|
BLAKE2b-256 | 0107e7076bbc6aa40f173e6cafd7ddd0277891e14a855608fa81655fc1268cf4 |