Skip to main content
Slyme Logo

SLYME Lets You Mold Everything.

PyPI version Python version Documentation License

English | 简体中文

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 ARG, Arg, Context, R, 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():
    return llm_api(
        responses=R.output.responses,
        prompts=format_prompts(
            articles=R.input.articles(
                metadata={ARG: Arg(type=list[dict], required=True)}
            )
        ),
    ).add_wrappers(timing(prefix="LLM API Call"))


# 5. Execute at Run-Time
if __name__ == "__main__":
    responses = build_pipeline().run(
        inputs={R.input.articles: [
            {"title": "Article 1", "content": "Content 1"},
            {"title": "Article 2", "content": "Content 2"},
        ]},
        outputs=R.output.responses,
    )
    print(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 the Node lifecycle, please refer to our official documentation site.

👉 Read the Official Slyme Documentation

License

This project is licensed under the Apache-2.0 License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slyme-0.1.1.tar.gz (184.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slyme-0.1.1-py3-none-any.whl (89.1 kB view details)

Uploaded Python 3

File details

Details for the file slyme-0.1.1.tar.gz.

File metadata

  • Download URL: slyme-0.1.1.tar.gz
  • Upload date:
  • Size: 184.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for slyme-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1b2ed66803850e6a5569246984e6ec17d65585b9eb65291963d17fbc478ed3a0
MD5 d644e9097ad07f09d47bff5c3f13a73a
BLAKE2b-256 7b8bf405db6cc3192d4d737b7af3ef0942c50f58a700e92fbc6e5f834554b060

See more details on using hashes here.

Provenance

The following attestation bundles were made for slyme-0.1.1.tar.gz:

Publisher: publish.yml on slymelab/slyme

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slyme-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: slyme-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 89.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for slyme-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 94628cdeab659f62ccbe06b177383bf9bf78cd61e1ec3d60a6e791b6a3fbddab
MD5 f77b570bbd3c0fa3083f03fb880f987e
BLAKE2b-256 4a55d1a9e1b8355561de0b89d1c3518c5408d3ab1b1605df2e9da5104685f2dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for slyme-0.1.1-py3-none-any.whl:

Publisher: publish.yml on slymelab/slyme

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

0.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page