Skip to main content

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
  • 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 ModuleBase, ModuleInformation, ModuleVersion, SharedData, ModuleManager


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})


if __name__ == '__main__':
    manager = ModuleManager()
    manager.add_module(ModuleA())
    manager.add_module(ModuleB())
    manager.start()
    manager.join()

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

modulepy-0.6.tar.gz (3.9 kB view details)

Uploaded Source

File details

Details for the file modulepy-0.6.tar.gz.

File metadata

  • Download URL: modulepy-0.6.tar.gz
  • Upload date:
  • Size: 3.9 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.5

File hashes

Hashes for modulepy-0.6.tar.gz
Algorithm Hash digest
SHA256 3612c1d2249d5c90c971f98842e35701d348fcbcbe58e84735c652ea8efb9cdc
MD5 ef3939e725f38de548fe9fd02bbd530f
BLAKE2b-256 c024d6a5b6c5d4d2a9e591b39e2f6b1835247b8838a2af1ae051c0d3a550f940

See more details on using hashes here.

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