Skip to main content

Sley

Complex workflows. Obvious code.

Python package TypeScript package GitHub stars

Sley turns tangled workflow logic into code your team can scan and change with confidence. Every possible path stays visible, the final state comes back directly, and your application remains ordinary Python or TypeScript.

Write ordinary functions, connect the paths they may take, and run the graph. Branching, fan-out, joins, retries, and nested workflows stay visible without handing your application to a framework.

Example: a release with two outcomes

The following program is a complete Sley graph. Low-risk work publishes now; high-risk work waits for review. Both allowed paths sit side by side, and the caller gets the resulting status directly.

Python

import asyncio

from sley import Flow, node


@node
def decide(context):
    action = "needs_review" if context.state["risk"] == "high" else "ready"
    context.emit(action)


@node
def publish(context):
    context.state["status"] = "published"


@node
def review(context):
    context.state["status"] = "waiting for review"


decide.link(publish, "ready")
decide.link(review, "needs_review")
release = Flow(decide)

for risk in ("low", "high"):
    state = asyncio.run(release.run({"risk": risk}))
    print(f"{risk}: {state['status']}")

TypeScript

import { Flow, node } from '@jigging/sley'

interface State {
  risk: 'low' | 'high'
  status?: string
}

const decide = node<State>((context) => {
  const action = context.state.risk === 'high' ? 'needs_review' : 'ready'
  context.emit(action)
})

const publish = node<State>((context) => {
  context.state.status = 'published'
})

const review = node<State>((context) => {
  context.state.status = 'waiting for review'
})

decide.link(publish, 'ready')
decide.link(review, 'needs_review')
const release = new Flow(decide)

for (const risk of ['low', 'high'] as const) {
  const state = await release.run({ risk })
  console.log(`${risk}: ${state.status}`)
}

Both programs print:

low: published
high: waiting for review

The decision stays inside decide; the allowed outcomes stay in its two links; the caller gets the final status from run(). No hidden handoff or terminal lookup is required.

Small by design

  • A node is one ordinary synchronous or asynchronous function.
  • A link makes one allowed next step visible.
  • emit() chooses one or more paths.
  • A Flow waits for those paths and run() returns their final shared state.

Use Sley when branching and synchronization have made a workflow's shape hard to see. Keep ordinary calls, conditions, loops, asyncio.gather, or Promise.all while they still explain the workflow clearly.

Install

pip install sley
npm install @jigging/sley

Python requires version 3.13 or newer. Package and runtime details live in the Python and TypeScript references.

Start learning

The Quickstart takes one file from installation to visible output. The Learn path then evolves that same release workflow from a linear graph through routing, branch data, fan-out, joins, nested boundaries, failure evidence, and advanced graph design.

Sley evolved through PocketFlow and Caskada. The lineage records what changed and which tradeoffs remain intentional.

License

Sley is licensed under the Mozilla Public License 2.0.

Download files

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

Source Distribution

sley-0.0.3.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

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

sley-0.0.3-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file sley-0.0.3.tar.gz.

File metadata

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

File hashes

Hashes for sley-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f9ec9f0278f671fdebb469f83545750416c5e6114aeec09f8dc63e80f553b376
MD5 bb5add4152420f2a0eb730d73f9079e2
BLAKE2b-256 d1c86f15596452f53a6a5e151fb3976b48cfe5ebd770c09daaab728d940ee39a

See more details on using hashes here.

Provenance

The following attestation bundles were made for sley-0.0.3.tar.gz:

Publisher: python-publish.yml on jigmd/sley

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

File details

Details for the file sley-0.0.3-py3-none-any.whl.

File metadata

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

File hashes

Hashes for sley-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 67b83bc009ada7ae4a49e7e88646a7531522ad084ead7d939e315be4f402703e
MD5 3ceec9d0b4e9c3638163a6f540249d71
BLAKE2b-256 b1e097e806846eb73b35fb6f220e2bbdb8ecd4c9aacb2cac04807d47de3e6d69

See more details on using hashes here.

Provenance

The following attestation bundles were made for sley-0.0.3-py3-none-any.whl:

Publisher: python-publish.yml on jigmd/sley

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.0.3 This release

2 files

0.0.2

2 files

0.0.1

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