Skip to main content

Python Runtime for Kinetic Instructions

Project description

kirun-py

Python runtime for KIRun — the Kinetic Instructions execution engine used by the Modlix no-code/low-code platform.

Installation

pip install kirun-py

Overview

KIRun executes FunctionDefinition graphs (DAGs) with:

  • Expression evaluation — arithmetic, logical, string, ternary operators
  • Schema validation — JSON Schema-based type checking
  • 100+ built-in functions — Math, String, Array, Object, Date, JSON, Loop, Context
  • Async execution — full async/await support
  • Debug support — execution tracing and performance profiling

Quick Start

import asyncio
import json
from kirun_py.model.function_definition import FunctionDefinition
from kirun_py.runtime.ki_runtime import KIRuntime
from kirun_py.runtime.function_execution_parameters import FunctionExecutionParameters
from kirun_py.repository.ki_run_function_repository import KIRunFunctionRepository
from kirun_py.repository.ki_run_schema_repository import KIRunSchemaRepository

fd = FunctionDefinition.from_value(json.loads("""
{
    "name": "AddTwo",
    "namespace": "MyApp",
    "parameters": {
        "a": { "parameterName": "a", "schema": { "name": "a", "type": "INTEGER" } },
        "b": { "parameterName": "b", "schema": { "name": "b", "type": "INTEGER" } }
    },
    "events": {
        "output": {
            "name": "output",
            "parameters": { "result": { "name": "result", "type": "INTEGER" } }
        }
    },
    "steps": {
        "gen": {
            "statementName": "gen",
            "namespace": "System",
            "name": "GenerateEvent",
            "parameterMap": {
                "eventName": { "one": { "key": "one", "type": "VALUE", "value": "output" } },
                "results": {
                    "one": {
                        "key": "one", "type": "VALUE",
                        "value": {
                            "name": "result",
                            "value": { "isExpression": true, "value": "Arguments.a + Arguments.b" }
                        }
                    }
                }
            }
        }
    }
}
"""))

async def main():
    runtime = KIRuntime(fd)
    repo = KIRunFunctionRepository()
    schema_repo = KIRunSchemaRepository()
    output = await runtime.execute(
        FunctionExecutionParameters(repo, schema_repo)
            .set_arguments({"a": 3, "b": 4})
    )
    result = output.next()
    print(result.get_result().get("result"))  # 7

asyncio.run(main())

Built-in Function Namespaces

Namespace Functions
System If, GenerateEvent, Print, Wait, Make, ValidateSchema
System.Math Add, Subtract, Multiply, Divide, Power, Abs, Floor, Ceil, Round, Random, Min, Max, ...
System.String Concat, Split, Trim, Replace, IndexOf, SubString, ToUpperCase, ToLowerCase, ...
System.Array AddElement, RemoveElement, Sort, Filter, Map, Reduce, IndexOf, Reverse, ...
System.Object Get, Set, Keys, Values, Entries, Merge
System.Date Now, Format, Parse, AddDuration, Difference, StartOf, EndOf, ...
System.Loop RangeLoop, CountLoop, ForEachLoop, Break
System.Context Create, Get, Set
System.JSON Parse, Stringify

Requirements

  • Python >= 3.9
  • python-dateutil >= 2.8

License

MIT

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

kirun_py-3.4.0.tar.gz (130.7 kB view details)

Uploaded Source

Built Distribution

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

kirun_py-3.4.0-py3-none-any.whl (254.0 kB view details)

Uploaded Python 3

File details

Details for the file kirun_py-3.4.0.tar.gz.

File metadata

  • Download URL: kirun_py-3.4.0.tar.gz
  • Upload date:
  • Size: 130.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for kirun_py-3.4.0.tar.gz
Algorithm Hash digest
SHA256 6e565378acb80b015b8bed14fe57feb2a9c2f826cc602ffb5b0a529c33ce4d57
MD5 0568f1a9dcd535e769407159fed9bd8c
BLAKE2b-256 6dedda4292634dc6e82b308f4dbc92ec31202fef8e93a76dc0544cef88ceeb99

See more details on using hashes here.

Provenance

The following attestation bundles were made for kirun_py-3.4.0.tar.gz:

Publisher: python-publish.yml on modlix-india/nocode-kirun

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kirun_py-3.4.0-py3-none-any.whl.

File metadata

  • Download URL: kirun_py-3.4.0-py3-none-any.whl
  • Upload date:
  • Size: 254.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for kirun_py-3.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00092e5c1a19c66dc8c797baac773c2eab995c859894d8da50d32648fe04bf53
MD5 04d46d3727d9693d573832995425ce80
BLAKE2b-256 8235c69ae67fc5d99126e1c0ae0b8df7d61b887ae1b1f0664b2159e3477d4edf

See more details on using hashes here.

Provenance

The following attestation bundles were made for kirun_py-3.4.0-py3-none-any.whl:

Publisher: python-publish.yml on modlix-india/nocode-kirun

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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