lmcode-python

lmcode-python is a pure-Python 3.9+ SDK (package lmcode) for loading, verifying, and executing lmcode DSLB v6 bytecode with zero third-party dependencies. It ships the 206-signature lmcode_std_v3 catalog, raw byte-string callback options, opt-in lmcode.rest stdio HTTP controller, and InvocationResults framing.

Quick reference

git clone https://github.com/lmctl-ai/lmcode-python.git
cd lmcode-python
python3 -m unittest discover -s tests
python3 -m lmcode.conformance conformance/vectors
ItemSignature / ValueRole
Registry()lmcode.RegistryCreate a registry preloaded with all 206 canonical lmcode_std_v3 signatures
Registry(include_std=False)lmcode.RegistryCreate an empty registry without the standard library catalog
load(bytecode, schema, registry)lmcode.ProgramVerify DSLB v6 header, SHA-256 schema hash, imports, and control-flow stack depths
program.run(context, registry)NoneExecute the verified program body against a Context
program.call(idx, context, registry, args)AnyInvoke an R49 rule entry by index or name
register_rest(registry, ...)lmcode.rest.RestControllerOpt in to the REST std module, binding its signatures to a configured stdio HTTP/1.1 and CLI controller
InvocationResults.from_command(files)lmcode.InvocationResultsRead LMCODE_INVOCATION_FILE, manage per-part ResultSinks, and write LMCODE_RETURN frames
from pathlib import Path
from lmcode import Context, Registry, load
from lmcode.rest import register_rest

registry = Registry()
rest = register_rest(registry, max_body_bytes=1 << 20)
program = load(Path("app.dslb").read_bytes(), Path("host.schema.json").read_bytes(), registry)
rest.run(program, Context())

Documentation pages

Source repository and releases