Complex workflows. Obvious code.
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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9ec9f0278f671fdebb469f83545750416c5e6114aeec09f8dc63e80f553b376
|
|
| MD5 |
bb5add4152420f2a0eb730d73f9079e2
|
|
| BLAKE2b-256 |
d1c86f15596452f53a6a5e151fb3976b48cfe5ebd770c09daaab728d940ee39a
|
Provenance
The following attestation bundles were made for sley-0.0.3.tar.gz:
Publisher:
python-publish.yml on jigmd/sley
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sley-0.0.3.tar.gz -
Subject digest:
f9ec9f0278f671fdebb469f83545750416c5e6114aeec09f8dc63e80f553b376 - Sigstore transparency entry: 2588243119
- Sigstore integration time:
-
Permalink:
jigmd/sley@34b068c3fdbbaaf4f234b40a5ccf7e536fad9283 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jigmd
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@34b068c3fdbbaaf4f234b40a5ccf7e536fad9283 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67b83bc009ada7ae4a49e7e88646a7531522ad084ead7d939e315be4f402703e
|
|
| MD5 |
3ceec9d0b4e9c3638163a6f540249d71
|
|
| BLAKE2b-256 |
b1e097e806846eb73b35fb6f220e2bbdb8ecd4c9aacb2cac04807d47de3e6d69
|
Provenance
The following attestation bundles were made for sley-0.0.3-py3-none-any.whl:
Publisher:
python-publish.yml on jigmd/sley
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sley-0.0.3-py3-none-any.whl -
Subject digest:
67b83bc009ada7ae4a49e7e88646a7531522ad084ead7d939e315be4f402703e - Sigstore transparency entry: 2588243759
- Sigstore integration time:
-
Permalink:
jigmd/sley@34b068c3fdbbaaf4f234b40a5ccf7e536fad9283 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jigmd
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@34b068c3fdbbaaf4f234b40a5ccf7e536fad9283 -
Trigger Event:
push
-
Statement type: