thepipe
A simplistic, general purpose pipeline framework, which can easily be integrated into existing (analysis) chains and workflows.
Installation
thepipe can be installed via pip:
pip install thepipe
Features
Easy to use interface and integration into existing workflows
Automatic provenance tracking (set Provenance().outfile to dump it upon program termination)
Modules can be either subclasses of Module or bare python functions
Data is passed via a simple Python dictionary from module to module (wrapped in a class called Blob which adds some visual candy and error reporting)
Integrated hierarchical logging system
Colour coded log and print messages (self.log() and self.cprint() in Modules)
Performance statistics for the whole pipeline and each module individually
Clean exit when interrupting the pipeline with CTRL+C
The Pipeline
Here is a basic example how to create a pipeline, add some modules to it, pass some parameters and drain the pipeline.
Note that pipeline modules can either be vanilla (univariate) Python functions or Classes which derive from thepipe.Module.
import thepipe as tp
class AModule(tp.Module):
def configure(self):
self.cprint("Configuring AModule")
self.max_count = self.get("max_count", default=23)
self.index = 0
def process(self, blob):
self.cprint("This is cycle #%d" % self.index)
blob['index'] = self.index
self.index += 1
if self.index > self.max_count:
self.log.critical("That's enough...")
raise StopIteration
return blob
def finish(self):
self.cprint("I'm done!")
def a_function_based_module(blob):
print("Here is the blob:")
print(blob)
return blob
pipe = tp.Pipeline()
pipe.attach(AModule, max_count=5) # pass any parameters to the module
pipe.attach(a_function_based_module)
pipe.drain() # without arguments it will drain until a StopIteration is raised
This will produce the following output:
2020-05-26 12:43:12 ++ AModule: Configuring AModule
Pipeline and module initialisation took 0.001s (CPU 0.001s).
2020-05-26 12:43:12 ++ AModule: This is cycle #0
Here is the blob:
Blob (1 entries):
'index' => 0
2020-05-26 12:43:12 ++ AModule: This is cycle #1
Here is the blob:
Blob (1 entries):
'index' => 1
2020-05-26 12:43:12 ++ AModule: This is cycle #2
Here is the blob:
Blob (1 entries):
'index' => 2
2020-05-26 12:43:12 ++ AModule: This is cycle #3
Here is the blob:
Blob (1 entries):
'index' => 3
2020-05-26 12:43:12 ++ AModule: This is cycle #4
Here is the blob:
Blob (1 entries):
'index' => 4
2020-05-26 12:43:12 ++ AModule: This is cycle #5
2020-05-26 12:43:12 CRITICAL ++ AModule: That's enough...
2020-05-26 12:43:12 ++ AModule: I'm done!
============================================================
5 cycles drained in 0.001284s (CPU 0.001475s). Memory peak: 27.01 MB
wall mean: 0.000070s medi: 0.000052s min: 0.000042s max: 0.000122s std: 0.000031s
CPU mean: 0.000070s medi: 0.000052s min: 0.000042s max: 0.000124s std: 0.000032s
Metadata
Release files for thepipe 1.3.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| thepipe-1.3.9.tar.gz | 56.0 kB | Without provenance | Details for thepipe-1.3.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| thepipe-1.3.9-py3-none-any.whl | Python 3 | none | any | Details for thepipe-1.3.9-py3-none-any.whl |
Total release size: 80.5 kB
Release files / thepipe-1.3.9.tar.gz
| Download URL | thepipe-1.3.9.tar.gz |
|---|---|
| Size | 56.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1fea009984c44059defd0809e09f7a2c16782433d28b1414d50f3d4647d92c9
|
|
BLAKE2b-256 checksum How to use checksums |
9533382ca229f23779e15b813b3e6aced50541bbe04b34fd4bb1069c31ca61fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / thepipe-1.3.9-py3-none-any.whl
| Download URL | thepipe-1.3.9-py3-none-any.whl |
|---|---|
| Size | 24.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f5692e8b46942fec9cb495dc29dad42b86c7671cae7d409d928a680bfacfe707
|
|
BLAKE2b-256 checksum How to use checksums |
51aeef9bfaf2f4c2a837e0193bf2f63f2fd2d2c196534e381a5557a868488a9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for thepipe 1.3.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.