Skip to main content

A utility package for chaining and pipeline operations with enhanced logging and timing.

Project description

ChainPipe

ChainPipe is a Python package designed to facilitate efficient and modular handling of operations in a chain or pipeline manner. It provides two primary classes, Chain and Pipeline, which allow for sequential and independent operation executions respectively, with enhanced capabilities for logging and timing.

Features

  • Chain: Manage a sequence of operations where the output of one operation is the input to the next.
  • Pipeline: Execute a sequence of independent operations.
  • Timer: Utility for timing operations, useful for performance analysis.
  • Logger: Enhanced logging capabilities to track operation execution and errors.

Installation

Install ChainPipe using pip:

'pip install ChainPipe'

Or, if you want to install from source:

'git clone https://github.com/ayman3000/ChainPipe.git cd ChainPipe python setup.py install'

Usage

Below are quick examples on how to use the Chain and Pipeline classes:

Chain Example

from chainpipe.chain import Chain

def multiply_by_two(x):
    return x * 2

def add_five(x):
    return x + 5

chain = Chain() | multiply_by_two | add_five
result = chain.execute(3)
print("Result:", result)

Additional Chain Example Using add_operation

from chainpipe.chain import Chain

def multiply_by_three(x):
    return x * 3

def subtract_two(x):
    return x - 2

chain = Chain()
chain.add_operation(multiply_by_three)
chain.add_operation(subtract_two)
result = chain.execute(4)
print("Result:", result)

Pipeline Example

from chainpipe.pipeline import Pipeline

def initialize_system():
    print("System initialized")

def perform_checks():
    print("Checks performed")

pipeline = Pipeline() | initialize_system | perform_checks
pipeline.execute()

Additional Pipeline Example Using add_operation

from chainpipe.pipeline import Pipeline

def load_configuration():
    print("Configuration loaded")

def start_services():
    print("Services started")

pipeline = Pipeline()
pipeline.add_operation(load_configuration)
pipeline.add_operation(start_services)
pipeline.execute()

Contributing

Contributions are welcome! Please read the CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Contact

For any questions or feedback, please reach out to ayman3000@gmail.com.

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

ChainPipe-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

ChainPipe-0.1.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file ChainPipe-0.1.0.tar.gz.

File metadata

  • Download URL: ChainPipe-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for ChainPipe-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cc5427b322bdf7c12ed4f30e65d181e24302ec4b1a512744f5ef190635df04d8
MD5 9618b61a044577715afed30a8ce6e9a3
BLAKE2b-256 b4970e248e5d347339269f7295ac8b160ffbc0afde1c7463e7d2e61397329121

See more details on using hashes here.

File details

Details for the file ChainPipe-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ChainPipe-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for ChainPipe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01a1847a330b8a90cea99c72668445e187ca746cd95dd99cb1a476c4e8b1102b
MD5 f77434e81051a6fcda0decfe8e11f196
BLAKE2b-256 ff568bed4ae98d5ea8d25dce1649cd543e57cba497ba74a31173d42a29ed4224

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