Skip to main content

Very basic pipelining toolbox

Project description

MicroPype

A tiny package to create very basic pipeline executing command lines and/or calling python functions.

Install

pip install micropype

API

Here are the two mains functions you need:

cached_run

Use it to execute a cammand line.

Arguments:

  • cmd: Command line
  • out_files: One or a list of file path(s) that are created by the command.
  • title:(str, default: None) - A title
  • log: (str, default: None) - A path to a log file (text file)
  • versions: (dict, default: None) - A dictionnary giving all the versions that must be logged
  • raise_errors: (bool, default: True) - Wether to raise python error if the command failed (if True) or just print error in the console and continue (if False)

cached_function_call

Use it to call a python function.

Arguments:

  • func: A callable python object (function)
  • args: List of the arguments
  • out_files: One or a list of file path(s) that are created by the command.
  • title:(str, default: None) - A title
  • log: (str, default: None) - A path to a log file (text file)
  • versions: (dict, default: None) - A dictionnary giving all the versions that must be logged
  • raise_errors: (bool, default: True) - Wether to raise python error if the command failed (if True) or just print error in the console and continue (if False)

Configuration file

Command line

Example

Here is an example of simple configuration file:

{
    "steps": {
        "do_ls": true,
        "do_myfunction": false
    },
    "subconfig":  [
        {"name": "firstone", "file": "/dflf.txt", "values": [0, 3, 5, 10]},
        {"name": "firstone", "file": "/dflf.txt"},
    ]
}

And then the pipeline:

from micropype import cached_run, cached_function_call

log = "mylog.txt"

out_f = "lsOutput.log"
cached_run(
    f"ls -lrt >> {out_f}",
    out_f,
    "Listing current folder items",
    log_f
)

cached_function_call(
    myfuntion,
    [arg1, arg2],
    [file_1, file_2],
    title=f"Executing a python function",
    log=log_f
)

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

micropype-0.4.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

micropype-0.4.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file micropype-0.4.0.tar.gz.

File metadata

  • Download URL: micropype-0.4.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for micropype-0.4.0.tar.gz
Algorithm Hash digest
SHA256 831be5e0e1605a0c8e8ccf84e22cc2f99713980b66121c43f26be5ea45a564c4
MD5 fbfe99758fb51c6369fe60d85c838d4a
BLAKE2b-256 561e5a0a1980768fe7b67bdf73d42f83865fcdbd8b1f9e7d02ff5a21c7394748

See more details on using hashes here.

File details

Details for the file micropype-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: micropype-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for micropype-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e5f7d40f53b6db7682b64094aefeafa3771a9e1c99e30f8dfb2ac1a22225e043
MD5 2a965c45fcf7540d012d773db7243d8f
BLAKE2b-256 871ea19a79a054c3936f428e2f4cbbb1196b8f9d52b41dd9996b30dee5f173c5

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