This package provides an abstraction layer between Swimlane and Python Scripts.
Project description
Swimlane Core
The swimlane-core is a Python package that provides an easy-to-use interface for users to communicate with Turbine. With this package, users can effortlessly interact with Turbine without dealing with the complexities of handling arguments, inputs, outputs and files.
Features
- Fetch inputs from the standard input.
- Handle file descriptors and downloads.
- Set outputs and errors in a standardized format.
- Retrieve asset details, command-line arguments, asset schema, action schema, and proxy.
Usage
Simple examples
from swimlane_core import (get_action_schema, get_arguments, get_asset,
get_asset_schema, get_inputs, get_proxy,
process_inputs, process_outputs, get_error,
get_output)
args = get_arguments()
inputs = get_inputs()
inputs = process_inputs(inputs)
asset = get_asset()
asset_schema = get_asset_schema()
action_schema = get_action_schema()
http_proxy = get_proxy()
resp = process_outputs(resp)
output = get_output(resp)
print(output, sep="")
error_output = get_error(req_err, is_http_error=True)
print(error_output, file=sys.stderr)
from swimlane_core import process_inputs
raw_inputs = {
"file": "an id",
"file_name": "sample.txt"
}
processed_inputs = process_inputs(raw_inputs)
print(processed_inputs)
raw_inputs = {
"file": "a base64",
"file_name": "sample.txt"
}
from swimlane_core import process_outputs
raw_outputs = {
"file": b"file content",
"file_name": "sample.txt"
}
processed_outputs = process_outputs(raw_outputs)
print(processed_outputs)
raw_inputs = {
"file": "a file id",
"file_name": "sample.txt"
}
Advanced
The package provides a simple facade, you can access the underling classes for complex workflows or modifying the behavior of the package.
from swimlane_core import FileDescriptor, InputHandler, OutputHandler
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
swimlane_core-1.1.0.tar.gz
(4.1 kB
view details)
Built Distribution
File details
Details for the file swimlane_core-1.1.0.tar.gz
.
File metadata
- Download URL: swimlane_core-1.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.2 Linux/6.2.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d61692882715fed3e7a32a11a30282fd4f6ee262eac553bf748dd92a4934c3b2 |
|
MD5 | 8f3d63a55da30b88da4abea4df0f9a50 |
|
BLAKE2b-256 | 41acd96450e9f14785cf19d59234649417a34127cae697bdf405bca6d3c95ba9 |
File details
Details for the file swimlane_core-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: swimlane_core-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.2 Linux/6.2.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cd0e16dd2b6be0c9320652e7a00caebf0ad126474d4235c828e9878fc70ce58 |
|
MD5 | c2ef3efa740229899439e53f8dced8ce |
|
BLAKE2b-256 | 69ce13639176fef0c00f73140a41a79a64fd6ab3c0783bdc0677e2cc33418f49 |