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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file load_modules-0.0.1.tar.gz.
File metadata
- Download URL: load_modules-0.0.1.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.22.0 requests-toolbelt/0.8.0 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a06bc7b3485354ababe54c1fa9950a67424116f5f2a1fd12a82457a123859b93
|
|
| MD5 |
004d4ce47bddfd373fb6a0c9ef10815d
|
|
| BLAKE2b-256 |
c3a97783a50fdd609b12cd940177e04ddf29b9c31af155296e529d602b7997ad
|
File details
Details for the file load_modules-0.0.1-py3-none-any.whl.
File metadata
- Download URL: load_modules-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.22.0 requests-toolbelt/0.8.0 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e089d566228e9a9083bc1769eacff7353236e9ca7e9270c3db42eed09c02d8b
|
|
| MD5 |
ee6005eb95f5c830858d6861268f6021
|
|
| BLAKE2b-256 |
0107e7076bbc6aa40f173e6cafd7ddd0277891e14a855608fa81655fc1268cf4
|