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.

Metadata

Release files for sley 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sley 0.0.3
File Size Uploaded Provenance
sley-0.0.3.tar.gz 14.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sley 0.0.3
File Interpreter ABI Platform
sley-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 28.6 kB

Release files / sley-0.0.3.tar.gz

Download URL sley-0.0.3.tar.gz
Size 14.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f9ec9f0278f671fdebb469f83545750416c5e6114aeec09f8dc63e80f553b376
BLAKE2b-256 checksum
How to use checksums
d1c86f15596452f53a6a5e151fb3976b48cfe5ebd770c09daaab728d940ee39a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / sley-0.0.3-py3-none-any.whl

Download URL sley-0.0.3-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67b83bc009ada7ae4a49e7e88646a7531522ad084ead7d939e315be4f402703e
BLAKE2b-256 checksum
How to use checksums
b1e097e806846eb73b35fb6f220e2bbdb8ecd4c9aacb2cac04807d47de3e6d69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Security for sley 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sley-0.0.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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