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.0-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.0-cp314-cp314t-manylinux_2_28_aarch64.whl (32.8 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ ARM64

rulex_runtime-1.0.0-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.0-cp314-cp314-manylinux_2_28_aarch64.whl (32.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.13tmanylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.13tmanylinux: glibc 2.28+ ARM64

rulex_runtime-1.0.0-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.0-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.0-cp314-cp314t-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for rulex_runtime-1.0.0-cp314-cp314t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f667e07205c0cf5c683e2af53d9b4866ce45472bc655eb0680b98d28183c2241
MD5 0f8c6f0705da20a3d9a0cfba3eddf02d
BLAKE2b-256 af52e38d7af81011e0b22580adcf5305664ad177831bb6997318429357cbba3b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rulex_runtime-1.0.0-cp314-cp314t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ce77b9aae3df6136d7231248139bffa3f37d3a744556e043de1c83d65aa5e1c9
MD5 52ab0409d0235b1267a8049071e3620e
BLAKE2b-256 ebde821975a6279ab2e2e18d1b0b7b8418cade833eb0f7510367c605df55fe1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rulex_runtime-1.0.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2a2f7a78836d2a52d9c322937bf1b8039201e256513e45837109abdbd0899d5e
MD5 48e382c31303473b19b8ae448199dbdb
BLAKE2b-256 ca4354069a1aa9ff3491ec5b86acc13bd55ed51b92675f6332b5400d4edb8606

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rulex_runtime-1.0.0-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1da5a558cee0ab26206a9075536c3e00f4ae509db81605e1aa4a9b4b96ee7a24
MD5 493fa6cdf1fd6e70dccdd051ede194c7
BLAKE2b-256 7a5d30359947fcadbab093359f074c649ca9d80f446c3586f635c5f9374d0fc7

See more details on using hashes here.

File details

Details for the file rulex_runtime-1.0.0-cp313-cp313t-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for rulex_runtime-1.0.0-cp313-cp313t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bb7dd5fe81d7cda7fb5058a30365efa524031ee4301856fb9b5cb14bd653587b
MD5 1a88cdfb8cd328b891c026fff9fa10d5
BLAKE2b-256 b6e0266d6ca4e460efcb10d2cca7703d456e983e9f2b6b42a1293c701d222d57

See more details on using hashes here.

File details

Details for the file rulex_runtime-1.0.0-cp313-cp313t-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for rulex_runtime-1.0.0-cp313-cp313t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bf3c70ac23136665518672573c53c51f0cc443ceebc587e3d94a064a5d2b2a7e
MD5 8e9bd0b4dc552b2913b13b9b3e74a2d5
BLAKE2b-256 8101fec579f72c3d857a8937b034b5e13da041fe62d6791c92feb07d3e910fc0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rulex_runtime-1.0.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 889c24949b277e2580422d8eaaa457f2b257ed0f250fb077671c53ac40b0f39b
MD5 495abbda39dc4ea5a70ad4932b2d668c
BLAKE2b-256 8325a012e05685c7c9f83cde8c44bc2d5a22c24602e12e091c2d3e687adcb45e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rulex_runtime-1.0.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6bfd5a14c754801362f26f361b636d618c54528139e4959f6ea4f4185d2cf89c
MD5 3765f7bde7cc75976735464864933457
BLAKE2b-256 b4f5ec27f53d0ae4b1096b1161ce75a6d6f2b386137dda1077934d2c09109f39

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