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 ThreadModule, ProcessModule, ModuleInformation, ModuleVersion, SharedData
from modulepy.manager import ModuleManager
class ModuleA(ThreadModule):
information = ModuleInformation("A", ModuleVersion(1, 0, 0))
dependencies = [ModuleInformation("B", ModuleVersion(1, 0, 0))]
def work(self):
self.data_enqueue({"A": 0})
def process_input_data(self, data: SharedData):
print(data)
class ModuleB(ProcessModule):
information = ModuleInformation("B", ModuleVersion(1, 0, 0))
def work(self):
self.data_enqueue({"B": 1})
if __name__ == '__main__':
manager = ModuleManager()
manager.add_module(ModuleA())
manager.add_module(ModuleB())
manager.start()
manager.join()
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.10.tar.gz
(4.2 kB
view hashes)