module framework
Project description
modulepy
easily build modular applications
installation
pip3 install modulepy
# or
pip3 install git+https://github.com/nbdy/modulepy
features
- module baseline
- thread based module
- process based module
- module loader
- one-line module loading
- one-line directory loading
- module manager
- add module
- remove module
- reload module directory
- module dependency resolution
- ipc
usage
from modulepy import ModuleInformation, ModuleVersion, SharedData, ModuleBase
from modulepy.manager import ModuleManager
from time import sleep
class ModuleA(ModuleBase):
information = ModuleInformation("A", ModuleVersion(1, 0, 0))
dependencies = [ModuleInformation("B", ModuleVersion(1, 0, 0))]
def work(self):
self.enqueue({"A": 0})
def process_input_data(self, data: SharedData):
print(data)
class ModuleB(ModuleBase):
information = ModuleInformation("B", ModuleVersion(1, 0, 0))
def work(self):
self.enqueue({"B": 1})
def dependency_missing(module):
print(f"Dependency for module {module.name} missing: {module.dependencies}")
if __name__ == '__main__':
manager = ModuleManager()
manager.on_dependency_missing = dependency_missing
manager.add_module(ModuleB())
manager.add_module(ModuleA())
manager.start()
sleep(3)
manager.stop()
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
modulepy-0.11.tar.gz
(4.2 kB
view details)
File details
Details for the file modulepy-0.11.tar.gz
.
File metadata
- Download URL: modulepy-0.11.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43e74ca1969acaceec5cfbdb29ce4d3b2d62748e3f521413c817c00df6e44104 |
|
MD5 | cb17920620cb77a19cd1f8b73d1b1db1 |
|
BLAKE2b-256 | 3d341e27da848f756341f53654e4f8e60ea3b21b263a255099b761daf293fcd7 |