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
| Item | Signature / Value | Role |
|---|---|---|
| Registry() | lmcode.Registry | Create a registry preloaded with all 206 canonical lmcode_std_v3 signatures |
| Registry(include_std=False) | lmcode.Registry | Create an empty registry without the standard library catalog |
| load(bytecode, schema, registry) | lmcode.Program | Verify DSLB v6 header, SHA-256 schema hash, imports, and control-flow stack depths |
| program.run(context, registry) | None | Execute the verified program body against a Context |
| program.call(idx, context, registry, args) | Any | Invoke an R49 rule entry by index or name |
| register_rest(registry, ...) | lmcode.rest.RestController | Opt in to the REST std module, binding its signatures to a configured stdio HTTP/1.1 and CLI controller |
| InvocationResults.from_command(files) | lmcode.InvocationResults | Read 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())