pyoco 0.1.0__py3-none-any.whl → 0.5.0__py3-none-any.whl

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,159 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyoco
3
+ Version: 0.5.0
4
+ Summary: A workflow engine with sugar syntax
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: pyyaml>=6.0.3
8
+ Requires-Dist: fastapi>=0.100.0
9
+ Requires-Dist: uvicorn>=0.20.0
10
+ Requires-Dist: httpx>=0.24.0
11
+ Requires-Dist: prometheus-client>=0.20.0
12
+
13
+ # 🐇 Pyoco
14
+
15
+ **pyoco is a minimal, pure-Python DAG engine for defining and running simple task-based workflows.**
16
+
17
+ ## Overview
18
+
19
+ Pyoco is designed to be significantly smaller, lighter, and have fewer dependencies than full-scale workflow engines like Airflow. It is optimized for local development and single-machine execution.
20
+
21
+ You can define tasks and their dependencies entirely in Python code using decorators and a simple API. There is no need for complex configuration files or external databases.
22
+
23
+ It is ideal for small jobs, development environments, and personal projects where a full-stack workflow engine would be overkill.
24
+
25
+ ## ✨ Features
26
+
27
+ - **Pure Python**: No external services or heavy dependencies required.
28
+ - **Minimal DAG model**: Tasks and dependencies are defined directly in code.
29
+ - **Task-oriented**: Focus on "small workflows" that should be easy to read and maintain.
30
+ - **Friendly trace logs**: Runs can be traced step by step from the terminal with cute (or plain) logs.
31
+ - **Parallel Execution**: Automatically runs independent tasks in parallel.
32
+ - **Artifact Management**: Easily save and manage task outputs and files.
33
+ - **Observability**: Track execution with unique Run IDs and detailed state transitions.
34
+ - **Control**: Cancel running workflows gracefully with `Ctrl+C`.
35
+
36
+ ## 📦 Installation
37
+
38
+ ```bash
39
+ pip install pyoco
40
+ ```
41
+
42
+ ## 🚀 Usage
43
+
44
+ Here is a minimal example of a pure-Python workflow.
45
+
46
+ ```python
47
+ from pyoco import task
48
+ from pyoco.core.models import Flow
49
+ from pyoco.core.engine import Engine
50
+
51
+ @task
52
+ def fetch_data(ctx):
53
+ print("🐰 Fetching data...")
54
+ return {"id": 1, "value": "carrot"}
55
+
56
+ @task
57
+ def process_data(ctx, data):
58
+ print(f"🥕 Processing: {data['value']}")
59
+ return data['value'].upper()
60
+
61
+ @task
62
+ def save_result(ctx, result):
63
+ print(f"✨ Saved: {result}")
64
+
65
+ # Define the flow
66
+ flow = Flow(name="hello_pyoco")
67
+ flow >> fetch_data >> process_data >> save_result
68
+
69
+ # Wire inputs (explicitly for this example)
70
+ process_data.task.inputs = {"data": "$node.fetch_data.output"}
71
+ save_result.task.inputs = {"result": "$node.process_data.output"}
72
+
73
+ if __name__ == "__main__":
74
+ engine = Engine()
75
+ engine.run(flow)
76
+ ```
77
+
78
+ Run it:
79
+
80
+ ```bash
81
+ python examples/hello_pyoco.py
82
+ ```
83
+
84
+ Output:
85
+
86
+ ```
87
+ 🐇 pyoco > start flow=hello_pyoco
88
+ 🏃 start node=fetch_data
89
+ 🐰 Fetching data...
90
+ ✅ done node=fetch_data (0.30 ms)
91
+ 🏃 start node=process_data
92
+ 🥕 Processing: carrot
93
+ ✅ done node=process_data (0.23 ms)
94
+ 🏃 start node=save_result
95
+ ✨ Saved: CARROT
96
+ ✅ done node=save_result (0.30 ms)
97
+ 🥕 done flow=hello_pyoco
98
+ ```
99
+
100
+ See [examples/hello_pyoco.py](examples/hello_pyoco.py) for the full code.
101
+
102
+ ## 🏗️ Architecture
103
+
104
+ Pyoco is designed with a simple flow:
105
+
106
+ ```
107
+ +-----------+ +------------------+ +-----------------+
108
+ | User Code | ---> | pyoco.core.Flow | ---> | trace/logger |
109
+ | (Tasks) | | (Engine) | | (Console/File) |
110
+ +-----------+ +------------------+ +-----------------+
111
+ ```
112
+
113
+ 1. **User Code**: You define tasks and flows using Python decorators.
114
+ 2. **Core Engine**: The engine resolves dependencies and executes tasks (in parallel where possible).
115
+ 3. **Trace**: Execution events are sent to the trace backend for logging (cute or plain).
116
+
117
+ ## 🎭 Modes
118
+
119
+ Pyoco has two output modes:
120
+
121
+ - **Cute Mode** (Default): Uses emojis and friendly messages. Best for local development and learning.
122
+ - **Non-Cute Mode**: Plain text logs. Best for CI/CD and production monitoring.
123
+
124
+ You can switch modes using an environment variable:
125
+
126
+ ```bash
127
+ export PYOCO_CUTE=0 # Disable cute mode
128
+ ```
129
+
130
+ Or via CLI flag:
131
+
132
+ ```bash
133
+ pyoco run --non-cute ...
134
+ ```
135
+
136
+ ## 🔭 Observability Bridge (v0.5)
137
+
138
+ - `/metrics` exposes Prometheus counters (`pyoco_runs_total`, `pyoco_runs_in_progress`) and histograms (`pyoco_task_duration_seconds`, `pyoco_run_duration_seconds`). Point Grafana/Prometheus at it to watch pipelines without opening sockets.
139
+ - `/runs` now accepts `status`, `flow`, `limit` query params; `/runs/{id}/logs?tail=100` fetches only the latest snippets for dashboards.
140
+ - Webhook notifications fire when runs COMPLETE/FAIL—configure via `PYOCO_WEBHOOK_*` env vars and forward to Slack or your alerting stack.
141
+ - Import `docs/grafana_pyoco_cute.json` for a lavender/orange starter dashboard (3 panels: in-progress count, completion trend, per-flow latency).
142
+ - 詳細な手順は [docs/observability.md](docs/observability.md) を参照してください。
143
+
144
+ ## 🧩 Plug-ins
145
+
146
+ Need to share domain-specific tasks? Publish an entry point under `pyoco.tasks` and pyoco will auto-load it. See [docs/plugins.md](docs/plugins.md) for the `PluginRegistry` decorator, example `pyproject.toml`, and `pyoco plugins list` CLI helper.
147
+
148
+ ## 📚 Documentation
149
+
150
+ - [Tutorials](docs/tutorial/index.md)
151
+ - [Roadmap](docs/roadmap.md)
152
+
153
+ ## 💖 Contributing
154
+
155
+ We love contributions! Please feel free to submit a Pull Request.
156
+
157
+ ---
158
+
159
+ *Made with 🥕 by the Pyoco Team.*
@@ -0,0 +1,33 @@
1
+ pyoco/__init__.py,sha256=E2pgDGvGRSVon7dSqIM4UD55LgVpf4jiZZA-70kOcuw,409
2
+ pyoco/client.py,sha256=Y95NmMsOKTJ9AZJEg_OzHamC_w32YWmSVS653mpqHVQ,3141
3
+ pyoco/socketless_reset.py,sha256=KsAF4I23_Kbhy9fIWFARzV5QaIOQqbl0U0yPb8a34sM,129
4
+ pyoco/cli/entry.py,sha256=zPIG0Gx-cFO8Cf1Z3wD3Ifz_2sHaryHZ6mCRri2WEqE,93
5
+ pyoco/cli/main.py,sha256=W3U-T4SliJHy4wZ70QoN2c9Mep--XxlEa8YkHe9DLuU,16515
6
+ pyoco/core/base_task.py,sha256=z7hOFntAPv4yCADapS-fhtLe5eWqaO8k3T1r05YEEUE,2106
7
+ pyoco/core/context.py,sha256=TeCUriOmg7qZB3nMRu8HPdPshMW6pMVx48xZLY6a-A4,6524
8
+ pyoco/core/engine.py,sha256=iX2Id8ryFt-xeZgraqnF3uqkI6ubiZt5NBNYWX6Qv1s,24166
9
+ pyoco/core/exceptions.py,sha256=G82KY8PCnAhp3IDDIG8--Uh3EfVa192zei3l6ihfShI,565
10
+ pyoco/core/models.py,sha256=8faYURF43-7IebqzTIorHxpCeC4TZfoXWjGyPNaWhyI,10501
11
+ pyoco/discovery/loader.py,sha256=vC729i1bR358u6YwiVX2uonZ80WxjFGFqJRlhX89Sf0,5942
12
+ pyoco/discovery/plugins.py,sha256=pNMWxS03jWPuUV2tApGch2VL40EyKLOOeYT-OPBBBRQ,2806
13
+ pyoco/dsl/__init__.py,sha256=xWdb60pSRL8lNFk4GHF3EJ4hon0uiWqpv264g6-4gdg,45
14
+ pyoco/dsl/expressions.py,sha256=BtEIxPSf3BU-wPNEicIqX_TVZ4fAnlWGrzrrfc6pU1g,4875
15
+ pyoco/dsl/nodes.py,sha256=qDiIEsAJHnD8dpuOd-Rpy6OORCW6KDW_BdYiA2BKu18,1041
16
+ pyoco/dsl/syntax.py,sha256=kYP5uGbwxmkSd_zeSksax8iWm_7UlRW5JxE9_DoSqbk,8638
17
+ pyoco/dsl/validator.py,sha256=HXjcc-GzjH72YByaNxAg_7YOZsVsFDFnUaenVwd5PbY,3576
18
+ pyoco/schemas/config.py,sha256=KkGZK3GxTHoIHEGb4f4k8GE2W-aBN4iPzmc_HrwuROU,1735
19
+ pyoco/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ pyoco/server/api.py,sha256=vu2ieDZgHbi8cysO2rS-lcxqWiSQprIcqRn6GkwTtKo,3890
21
+ pyoco/server/metrics.py,sha256=92sHZKka_yBNBGlHZgRIteywx97aoTa-MnXh3UJ0HJY,2952
22
+ pyoco/server/models.py,sha256=ir5AuvyXQigmaynA7bS_0RNJcJo2VtpJl0GjRZrj2rU,786
23
+ pyoco/server/store.py,sha256=ITYAV1QlPWDnceywqjjJZW9E0CyocFlPmqqfjcoM-wA,9133
24
+ pyoco/server/webhook.py,sha256=fBSLWTDN7sIWSK0AUVuiCSdVVBFV_AyP-XEKOcdMXmQ,3643
25
+ pyoco/trace/backend.py,sha256=a1css94_lhO4SGSPHZ1f59HJqFQtZ5Sjx09Kw7v5bsk,617
26
+ pyoco/trace/console.py,sha256=I-BcF405OGLWoacJWeke8vTT9M5JxSBpJL-NazVyxb4,1742
27
+ pyoco/worker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
+ pyoco/worker/client.py,sha256=862KccXRtfG7zd9ZSLqrpVSV6ev8zeuEHHdtAfLghiM,1557
29
+ pyoco/worker/runner.py,sha256=hyKn5NbuIuF-109CnQbYc8laKbWmwe9ChaLrNUtsVIg,6367
30
+ pyoco-0.5.0.dist-info/METADATA,sha256=SEow4x2y_O6SqeVuEU-_7dT12F-XA24sYVD_hMV6TQM,5251
31
+ pyoco-0.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
32
+ pyoco-0.5.0.dist-info/top_level.txt,sha256=2JRVocfaWRbX1VJ3zq1c5wQaOK6fMARS6ptVFWyvRF4,6
33
+ pyoco-0.5.0.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: pyoco
3
- Version: 0.1.0
4
- Summary: A workflow engine with sugar syntax
5
- Requires-Python: >=3.10
6
- Description-Content-Type: text/markdown
7
- Requires-Dist: pyyaml>=6.0.3
@@ -1,17 +0,0 @@
1
- pyoco/__init__.py,sha256=E2pgDGvGRSVon7dSqIM4UD55LgVpf4jiZZA-70kOcuw,409
2
- pyoco/cli/entry.py,sha256=zPIG0Gx-cFO8Cf1Z3wD3Ifz_2sHaryHZ6mCRri2WEqE,93
3
- pyoco/cli/main.py,sha256=uRc6CzUTVRYF4JbehlbrprT7GvWQ-WyBZ8k12NrSxO8,6502
4
- pyoco/core/base_task.py,sha256=z7hOFntAPv4yCADapS-fhtLe5eWqaO8k3T1r05YEEUE,2106
5
- pyoco/core/context.py,sha256=SnoTz3vRghO1A-FNOrw2NEjbx1HySDqrBnQU5-KWGbk,3696
6
- pyoco/core/engine.py,sha256=m5LrEsXcpUAran5DxULtWbvhsMNj5mv17wE6lDFkFmQ,11416
7
- pyoco/core/models.py,sha256=zTt5HTSBChwRpOuw3qY2pvjRGZVsq4OQ-ZBHE3ujMWA,4548
8
- pyoco/discovery/loader.py,sha256=XzZzOAyFYrdA8K6APuEGWgjSIyp4Bgwlr834MyJc8vk,4950
9
- pyoco/dsl/__init__.py,sha256=xWdb60pSRL8lNFk4GHF3EJ4hon0uiWqpv264g6-4gdg,45
10
- pyoco/dsl/syntax.py,sha256=AkFcD5gLlbJLFN0KkMIyttpHUV3v21pjz_ZqwreZkdM,4312
11
- pyoco/schemas/config.py,sha256=KkGZK3GxTHoIHEGb4f4k8GE2W-aBN4iPzmc_HrwuROU,1735
12
- pyoco/trace/backend.py,sha256=h7l1PU8zuCSOo_VA5T1ax4znN_Az3Xuvx-KXibg3e-U,597
13
- pyoco/trace/console.py,sha256=Kf2-vma98ojhVQZHFzCUYfD_46Lr1WfAfI56smZkSZM,1397
14
- pyoco-0.1.0.dist-info/METADATA,sha256=bA_qJXUkIiC7TIOSo8CEzJ6PXp01pLQ1Q1LoMOrIw_k,187
15
- pyoco-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- pyoco-0.1.0.dist-info/top_level.txt,sha256=2JRVocfaWRbX1VJ3zq1c5wQaOK6fMARS6ptVFWyvRF4,6
17
- pyoco-0.1.0.dist-info/RECORD,,
File without changes