Metadata-Version: 2.1
Name: swimlane_core
Version: 1.1.1
Summary: This package provides an abstraction layer between Swimlane and Python Scripts.
Home-page: https://github.com/swimlane/swimlane_core
Keywords: connector,swimlane,connectors
Author: Swimlane
Author-email: support@swimlane.com
Maintainer: Swimlane
Requires-Python: >=3.7,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.6
Requires-Dist: PyYAML (>=6.0,<7.0)
Requires-Dist: requests (==2.28.0)
Project-URL: Repository, https://github.com/swimlane/swimlane_core
Description-Content-Type: text/markdown

# 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

```python
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)
```

```python
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"
}

```

```python
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.


```python
from swimlane_core import FileDescriptor, InputHandler, OutputHandler
```
