Python wrapper for the mlld CLI
Project description
mlld Python SDK
Python wrapper for mlld using a persistent NDJSON RPC transport over mlld live --stdio.
Installation
pip install mlld-sdk
Requirements
- Python 3.10+
- Node.js runtime
- mlld CLI available by command path
Quick Start
from mlld import Client
client = Client()
# Optional command override (local repo build example)
# client = Client(command='node', command_args=['./dist/cli.cjs'])
output = client.process('show "Hello World"')
print(output)
result = client.execute(
'./agent.mld',
{'text': 'hello'},
state={'count': 0},
dynamic_modules={
'@config': {'mode': 'demo'}
},
timeout=10,
)
print(result.output)
client.close()
In-Flight State Updates
handle = client.process_async(
'loop(99999, 50ms) until @state.exit [\n continue\n]\nshow "done"',
state={'exit': False},
mode='strict',
timeout=10,
)
time.sleep(0.12)
handle.update_state('exit', True)
print(handle.result())
API
Client
Client(command='mlld', command_args=None, timeout=30.0, working_dir=None)process(script, *, file_path=None, payload=None, state=None, dynamic_modules=None, dynamic_module_source=None, mode=None, allow_absolute_paths=None, timeout=None)process_async(...) -> ProcessHandleexecute(filepath, payload=None, *, state=None, dynamic_modules=None, dynamic_module_source=None, allow_absolute_paths=None, mode=None, timeout=None)execute_async(...) -> ExecuteHandleanalyze(filepath)close()
Handle Methods
ProcessHandle and ExecuteHandle both provide:
request_idcancel()update_state(path, value, *, timeout=None)wait()result()
Module-level Convenience Functions
mlld.process(...)mlld.process_async(...)mlld.execute(...)mlld.execute_async(...)mlld.analyze(...)
Notes
- Each
Clientkeeps one live RPC subprocess for repeated calls. ExecuteResult.state_writesmerges final-result writes and streamedstate:writeevents.- Sync methods remain as wrappers around async handle methods.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mlld_sdk-2.0.0.tar.gz.
File metadata
- Download URL: mlld_sdk-2.0.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bb6be699c4a4548e1c4b29a1c33a434671b48848646c9ed67de718ebcacc5ee
|
|
| MD5 |
3caa9c8f67436888b044c8d08c45f602
|
|
| BLAKE2b-256 |
2f0471086f3012766bda5941890ec07910456677da03a09228c101b5b84fb1cb
|
Provenance
The following attestation bundles were made for mlld_sdk-2.0.0.tar.gz:
Publisher:
publish.yml on mlld-lang/mlld
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mlld_sdk-2.0.0.tar.gz -
Subject digest:
4bb6be699c4a4548e1c4b29a1c33a434671b48848646c9ed67de718ebcacc5ee - Sigstore transparency entry: 1004164302
- Sigstore integration time:
-
Permalink:
mlld-lang/mlld@1b7b0951cebf9d04b4ca8d3343a105298983b603 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mlld-lang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1b7b0951cebf9d04b4ca8d3343a105298983b603 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mlld_sdk-2.0.0-py3-none-any.whl.
File metadata
- Download URL: mlld_sdk-2.0.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ca69f5b82e6a4c4a667d2d4f31a5fcef37bde825212d5fb0ce134fe569d609a
|
|
| MD5 |
9e0d878f5992736a23fb01ca984a5b78
|
|
| BLAKE2b-256 |
08dfda253cbd895c0597be1e7b6c412f24cea1766047af01e0bb94a6e6e88879
|
Provenance
The following attestation bundles were made for mlld_sdk-2.0.0-py3-none-any.whl:
Publisher:
publish.yml on mlld-lang/mlld
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mlld_sdk-2.0.0-py3-none-any.whl -
Subject digest:
3ca69f5b82e6a4c4a667d2d4f31a5fcef37bde825212d5fb0ce134fe569d609a - Sigstore transparency entry: 1004164305
- Sigstore integration time:
-
Permalink:
mlld-lang/mlld@1b7b0951cebf9d04b4ca8d3343a105298983b603 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mlld-lang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1b7b0951cebf9d04b4ca8d3343a105298983b603 -
Trigger Event:
push
-
Statement type: