graphk 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,39 @@
1
+ # --- Python Environment & Caches ---
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ .venv/
6
+ venv/
7
+ ENV/
8
+ .env
9
+ .pypirc
10
+ .DS_Store
11
+ .DS_Store/
12
+ /*.txt
13
+
14
+ # --- Embedded development packages ---
15
+ #graphk/
16
+
17
+ # --- Build & Distribution ---
18
+ # These are generated by 'python -m build'
19
+ dist/
20
+ build/
21
+ *.egg-info
22
+ *.egg-info/
23
+ *.egg
24
+ nosetests.xml
25
+ coverage.xml
26
+ *.cover
27
+ .hypothesis/
28
+
29
+ # --- macOS System Files ---
30
+ .DS_Store
31
+ .AppleDouble
32
+ .LSOverride
33
+
34
+ # --- IDEs & Editors ---
35
+ .vscode/
36
+ .idea/
37
+ *.swp
38
+ *.swo
39
+
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Dr. Fernando Koch
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
graphk-1.0.2/PKG-INFO ADDED
@@ -0,0 +1,220 @@
1
+ Metadata-Version: 2.4
2
+ Name: graphk
3
+ Version: 1.0.2
4
+ Summary: Framework for Graph-based execution and pipeline programming
5
+ Project-URL: Homepage, https://github.com/kochf1/graphk
6
+ Project-URL: Repository, https://github.com/kochf1/graphk
7
+ Project-URL: Documentation, https://github.com/kochf1/graphk/wiki
8
+ Project-URL: Issues, https://github.com/kochf1/graphk/issues
9
+ Author-email: Fernando Koch <kochf@fau.edu>
10
+ License: MIT
11
+ License-File: LICENSE.txt
12
+ Keywords: execution,graph,pipeline,runtime,workflow
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Libraries
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+
27
+ # GraphK
28
+
29
+ <div align="left">
30
+ <a href="https://github.com/kochf1/graphk"><img src="https://img.shields.io/badge/GraphK-Toolkit-blueviolet?style=for-the-badge&logo=openai&logoColor=white" alt="GraphK Toolkit" /></a>
31
+ <img src="https://img.shields.io/badge/Python-3.10%2B-3776AB?style=for-the-badge&logo=python&logoColor=white" alt="Python 3.10+" />
32
+ <img src="https://img.shields.io/badge/License-MIT-green?style=for-the-badge" alt="License" />
33
+ </div>
34
+
35
+ ---
36
+
37
+ ## Overview
38
+
39
+ GraphK provides the core execution model for graph-based
40
+ programming. It defines pipelines as executable graphs composed of
41
+ nodes, branches, and nested pipelines, with explicit control flow
42
+ and runtime semantics.
43
+
44
+ GraphK treats execution as an explicit graph providing representation for
45
+ state, policy, scope, and control flow. The goal is to keep execution
46
+ understandable, inspectable, and composable.
47
+
48
+ ### Why This Project Exists
49
+
50
+ Many workflow systems, agent systems, and orchestration layers
51
+ accumulate implicit behavior over time: hidden state propagation,
52
+ scattered branching logic, and unclear lifecycle boundaries.
53
+ GraphK exists to provide a small reusable execution kernel where:
54
+
55
+ - flow control is modeled explicitly
56
+ - state resolution follows clear hierarchical rules
57
+ - validation is attached to execution boundaries
58
+ - complex orchestration can be built from simple, inspectable parts
59
+
60
+ GraphK gives you a small set of composable primitives for building
61
+ executable graphs:
62
+
63
+ - `Store` and `Matcher` for hierarchical state and rule evaluation
64
+ - `Session`, `Context`, and `Policy` for runtime state, scoped
65
+ configuration, and validation
66
+ - `Node` as the executable unit
67
+ - `Pipeline`, `SequencePipe`, `BranchPipe`, and `MultiPipe` for
68
+ orchestration
69
+ - `Runner` for managed end-to-end execution
70
+ - `Emitter` for request/response-style execution on top of
71
+ `Runner` and `Session`
72
+
73
+ Learn more about the core architecture on the Wiki pages:
74
+ [GraphK Wiki](https://github.com/kochf1/graphk/wiki)
75
+
76
+ ## Getting Started
77
+
78
+ Install from PyPI when published:
79
+
80
+ ```bash
81
+ pip install graphk
82
+ ```
83
+
84
+ The examples below assume the package is installed and imported as
85
+ `graphk`.
86
+
87
+ ### Shared Demo Nodes
88
+
89
+ GraphK includes a small set of reusable basic nodes for common
90
+ pipeline operations. These are not test-only helpers. They are
91
+ general-purpose building blocks for simple executable graphs.
92
+
93
+ - `graphk.EchoNode` for minimal request/response flows
94
+ - `graphk.ApplyNode` for applying a callable to the active session
95
+ - `graphk.IncrementNode` for incrementing numeric session fields
96
+ - `graphk.ConcatNode` for string accumulation
97
+ - `graphk.RouteNode` for branch-routing flows
98
+
99
+ Learn more about the built-in node helpers on the Wiki pages:
100
+ [Demo Nodes](https://github.com/kochf1/graphk/wiki)
101
+
102
+ ### Example 1: A Simple Sequence
103
+
104
+ This is the smallest useful GraphK workflow: a sequence pipeline
105
+ executed through an `Emitter`.
106
+
107
+ ```python
108
+ import graphk
109
+
110
+
111
+ pipeline = graphk.SequencePipe(
112
+ nodes=[
113
+ graphk.IncrementNode(
114
+ "A",
115
+ increment=1,
116
+ target_key="counter",
117
+ order_key="order",
118
+ response=True,
119
+ ),
120
+ graphk.IncrementNode(
121
+ "B",
122
+ increment=2,
123
+ target_key="counter",
124
+ order_key="order",
125
+ response=True,
126
+ ),
127
+ graphk.IncrementNode(
128
+ "C",
129
+ increment=3,
130
+ target_key="counter",
131
+ order_key="order",
132
+ response=True,
133
+ ),
134
+ ]
135
+ )
136
+
137
+ emitter = graphk.Emitter(pipeline)
138
+ emitter.request({"counter": 0})
139
+
140
+ print(emitter.response())
141
+ ```
142
+
143
+ Expected result:
144
+
145
+ ```python
146
+ {"counter": 6, "order": ["A", "B", "C"]}
147
+ ```
148
+
149
+ ### Example 2: A Branched Sequence
150
+
151
+ This example shows how GraphK routes execution through one branch
152
+ selected from runtime state.
153
+
154
+ ```python
155
+ import graphk
156
+
157
+
158
+ branch = graphk.BranchPipe(
159
+ nodes=[
160
+ (
161
+ graphk.Matcher(task="route-a"),
162
+ graphk.SequencePipe(nodes=[graphk.RouteNode("A")]),
163
+ ),
164
+ (
165
+ graphk.Matcher(task="route-b"),
166
+ graphk.SequencePipe(nodes=[graphk.RouteNode("B")]),
167
+ ),
168
+ (
169
+ graphk.Matcher(task="route-c"),
170
+ graphk.SequencePipe(nodes=[graphk.RouteNode("C")]),
171
+ ),
172
+ ]
173
+ )
174
+
175
+ pipeline = graphk.SequencePipe(nodes=[branch])
176
+ emitter = graphk.Emitter(pipeline)
177
+
178
+ emitter.request({"task": "route-b"})
179
+ print(emitter.response())
180
+ ```
181
+
182
+ Expected result:
183
+
184
+ ```python
185
+ {"route": "B"}
186
+ ```
187
+
188
+
189
+ ## Learn by Examples
190
+
191
+ All runnable examples are available in
192
+ [`examples`](examples), and they can be executed together with:
193
+
194
+ ```bash
195
+ bash examples/example.sh
196
+ ```
197
+
198
+ - [`examples/example_1.py`](examples/example_1.py) - Simple
199
+ emitter request and response
200
+ - [`examples/example_2.py`](examples/example_2.py) - Multi-step
201
+ sequence execution
202
+ - [`examples/example_3.py`](examples/example_3.py) - Context-driven
203
+ sequence
204
+ - [`examples/example_4.py`](examples/example_4.py) - Nested
205
+ sequence pipelines
206
+ - [`examples/example_5.py`](examples/example_5.py) - Branch routing
207
+ with `BranchPipe`
208
+ - [`examples/example_6.py`](examples/example_6.py) - `MultiPipe`
209
+ fan-out
210
+ - [`examples/example_7.py`](examples/example_7.py) - Policy-governed
211
+ execution
212
+ - [`examples/example_8.py`](examples/example_8.py) - Hierarchical
213
+ memory resolution
214
+ - [`examples/example_9.py`](examples/example_9.py) - Graceful early
215
+ stop with `CUT`
216
+ - [`examples/example_10.py`](examples/example_10.py) - Error
217
+ rollback during execution
218
+
219
+ Learn more about each area on the Wiki pages:
220
+ [GraphK Wiki](https://github.com/kochf1/graphk/wiki)
graphk-1.0.2/README.md ADDED
@@ -0,0 +1,194 @@
1
+ # GraphK
2
+
3
+ <div align="left">
4
+ <a href="https://github.com/kochf1/graphk"><img src="https://img.shields.io/badge/GraphK-Toolkit-blueviolet?style=for-the-badge&logo=openai&logoColor=white" alt="GraphK Toolkit" /></a>
5
+ <img src="https://img.shields.io/badge/Python-3.10%2B-3776AB?style=for-the-badge&logo=python&logoColor=white" alt="Python 3.10+" />
6
+ <img src="https://img.shields.io/badge/License-MIT-green?style=for-the-badge" alt="License" />
7
+ </div>
8
+
9
+ ---
10
+
11
+ ## Overview
12
+
13
+ GraphK provides the core execution model for graph-based
14
+ programming. It defines pipelines as executable graphs composed of
15
+ nodes, branches, and nested pipelines, with explicit control flow
16
+ and runtime semantics.
17
+
18
+ GraphK treats execution as an explicit graph providing representation for
19
+ state, policy, scope, and control flow. The goal is to keep execution
20
+ understandable, inspectable, and composable.
21
+
22
+ ### Why This Project Exists
23
+
24
+ Many workflow systems, agent systems, and orchestration layers
25
+ accumulate implicit behavior over time: hidden state propagation,
26
+ scattered branching logic, and unclear lifecycle boundaries.
27
+ GraphK exists to provide a small reusable execution kernel where:
28
+
29
+ - flow control is modeled explicitly
30
+ - state resolution follows clear hierarchical rules
31
+ - validation is attached to execution boundaries
32
+ - complex orchestration can be built from simple, inspectable parts
33
+
34
+ GraphK gives you a small set of composable primitives for building
35
+ executable graphs:
36
+
37
+ - `Store` and `Matcher` for hierarchical state and rule evaluation
38
+ - `Session`, `Context`, and `Policy` for runtime state, scoped
39
+ configuration, and validation
40
+ - `Node` as the executable unit
41
+ - `Pipeline`, `SequencePipe`, `BranchPipe`, and `MultiPipe` for
42
+ orchestration
43
+ - `Runner` for managed end-to-end execution
44
+ - `Emitter` for request/response-style execution on top of
45
+ `Runner` and `Session`
46
+
47
+ Learn more about the core architecture on the Wiki pages:
48
+ [GraphK Wiki](https://github.com/kochf1/graphk/wiki)
49
+
50
+ ## Getting Started
51
+
52
+ Install from PyPI when published:
53
+
54
+ ```bash
55
+ pip install graphk
56
+ ```
57
+
58
+ The examples below assume the package is installed and imported as
59
+ `graphk`.
60
+
61
+ ### Shared Demo Nodes
62
+
63
+ GraphK includes a small set of reusable basic nodes for common
64
+ pipeline operations. These are not test-only helpers. They are
65
+ general-purpose building blocks for simple executable graphs.
66
+
67
+ - `graphk.EchoNode` for minimal request/response flows
68
+ - `graphk.ApplyNode` for applying a callable to the active session
69
+ - `graphk.IncrementNode` for incrementing numeric session fields
70
+ - `graphk.ConcatNode` for string accumulation
71
+ - `graphk.RouteNode` for branch-routing flows
72
+
73
+ Learn more about the built-in node helpers on the Wiki pages:
74
+ [Demo Nodes](https://github.com/kochf1/graphk/wiki)
75
+
76
+ ### Example 1: A Simple Sequence
77
+
78
+ This is the smallest useful GraphK workflow: a sequence pipeline
79
+ executed through an `Emitter`.
80
+
81
+ ```python
82
+ import graphk
83
+
84
+
85
+ pipeline = graphk.SequencePipe(
86
+ nodes=[
87
+ graphk.IncrementNode(
88
+ "A",
89
+ increment=1,
90
+ target_key="counter",
91
+ order_key="order",
92
+ response=True,
93
+ ),
94
+ graphk.IncrementNode(
95
+ "B",
96
+ increment=2,
97
+ target_key="counter",
98
+ order_key="order",
99
+ response=True,
100
+ ),
101
+ graphk.IncrementNode(
102
+ "C",
103
+ increment=3,
104
+ target_key="counter",
105
+ order_key="order",
106
+ response=True,
107
+ ),
108
+ ]
109
+ )
110
+
111
+ emitter = graphk.Emitter(pipeline)
112
+ emitter.request({"counter": 0})
113
+
114
+ print(emitter.response())
115
+ ```
116
+
117
+ Expected result:
118
+
119
+ ```python
120
+ {"counter": 6, "order": ["A", "B", "C"]}
121
+ ```
122
+
123
+ ### Example 2: A Branched Sequence
124
+
125
+ This example shows how GraphK routes execution through one branch
126
+ selected from runtime state.
127
+
128
+ ```python
129
+ import graphk
130
+
131
+
132
+ branch = graphk.BranchPipe(
133
+ nodes=[
134
+ (
135
+ graphk.Matcher(task="route-a"),
136
+ graphk.SequencePipe(nodes=[graphk.RouteNode("A")]),
137
+ ),
138
+ (
139
+ graphk.Matcher(task="route-b"),
140
+ graphk.SequencePipe(nodes=[graphk.RouteNode("B")]),
141
+ ),
142
+ (
143
+ graphk.Matcher(task="route-c"),
144
+ graphk.SequencePipe(nodes=[graphk.RouteNode("C")]),
145
+ ),
146
+ ]
147
+ )
148
+
149
+ pipeline = graphk.SequencePipe(nodes=[branch])
150
+ emitter = graphk.Emitter(pipeline)
151
+
152
+ emitter.request({"task": "route-b"})
153
+ print(emitter.response())
154
+ ```
155
+
156
+ Expected result:
157
+
158
+ ```python
159
+ {"route": "B"}
160
+ ```
161
+
162
+
163
+ ## Learn by Examples
164
+
165
+ All runnable examples are available in
166
+ [`examples`](examples), and they can be executed together with:
167
+
168
+ ```bash
169
+ bash examples/example.sh
170
+ ```
171
+
172
+ - [`examples/example_1.py`](examples/example_1.py) - Simple
173
+ emitter request and response
174
+ - [`examples/example_2.py`](examples/example_2.py) - Multi-step
175
+ sequence execution
176
+ - [`examples/example_3.py`](examples/example_3.py) - Context-driven
177
+ sequence
178
+ - [`examples/example_4.py`](examples/example_4.py) - Nested
179
+ sequence pipelines
180
+ - [`examples/example_5.py`](examples/example_5.py) - Branch routing
181
+ with `BranchPipe`
182
+ - [`examples/example_6.py`](examples/example_6.py) - `MultiPipe`
183
+ fan-out
184
+ - [`examples/example_7.py`](examples/example_7.py) - Policy-governed
185
+ execution
186
+ - [`examples/example_8.py`](examples/example_8.py) - Hierarchical
187
+ memory resolution
188
+ - [`examples/example_9.py`](examples/example_9.py) - Graceful early
189
+ stop with `CUT`
190
+ - [`examples/example_10.py`](examples/example_10.py) - Error
191
+ rollback during execution
192
+
193
+ Learn more about each area on the Wiki pages:
194
+ [GraphK Wiki](https://github.com/kochf1/graphk/wiki)
@@ -0,0 +1,83 @@
1
+ # =================================================================
2
+ # Project Configuration
3
+ # pip install -e .
4
+ # =================================================================
5
+
6
+ # =================================================================
7
+ # Build System
8
+ # =================================================================
9
+ [build-system]
10
+ requires = [
11
+ "hatchling"
12
+ ]
13
+ build-backend = "hatchling.build"
14
+
15
+ # =================================================================
16
+ # Project Metadata
17
+ # =================================================================
18
+ [project]
19
+ name = "graphk"
20
+ dynamic = ["version"]
21
+ description = "Framework for Graph-based execution and pipeline programming"
22
+ readme = "README.md"
23
+ license = { text = "MIT" }
24
+ requires-python = ">=3.10"
25
+ keywords = ["graph", "pipeline", "workflow", "execution", "runtime"]
26
+ classifiers = [
27
+ "Development Status :: 4 - Beta",
28
+ "Intended Audience :: Developers",
29
+ "License :: OSI Approved :: MIT License",
30
+ "Operating System :: OS Independent",
31
+ "Programming Language :: Python :: 3",
32
+ "Programming Language :: Python :: 3.10",
33
+ "Programming Language :: Python :: 3.11",
34
+ "Programming Language :: Python :: 3.12",
35
+ "Programming Language :: Python :: 3.13",
36
+ "Topic :: Software Development :: Libraries",
37
+ "Topic :: Software Development :: Libraries :: Python Modules",
38
+ ]
39
+
40
+ authors = [
41
+ { name = "Fernando Koch", email = "kochf@fau.edu" }
42
+ ]
43
+
44
+ dependencies = []
45
+
46
+ [project.urls]
47
+ Homepage = "https://github.com/kochf1/graphk"
48
+ Repository = "https://github.com/kochf1/graphk"
49
+ Documentation = "https://github.com/kochf1/graphk/wiki"
50
+ Issues = "https://github.com/kochf1/graphk/issues"
51
+
52
+
53
+ # =================================================================
54
+ # CLI (only enable if CLI exists)
55
+ # =================================================================
56
+ # [project.scripts]
57
+ # PACKAGE = "PACKAGE.ui.cli:main"
58
+
59
+ # =================================================================
60
+ # Build targets
61
+ # =================================================================
62
+ [tool.hatch.build.targets.wheel]
63
+ packages = ["src/graphk"]
64
+
65
+ [tool.hatch.version]
66
+ path = "src/graphk/__init__.py"
67
+
68
+ # =================================================================
69
+ # Source distribution contents
70
+ # =================================================================
71
+ [tool.hatch.build.targets.sdist]
72
+ include = [
73
+ "src/graphk",
74
+ "README.md",
75
+ "LICENSE.txt",
76
+ "pyproject.toml",
77
+ ]
78
+
79
+ # =================================================================
80
+ # Build data
81
+ # =================================================================
82
+ [tool.hatch.build]
83
+ artifacts = []
@@ -0,0 +1,69 @@
1
+ """
2
+ GraphK - Framework for Graph-based execution and pipeline programming.
3
+ """
4
+
5
+ from .common.store import Store
6
+ from .common.matcher import Matcher
7
+ from .common.logger import Logger
8
+ from .common.persistence import Persistence
9
+ from .core.session import Session
10
+ from .core.context import Context
11
+ from .core.policy import Policy
12
+ from .core.node import Node
13
+ from .core.pipeline import Pipeline
14
+ from .core.runner import Runner
15
+ from .core.emitter import Emitter
16
+ from .pipes.branch import BranchPipe
17
+ from .pipes.demos import (
18
+ AccumulateNode,
19
+ ApplyNode,
20
+ ConcatNode,
21
+ EchoNode,
22
+ IncrementNode,
23
+ RouteNode,
24
+ TextConcatNode,
25
+ )
26
+ from .pipes.multi import MultiPipe
27
+ from .pipes.sequence import SequencePipe
28
+
29
+ __all__ = [
30
+ "Store",
31
+ "Matcher",
32
+ "Logger",
33
+ "Session",
34
+ "Context",
35
+ "Policy",
36
+ "Node",
37
+ "Pipeline",
38
+ "Runner",
39
+ "Emitter",
40
+ "Persistence",
41
+ "EchoNode",
42
+ "ApplyNode",
43
+ "AccumulateNode",
44
+ "IncrementNode",
45
+ "ConcatNode",
46
+ "TextConcatNode",
47
+ "RouteNode",
48
+ "BranchPipe",
49
+ "MultiPipe",
50
+ "SequencePipe"
51
+ ]
52
+
53
+ __title__ = "graphk"
54
+ __version__ = "1.0.2"
55
+ __description__ = "Framework for Graph-based execution and pipeline programming"
56
+ __github__ = "https://github.com/kochf1/graphk"
57
+ __license__ = "MIT"
58
+ __about__ = """
59
+ GraphK provides the core execution model for graph-based programming. It defines
60
+ pipelines as executable graphs composed of nodes, branches, and nested pipelines,
61
+ with explicit control flow and runtime semantics.
62
+ """
63
+ __disclaimer__= """
64
+ This codebase was developed with the assistance of agentic AI tools as part of a
65
+ vibe coding workflow. Multiple AI models and development tools were used while
66
+ following established code style guidelines and testing practices. Certain components
67
+ required manual intervention, and human-in-the-loop review was applied throughout
68
+ the development process to ensure correctness, consistency, and code quality.
69
+ """