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.3.3.tar.gz (130.5 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.3.3-py3-none-any.whl (253.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for kirun_py-3.3.3.tar.gz
Algorithm Hash digest
SHA256 abc7635d30b4863e2898401da78b9bb08496fe857d0e0b290fcf24a717342506
MD5 7b0f740744482bf2ff5fb15d1bdeb430
BLAKE2b-256 e0ef49009d943c9ccbeae32d8a23f929d1a1d97e6503f7f7f1567dcadea0c60b

See more details on using hashes here.

Provenance

The following attestation bundles were made for kirun_py-3.3.3.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.3.3-py3-none-any.whl.

File metadata

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

File hashes

Hashes for kirun_py-3.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8b06a6165a36510ac49d1e3a98b7d5f3a5860656fab02fe203fb3627d674532e
MD5 9176f4bda260a7d97d8c9d514630e7e9
BLAKE2b-256 ef2363499dcad93f5822d67058322a3d57c6b35688d826c1282362b323c45e80

See more details on using hashes here.

Provenance

The following attestation bundles were made for kirun_py-3.3.3-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