To install the library:
pip install ppline
1. About
The library ppline can execute any class or any sequance of classes in any order. In other words, it is able to execute both:
- a specific class from a particular python file that can contain multiple classes, or
- an ordered sequence of specified classes from different python files.
2. How it works
2.1. Triggering a sequence of classes in order
To build a pipeline with classes to execute, you have to create a config .yml file in a root directory in the following form:
steps:
[step name]:
exec: [relative path to a file]:[class to execute]
[step name]:
exec: [relative path to a file]:[class to execute]
[step name]:
exec: [relative path to a file]:[class to execute]
Let's create a config .yml file with the name collect.yml:
steps:
preProcessing:
exec: src/calculation.py:Calculate
kMeans:
exec: src/models.py:Kmeans
hyperTuning:
exec: src/tuning.py:GridSearch
The executable classes specified in collect.yml should have a __call__ method. For instance, if we open aforementioned in collect.yml file in src/calculation.py and look at Calculate class that we trigger, we see call method in the end.
#this is src/calculation.py
class Calculate(object):
def sum(self):
a=2
b=4
self.c=a+b
def divide(self):
f=4
self.d = self.c/f
def show_result(self):
print(self.d)
def __call__(self):
self.sum()
self.divide()
self.show_result()
In order for the ppline to work, you have to make sure that
- your code is module-enabled (you have to have
__init__.pyin every directory with.pyfiles that you desire to execute classes from; - the names of your steps in
.ymlare unique;
After creating a configuration .yml file in your root directory, use the following command to trigger the pipeline in terminal:
python -m ppline.cli --config_file collect.yml
2.2. Triggering one class from .py file
Ppline can also trigger a specific class from a specific .py file.
python -m ppline.cli --trigger_class path/to/file.py:TestClass
Below is an example of command that triggers a Calculate class from calculation.py file.
python -m ppline.cli --trigger_class src/calculation.py:Calculate
Note: Calculate class should have a __call__ method that executes desired class functions, and src/calculation.py should contain __init__.py file.
To do
- dependency map between steps
- independent steps in parallel
- make png export of visualized pipeline w/ names
Changes
0.2.5 (2021-08-08)
- feature to trigger a single class
- feature to generate gitlab-ci.yml file from the pipeline config file
- minor bug fixes
0.2.2 (2021-03-15)
- __call__ method is implemented
- minor bug fixes
Metadata
Release files for ppline 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ppline-0.2.5.tar.gz | 10.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ppline-0.2.5-py3.9.egg | Legacy Egg format | - | - | Details |
Total release size: 31.0 kB
Release files / ppline-0.2.5.tar.gz
| Download URL | ppline-0.2.5.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3fe136d3bb77346b48df4cc8695fbeb85a2cb7090e499fb78d868d0a925c8765
|
|
BLAKE2b-256 checksum How to use checksums |
7d66b2a9562246f7301d8d05f27285f45ab514dee838d0a5031b132c5a653093
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.3
|
Release files / ppline-0.2.5-py3.9.egg
| Download URL | ppline-0.2.5-py3.9.egg |
|---|---|
| Size | 20.8 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
884886dc02e55a7d99e58bbb0ac3c48824557b591fccf9c5a5b5c5a46aa260a9
|
|
BLAKE2b-256 checksum How to use checksums |
821ad9ca52f7bec9ec04a1734a13541dedc6ab985ecfbb6e66d9a7ac304be8f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.3
|