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.2.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.2-py3-none-any.whl (253.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kirun_py-3.3.2.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.2.tar.gz
Algorithm Hash digest
SHA256 4e899ff3c8dcf780955e56a26166f61b1ad42ba711b6612a3eae6d676c579b9a
MD5 17e0a9be46c926c321a4532aeaa7d214
BLAKE2b-256 f144e7070ac474c19064348cf5995fa03b9c96a818a27a5456940f1b9b26a989

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: kirun_py-3.3.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 12c94e465195b913b7c4295131890bb07c7b26df12acd5856a9fc421bda86279
MD5 4279c54e7615dfed919c44015b256b99
BLAKE2b-256 b9f2dc67c6ee2f088b1732cf4f988f59c58e9283735be94dff4c8e82e48cf198

See more details on using hashes here.

Provenance

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