Skip to main content

Core package for the brickblock library.

Project description

Example Pipeline with brickblock [bb-core]

Overview

This project demonstrates how to build a flexible data processing pipeline using the bb-core library. The pipeline is designed to process data through a series of functions or modules, supporting both synchronous and asynchronous execution, with real-time updates via server-sent events (SSE).

Installation

  1. Install the repository:

    pip install bb-core
    
  2. Set up a virtual environment (optional but recommended):

    python -m venv venv
    

    Activate the virtual environment:

    • Windows:
      .env\Scriptsctivate
      
    • macOS/Linux:
      source venv/bin/activate
      

Project Structure

  • Pipeline Class: Manages the flow of data through a series of functions.
  • BaseModule Class: Abstract base class that all modules should inherit from. Modules must implement the following methods:
    • run(): The main processing function.
    • onProgressStartMessage(): Sends a progress start message.
    • onProgressEndMessage(): Sends a progress end message.
  • SSE Generator: Asynchronous generator that sends real-time updates to clients.

Example Usage

from your_module import Pipeline, BModule, InputModel2

# Initialize the pipeline
pipeline = Pipeline.init(name="example_pipeline", sse=True)

# Add a module to the pipeline
bmodule = BModule()
pipeline.modules([bmodule])

# Input data for the pipeline
input_data = {"c": 5.0}

# Asynchronously run the pipeline and get SSE events
async def test_sse():
    async for event in pipeline.sse_generator(InputModel2(**input_data)):
        print(event)

# Run the asynchronous SSE generator
asyncio.run(test_sse())

This project is licensed under the MIT License.

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

bb_core-0.1.19.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

bb_core-0.1.19-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file bb_core-0.1.19.tar.gz.

File metadata

  • Download URL: bb_core-0.1.19.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for bb_core-0.1.19.tar.gz
Algorithm Hash digest
SHA256 e3f56976a29a26d7671c200768d5acc1de68c18c6a02d5dc14761ac8889eb210
MD5 61595531273633af168dc2300d9d63e7
BLAKE2b-256 9b419498fccdb4af70261c8f311541da4984620357e0cf77be7ea3ed72223702

See more details on using hashes here.

File details

Details for the file bb_core-0.1.19-py3-none-any.whl.

File metadata

  • Download URL: bb_core-0.1.19-py3-none-any.whl
  • Upload date:
  • Size: 27.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for bb_core-0.1.19-py3-none-any.whl
Algorithm Hash digest
SHA256 ee30293c4b69ddc7834c95f2fb9a25acea89a5416f1bff3044e09e2ad26d16ea
MD5 097ff84ea80de24c2d4034ebaf4be080
BLAKE2b-256 e9a5f4532a4529d78e00a3514bb6ea80ddb0904c2fbaee15af434d95d71ba560

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