A simple python library for creating Oloren Orchestrator extensions.
Project description
Oloren Orchestrator - Python Extension Library
Installation
pip install oloren
A requirement is that you use Python version > 3.7 as the code uses dataclasses which were introduced in that version.
If for some reason you want to use it with Python 3.6 you can install the backport of dataclasses for Python 3.6 with:
pip install dataclasses
Getting Started
Check out this minimal example to get started:
import oloren as olo
import pandas as pd
@olo.register(description="Basic math operations on two numbers.")
def operation(operation=olo.Choice(["Add", "Subtract", "Multiply", "Divide"]), a=olo.Num(), b=olo.Num()):
if operation == "Add":
return a + b
elif operation == "Subtract":
return a - b
elif operation == "Multiply":
return a * b
elif operation == "Divide":
return a / b
@olo.register(description="Convert CSV file to JSON")
def dataframe_to_json(csv_file=olo.File()):
return pd.read_csv(csv_file).to_json()
@olo.register(num_outputs=2)
def twooutputs(s=olo.String(), num=olo.Num()):
return s, num
if __name__ == "__main__":
olo.run("starterextension")
The key requirements are that each argument of your function has a default value that is set to one of the special Oloren types. These types subclass their relevant returned data types (e.g. string, int, float) so your autocomplete will work as normal.
Documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
oloren-0.0.30a0.tar.gz
(1.3 MB
view hashes)
Built Distribution
Close
Hashes for oloren-0.0.30a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79f2c11cd1f970425deec1815ad906958d2ed6ab707dee0349829d3e676075af |
|
MD5 | 68fc3a5df5409a6721c54c13c11749f3 |
|
BLAKE2b-256 | a7a37a9835d9e22497e64146f4926a404c0452150a679ac3b236f3506545173e |