Skip to main content

Runtime engine to power RuleX APIs

Project description

rulex-runtime

Runtime engine powering the RuleX APIs. Executes pre-compiled WASM rule modules with high performance via LLVM-backed AOT compilation.

Features

  • Execute compiled rule modules (.wasmu) against spreadsheet-like cell inputs
  • AOT-compiled WASM via LLVM for maximum execution performance
  • Multi-version executor support — artifacts are version-locked and multiple executor versions are bundled
  • Thread-safe, concurrent execution
  • Supports free-threaded Python (3.13t, 3.14t)

Requirements

  • Linux x86_64 or aarch64
  • Python 3.13+

Usage

import rulex_runtime

# Initialize the runner (optionally specify max concurrency and max memory for calculator cache)
runner = rulex_runtime.initialize()

# Load a pre-compiled .wasmu artifact
wasmu_path = pathlib.Path("rule.wasmu")

# Compile a .wasm module to a portable .wasmu artifact
wasm_bytes = pathlib.Path("rule.wasm").read_bytes()
wasmu_path.write_bytes(rulex_runtime.compile_wasm(wasm_bytes))

# Get the corresponding Calculator instance
calculator = runner.get_calculator(wasmu_path)

# Run a calculation
cell_ref = rulex_runtime.CellRef("Sheet1", "A1")
result = calculator.run(
    inputs={cell_ref: 42},
    outputs={cell_ref},
)
print(result.output)
print(result.cacheable)

# Validate inputs without specifying outputs
cacheable = calculator.validate(inputs={cell_ref: 42})
print(cacheable)

Concurrency

Calculator is thread-safe. calculator.run() is fully isolated and does not mutate any shared state, so it can be called concurrently from multiple threads with different inputs and outputs.

The concurrency parameter to initialize() controls the size of the executor thread pool. It should not exceed the total number of physical CPU cores on the machine. When running the runtime across multiple processes, ensure that the sum across all processes respects this constraint:

process_count × concurrency ≤ physical_cpu_count

The calculator_cache parameter to initialize() controls the LRU cache size of calculators. Calculator memory usage is estimated on a best-effort basis. So, it is advised to keep some margin based on the total memory available on the machine.

Supported Interfaces

rulex_runtime.SUPPORTED_INTERFACES is a frozenset of int indicating which interface versions are available.

Compilation

bytes returned by compile_wasm() are only compatible with the executor version (i.e. EXECUTOR_VERSION) used to compile it. Caller is advised to keep track of the EXECUTOR_VERSION for the returned binary.

If the content of path passed to get_calculator() does not correspond with the current executor version (EXECUTOR_VERSION), then InternalError will be raised.

License

Proprietary — Copyright © CoverStack Technologies. All rights reserved.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

rulex_runtime-1.0.1-cp314-cp314t-manylinux_2_28_x86_64.whl (33.6 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ x86-64

rulex_runtime-1.0.1-cp314-cp314t-manylinux_2_28_aarch64.whl (32.8 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ ARM64

rulex_runtime-1.0.1-cp314-cp314-manylinux_2_28_x86_64.whl (33.6 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

rulex_runtime-1.0.1-cp314-cp314-manylinux_2_28_aarch64.whl (32.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

rulex_runtime-1.0.1-cp313-cp313-manylinux_2_28_x86_64.whl (33.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

rulex_runtime-1.0.1-cp313-cp313-manylinux_2_28_aarch64.whl (32.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

File details

Details for the file rulex_runtime-1.0.1-cp314-cp314t-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for rulex_runtime-1.0.1-cp314-cp314t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c85b500eccf0eec4a2349f28d1acca492219116a2a49521edd18a726085510c5
MD5 211f95c95733acf7558b40c0c45e0a76
BLAKE2b-256 5092a6a6b96b514276440821100a77c3f72fd57fe82f17eaabd3ad20d73acae4

See more details on using hashes here.

File details

Details for the file rulex_runtime-1.0.1-cp314-cp314t-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for rulex_runtime-1.0.1-cp314-cp314t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 63fa593d73bb35592512750a9942e5cf8d3543817f84894e38c1ae3562702fc0
MD5 5452967a36c5e6df433d58441636782e
BLAKE2b-256 9e1f3e5204610472e58cef32e637770b13ac0b66627432b3f3c775599f69fec7

See more details on using hashes here.

File details

Details for the file rulex_runtime-1.0.1-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for rulex_runtime-1.0.1-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9ca95a84095cca91ced6f80c701124e77a514fea0bf489b298fa17c9a56ba487
MD5 1dddd5119600c1f4534bea358bac8be3
BLAKE2b-256 bc503efcdd9786feb5e1cdc5bc07fe6e9e8897665aa5c8028003f0c20892d4e2

See more details on using hashes here.

File details

Details for the file rulex_runtime-1.0.1-cp314-cp314-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for rulex_runtime-1.0.1-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a0cf0a09696240014b5f4ba9639e4b593841aa62c9479227cbd4032ede708ae1
MD5 99bfe45e07d1e5ebeca309597ba57eab
BLAKE2b-256 65d30fac77fba02ce7f6e12d0c46bd329e30aed86ae683d4692d42a1576eef4a

See more details on using hashes here.

File details

Details for the file rulex_runtime-1.0.1-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for rulex_runtime-1.0.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 90c14501623c1059cd1db367362ba8d0646b562134cc6277280d9ca777e42b76
MD5 d857e63ee327d0f567c7c148f3eb4134
BLAKE2b-256 0a0fd412b291bce1f8a22df25b773f19a1272bea2284a569cee5d1455ce96a80

See more details on using hashes here.

File details

Details for the file rulex_runtime-1.0.1-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for rulex_runtime-1.0.1-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3acaf6afdfd032344d2d5c1188a0e7805752a6489b087febd44083119144bdb3
MD5 1bb608f96465b200ebfe6327664ba5e1
BLAKE2b-256 cb2d0881ee988933264a35d9f8414c17d7f5123bbe74a64213bca7477cc475b4

See more details on using hashes here.

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