Skip to main content

A tiny mlops library for building machine learning pipelines on your local machine.

Project description

tinypipeline

Overview

tinypipeline is a tiny mlops library that provides a simple framework for organizing your machine learning pipeline code into a series of steps. It does not handle networking, I/O, or compute resources. You do the rest in your pipeline steps.

Installation

$ pip install tinypipeline

Usage

tinypipeline exposes two main objects:

  • pipeline: a decorator for defining your pipeline. Returns a Pipeline instance.
  • step: a decorator that is used to define individual pipeline steps. Returns a Step instance.

Each object requires you provide a name, version, and description to explicitly define what pipeline you're creating.

The Pipeline object that is returned from the decorator has a single method: run().

API

If you'd like to use this package, you can follow the example.py below:

from tinypipeline import pipeline, step

# define all of the steps
@step(name='step_one', version='0.0.1', description='first step')
def step_one():
    print("Step function one")

@step(name='step_two', version='0.0.1', description='second step')
def step_two():
    print("Step function two")

@step(name='step_three', version='0.0.1', description='third step')
def step_three():
    print("Step function three")

@step(name='step_four', version='0.0.1', description='fourth step')
def step_four():
    print("Step function four")


# define the pipeline
@pipeline(
    name='test-pipeline', 
    version='0.0.1', 
    description='a test tinypipeline',
)
def pipe():
    # run the steps in the defined order
    return [
        step_one, 
        step_two, 
        step_three, 
        step_four,
    ]

pipe = pipe()
pipe.run()

You can also define steps using a dictionary, where each key of the dictionary is a step to run, and the values are steps that run after the step named in the key.

# define the pipeline
@pipeline(
    name='test-pipeline', 
    version='0.0.1', 
    description='a test tinypipeline',
)
def pipe():
    # run the steps in the defined order of the graph
    return {
        step_one: [step_two, step_four],
        step_two: [step_three, step_four]
    }

Output:

You can run the example.py like so:

$ python example.py
+-------------------------------------------------------------------+
| Running pipeline: Pipeline(name='test-pipeline', version='0.0.1') |
+-------------------------------------------------------------------+

Running step [step_one]...
Step function one
Step [step_one] completed in 0.000325 seconds

Running step [step_two]...
Step function two
Step [step_two] completed in 0.000286 seconds

Running step [step_three]...
Step function three
Step [step_three] completed in 0.000251 seconds

Running step [step_four]...
Step function four
Step [step_four] completed in 0.000313 seconds

Running tests

Tests are run using pytest. To run the tests you can do:

$ pip install pytest
$ pytest

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

tinypipeline-0.3.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

tinypipeline-0.3.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file tinypipeline-0.3.0.tar.gz.

File metadata

  • Download URL: tinypipeline-0.3.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for tinypipeline-0.3.0.tar.gz
Algorithm Hash digest
SHA256 cec9f38f6afeef9b2708649c40b60165eb2df62cf85db9885b023dd7c154b144
MD5 f190e36541dee74ea4ff182a5a52510c
BLAKE2b-256 3bbc18e476df1af97ea7b8fff22c59826d9b27f1e64a20c739f7ce7658e4e45f

See more details on using hashes here.

File details

Details for the file tinypipeline-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: tinypipeline-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for tinypipeline-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9cae51b77a50f4f6705fedfe97232f964bf660b2955aad422f3027dcb1025b78
MD5 9992befbbc76701339c677cf5c1bc8fd
BLAKE2b-256 ad3125e9d8d142295e5a2500a4e34b5054dfffbff6a55191bfd860ea1016081d

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