Skip to main content

The ECiDA-python to make things easier

Project description

ECIDA

The EcidaModule package is a Python module designed to facilitate deployment and communication between components in a distributed system. This package provides various functionalities including Kafka message handling, environment variable checking, and directory management.

How to Use

  1. Importing the package

    To use the EcidaModule in your Python program, first, you will need to import the EcidaModule class from the package:

    from Ecida import EcidaModule
    
  2. Create an ECiDA Module

    Define a module with this signature

    def create_module() -> EcidaModule:
        M = EcidaModule("MODULE_NAME", "MODULE_VERSION")
        # ADD MODULE INPUTS/OUTPUTS HERE
        ...
    return M
    
  3. Add inputs and outputs

    Use the following syntax for adding input and output to module. You can add as many I/O as required.

    # ADD STREAMING INPUT WITH 
    M.add_input("INPUT_NAME", "string")
    # ADD STREAMING OUTPUT 
    M.add_output("OUTPUT_NAME", "string")
    # ADD INPUT DIRECTORY FOR FILE USE 
    M.add_input_directory("INPUT_DIRECTORY_NAME")
    # ADD OUTPUT DIRECTORY FOR FILE USE 
    M.add_output_directory("OUTPUT_DIRECTORY_NAME")
    # ADD INPUT DIRECTORY PRELOADING FROM GIT FOR FILE USE
    M.add_input_from_git("INPUT_DIRECTORY_NAME", "GIT_REPOSITORY", "DIRECTORY/PATH/IN/GIT")
    
  4. Entry Point

    Use the following boiler-plate as the entry-point to your code.

    if __name__ == "__main__":
        M = create_module()
        M.initialize()
        main(M)
    

    and for the main function use the following signature:

    def main(M: EcidaModule):    
        #YOUR LOGIC COMES HERE
    

Example python file

An example template for the modules.

from Ecida import EcidaModule

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)


def create_module() -> EcidaModule:
    M = EcidaModule("MODULE_NAME", "MODULE_VERSION")
    # ADD MODULE INPUTS/OUTPUTS HERE

    return M

def main(M: EcidaModule):    
    print(f"START MODULE {M.name}:{M.version}")
    # LOGIC COMES HERE
      


if __name__ == "__main__":
    M = create_module()
    M.initialize()
    main(M)

NOTES

A python file can contain no more than one one module, since the module creation happens through using create_module() function with exact same signature.

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

ecida-0.0.27.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ecida-0.0.27-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file ecida-0.0.27.tar.gz.

File metadata

  • Download URL: ecida-0.0.27.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for ecida-0.0.27.tar.gz
Algorithm Hash digest
SHA256 ccd5b4f2186aa2175a2dafbbb3bed8ad5390ebbadcf0da9826c3f9871c7105d4
MD5 e32db165c6665e1f57056e57cd10a307
BLAKE2b-256 d448ae86520bde407f98937452bacd6b16ab5a4d0c06c6b89c971b514f329c09

See more details on using hashes here.

File details

Details for the file ecida-0.0.27-py3-none-any.whl.

File metadata

  • Download URL: ecida-0.0.27-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for ecida-0.0.27-py3-none-any.whl
Algorithm Hash digest
SHA256 6cebaf013f5b8d78a28da86dafab90991e5c2e7b4625a680404ebf89172e3236
MD5 2a5ceb7822c78479b6a3100a0064410b
BLAKE2b-256 ef63e3e05f65de00ec83ca3a9ad32e129e9de596459d593c3b41993a5496b2b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page