Slyme is a highly composable functional execution framework.
Project description
About Slyme
Slyme (pronounced /slaɪm/) is a highly composable functional execution framework. It enables developers to seamlessly build arbitrarily complex execution flows based on simple, reusable functions, without needing to master cumbersome APIs or syntax.
Whether you are building complex LLM pipelines, executing DAGs, or creating generic data-processing flows, Slyme provides a structural, functional, and deeply Pythonic foundation.
Installation
Slyme requires Python 3.9+. You can install it directly via pip:
pip install slyme
(Note: Slyme is extremely lightweight and its only main dependency is typing_extensions.)
Quick Start
Here is a quick example demonstrating how to build a simple execution pipeline using Slyme's core primitives (@node, @expression, @wrapper, and @builder):
from time import time
from collections.abc import Callable
from slyme.builder import builder
from slyme.context import Context, Ref
from slyme.node import node, expression, wrapper, Auto, Node
# 1. Define an execution node
@node
def llm_api(ctx: Context, /, *, prompts: Auto[list[str]], responses: Ref[list[str]]):
responses_ = [f"Response to the prompt: {prompt}" for prompt in prompts]
return ctx.set(responses, responses_)
# 2. Define an expression for data transformation
@expression
def format_prompts(ctx: Context, /, *, articles: Auto[list[dict]]) -> list[str]:
return [
f"Summarize: {article['title']}. Content: {article['content']}"
for article in articles
]
# 3. Define a wrapper for middleware (e.g., performance timing)
@wrapper
def timing(ctx: Context, wrapped: Node, call_next: Callable[[Context], Context], /, *, prefix: str) -> Context:
start_time = time()
ctx = call_next(ctx)
end_time = time()
print(f"[{prefix}] Finished successfully in {end_time - start_time:.4f} seconds.")
return ctx
# 4. Assemble the pipeline at Build-Time
@builder
def build_pipeline():
scope = {
"articles": Ref("input.articles"),
"responses": Ref("output.responses"),
}
return llm_api(
scope,
prompts=format_prompts(scope),
).add_wrappers(timing(prefix="LLM API Call"))
# 5. Execute at Run-Time
if __name__ == "__main__":
# Inject initial data into Context
ctx = Context().update({
Ref("input.articles"): [
{"title": "Article 1", "content": "Content 1"},
{"title": "Article 2", "content": "Content 2"},
],
})
# Prepare and run
pipeline_exec = build_pipeline().prepare()
ctx = pipeline_exec(ctx)
print(ctx.get(Ref("output.responses")))
Core Advantages
Native Python Development Experience: Eliminates heavy object-oriented boilerplate code. You only need to master basic Python functions and native data structures (dictionaries, lists, tuples) to get started quickly.
Unlimited Composability: Build arbitrarily complex execution flows with complete decoupling. Thanks to PyTree augmentation, Node containment relationships can be represented directly through native Python structures.
Functional & Concurrency Safety: The state exchanged between execution units (Context) is structurally immutable, utilizing a Copy-On-Write mechanism to make state management under concurrent execution simple and safe.
Seamless Collaboration: Highly decoupled Nodes communicate exclusively through Context. This allows teams to independently develop features and write unit tests, reducing "glue code" and deep system coupling.
Documentation
To dive deeper into Slyme's architecture, including Context management, Dependency Injection, and Lifecycle hooks, please refer to our official documentation site.
👉 Read the Official Slyme Documentation
License
This project is licensed under the Apache-2.0 License.
Project details
Release history Release notifications | RSS feed
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 slyme-0.1.0.tar.gz.
File metadata
- Download URL: slyme-0.1.0.tar.gz
- Upload date:
- Size: 151.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2fbcdb00c8351c7eb4187030aee5f7aba90e8a12a01ec228683e50d157a73d0
|
|
| MD5 |
9daef6952edc220c443452f0b9aca9bd
|
|
| BLAKE2b-256 |
176b97501ae8b776fbba65f5be079296be88eca516bbfdbdc43153e2190c489c
|
Provenance
The following attestation bundles were made for slyme-0.1.0.tar.gz:
Publisher:
publish.yml on slymelab/slyme
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
slyme-0.1.0.tar.gz -
Subject digest:
c2fbcdb00c8351c7eb4187030aee5f7aba90e8a12a01ec228683e50d157a73d0 - Sigstore transparency entry: 1279149709
- Sigstore integration time:
-
Permalink:
slymelab/slyme@749667730e0830aaf8e18144d44513a4079d1dab -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/slymelab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@749667730e0830aaf8e18144d44513a4079d1dab -
Trigger Event:
push
-
Statement type:
File details
Details for the file slyme-0.1.0-py3-none-any.whl.
File metadata
- Download URL: slyme-0.1.0-py3-none-any.whl
- Upload date:
- Size: 58.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59f06ad708c2cac0d35d3d7f175fe73f552f01cf3c1dee20be90fa9e706c44d1
|
|
| MD5 |
2b054482815fbcfd0db0f1676611244d
|
|
| BLAKE2b-256 |
b826a9af684e514eed81030f50e7bf83e5ee2c7551ad1e593e11e91f33e48f80
|
Provenance
The following attestation bundles were made for slyme-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on slymelab/slyme
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
slyme-0.1.0-py3-none-any.whl -
Subject digest:
59f06ad708c2cac0d35d3d7f175fe73f552f01cf3c1dee20be90fa9e706c44d1 - Sigstore transparency entry: 1279149767
- Sigstore integration time:
-
Permalink:
slymelab/slyme@749667730e0830aaf8e18144d44513a4079d1dab -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/slymelab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@749667730e0830aaf8e18144d44513a4079d1dab -
Trigger Event:
push
-
Statement type: