workpeg 0.5.0__tar.gz → 0.5.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.
- workpeg-0.5.2/PKG-INFO +438 -0
- workpeg-0.5.2/README.md +419 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/pyproject.toml +3 -3
- workpeg-0.5.2/src/workpeg.egg-info/PKG-INFO +438 -0
- workpeg-0.5.0/PKG-INFO +0 -316
- workpeg-0.5.0/README.md +0 -297
- workpeg-0.5.0/src/workpeg.egg-info/PKG-INFO +0 -316
- {workpeg-0.5.0 → workpeg-0.5.2}/LICENSE +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/MANIFEST.in +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/setup.cfg +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg/__init__.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg/build.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg/cli.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg/config.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg/context.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg/create_new.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg/run.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg/runtime.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg/submit.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg/templates/__init__.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg/templates/functions/Dockerfile +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg/templates/functions/LICENSE +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg/templates/functions/README.md +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg/templates/functions/app/__init__.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg/templates/functions/app/main.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg/templates/functions/requirements.txt +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg/utils.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg.egg-info/SOURCES.txt +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg.egg-info/dependency_links.txt +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg.egg-info/entry_points.txt +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg.egg-info/requires.txt +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/src/workpeg.egg-info/top_level.txt +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/tests/test_build.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/tests/test_cli.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/tests/test_context.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/tests/test_create_new.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/tests/test_run.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/tests/test_runtime.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/tests/test_submit.py +0 -0
- {workpeg-0.5.0 → workpeg-0.5.2}/tests/test_utils.py +0 -0
workpeg-0.5.2/PKG-INFO
ADDED
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: workpeg
|
|
3
|
+
Version: 0.5.2
|
|
4
|
+
Summary: Workpeg function runtime and SDK
|
|
5
|
+
Author-email: Workpeg <support@workpeg.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://gitlab.com/workpeg/workpeg-sdk
|
|
8
|
+
Project-URL: Repository, https://developers.workpeg.com
|
|
9
|
+
Keywords: workpeg,serverless,functions,runtime
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: requests>=2.31.0
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# Workpeg SDK
|
|
21
|
+
|
|
22
|
+
Python SDK and CLI for building Workpeg Pegs and execution workloads.
|
|
23
|
+
|
|
24
|
+
Workpeg is a platform for developing portable micro-apps called Pegs. Pegs can be packaged, executed, distributed through the PegStore, and integrated into the broader Workpeg ecosystem.
|
|
25
|
+
|
|
26
|
+
The SDK currently focuses on function-based Peg development and local runtime tooling, while the CLI architecture is designed to expand into additional capabilities such as client applications, Peg packaging, registry tooling, runtime orchestration, and deployment infrastructure.
|
|
27
|
+
|
|
28
|
+
## Current capabilities
|
|
29
|
+
|
|
30
|
+
* Peg scaffolding
|
|
31
|
+
* Function-based execution model
|
|
32
|
+
* Fast local runtime
|
|
33
|
+
* Persistent Docker runtime
|
|
34
|
+
* Docker image packaging
|
|
35
|
+
* Registry submission
|
|
36
|
+
* Runtime configuration
|
|
37
|
+
* Warm container execution
|
|
38
|
+
|
|
39
|
+
## Repository
|
|
40
|
+
|
|
41
|
+
[Workpeg SDK Repository](https://gitlab.com/workpeg/workpeg-sdk?utm_source=chatgpt.com)
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
# Installation
|
|
46
|
+
|
|
47
|
+
Install from PyPI:
|
|
48
|
+
|
|
49
|
+
```bash id="0d2m52"
|
|
50
|
+
pip install workpeg
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Or install locally from source:
|
|
54
|
+
|
|
55
|
+
```bash id="4d9q9q"
|
|
56
|
+
pip install -e .
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Verify installation:
|
|
60
|
+
|
|
61
|
+
```bash id="56gg0t"
|
|
62
|
+
workpeg --version
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
# CLI Architecture
|
|
68
|
+
|
|
69
|
+
Workpeg uses a namespace-oriented CLI inspired by tools like Docker.
|
|
70
|
+
|
|
71
|
+
Current namespace:
|
|
72
|
+
|
|
73
|
+
```bash id="m0u9jj"
|
|
74
|
+
workpeg function ...
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Future namespaces may include:
|
|
78
|
+
|
|
79
|
+
```bash id="8itvsl"
|
|
80
|
+
workpeg client ...
|
|
81
|
+
workpeg peg ...
|
|
82
|
+
workpeg registry ...
|
|
83
|
+
workpeg runtime ...
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Get help:
|
|
87
|
+
|
|
88
|
+
```bash id="q3x8r2"
|
|
89
|
+
workpeg --help
|
|
90
|
+
workpeg function --help
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
# Quick Start
|
|
96
|
+
|
|
97
|
+
## Create a Function Peg
|
|
98
|
+
|
|
99
|
+
Create a new function project:
|
|
100
|
+
|
|
101
|
+
```bash id="kcnw5d"
|
|
102
|
+
workpeg function new hello
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Generated structure:
|
|
106
|
+
|
|
107
|
+
```text id="v6m8d4"
|
|
108
|
+
hello/
|
|
109
|
+
├── app/
|
|
110
|
+
│ ├── __init__.py
|
|
111
|
+
│ └── main.py
|
|
112
|
+
├── tests/
|
|
113
|
+
├── Dockerfile
|
|
114
|
+
├── requirements.txt
|
|
115
|
+
├── workpeg.json
|
|
116
|
+
└── README.md
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Example function:
|
|
120
|
+
|
|
121
|
+
```python id="h6e3xs"
|
|
122
|
+
def main(context, payload):
|
|
123
|
+
return {
|
|
124
|
+
"message": "Hello from Workpeg",
|
|
125
|
+
"payload": payload,
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
# Fast Local Runtime
|
|
132
|
+
|
|
133
|
+
For rapid iteration without Docker:
|
|
134
|
+
|
|
135
|
+
```bash id="rrl4su"
|
|
136
|
+
echo '{"context": {}, "payload": {"name":"world"}}' \
|
|
137
|
+
| workpeg function runtime
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Example response:
|
|
141
|
+
|
|
142
|
+
```json id="uohm9u"
|
|
143
|
+
{
|
|
144
|
+
"status": "success",
|
|
145
|
+
"result": {
|
|
146
|
+
"message": "Hello from Workpeg",
|
|
147
|
+
"payload": {
|
|
148
|
+
"name": "world"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
# Persistent Runtime Server
|
|
157
|
+
|
|
158
|
+
Run the runtime as a warm HTTP server:
|
|
159
|
+
|
|
160
|
+
```bash id="1n1n3x"
|
|
161
|
+
workpeg function runtime --server
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Default endpoint:
|
|
165
|
+
|
|
166
|
+
```text id="07ubrq"
|
|
167
|
+
http://0.0.0.0:8000
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Invoke:
|
|
171
|
+
|
|
172
|
+
```bash id="4z1s1l"
|
|
173
|
+
curl -X POST http://localhost:8000/invoke \
|
|
174
|
+
-H "Content-Type: application/json" \
|
|
175
|
+
-d '{"context": {}, "payload": {"hello":"world"}}'
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Health check:
|
|
179
|
+
|
|
180
|
+
```bash id="lc3bxr"
|
|
181
|
+
curl http://localhost:8000/healthz
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
# Build Docker Image
|
|
187
|
+
|
|
188
|
+
Build a Peg runtime image:
|
|
189
|
+
|
|
190
|
+
```bash id="l8z59k"
|
|
191
|
+
workpeg function build
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Specify custom tag:
|
|
195
|
+
|
|
196
|
+
```bash id="ofm9pp"
|
|
197
|
+
workpeg function build --tag my-image
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
The build process produces a portable runtime container for the Peg.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
# Run Peg Runtime (Docker)
|
|
205
|
+
|
|
206
|
+
Run a warm containerized runtime:
|
|
207
|
+
|
|
208
|
+
```bash id="rbvt3p"
|
|
209
|
+
workpeg function run --with docker
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
This:
|
|
213
|
+
|
|
214
|
+
* Builds the image (unless disabled)
|
|
215
|
+
* Starts a persistent runtime container
|
|
216
|
+
* Exposes HTTP endpoints
|
|
217
|
+
* Enables warm execution
|
|
218
|
+
|
|
219
|
+
Default endpoint:
|
|
220
|
+
|
|
221
|
+
```text id="ghp23n"
|
|
222
|
+
http://localhost:8000
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
# Docker Networking
|
|
228
|
+
|
|
229
|
+
Attach runtimes to a Docker network:
|
|
230
|
+
|
|
231
|
+
```bash id="2rx4ji"
|
|
232
|
+
workpeg function run \
|
|
233
|
+
--with docker \
|
|
234
|
+
--network workpeg_net
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Useful for inter-Peg communication and local ecosystem development:
|
|
238
|
+
|
|
239
|
+
```text id="pwnmql"
|
|
240
|
+
http://peg-name:8000
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
This enables multiple Peg runtimes to coexist without port collisions.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
# Detached Warm Runtime Model
|
|
248
|
+
|
|
249
|
+
The Docker runtime uses persistent detached containers instead of one-shot execution.
|
|
250
|
+
|
|
251
|
+
This enables:
|
|
252
|
+
|
|
253
|
+
* Warm execution
|
|
254
|
+
* Faster repeated invocations
|
|
255
|
+
* Health monitoring
|
|
256
|
+
* Automatic restarts
|
|
257
|
+
* Internal networking
|
|
258
|
+
* Future orchestration support
|
|
259
|
+
|
|
260
|
+
Example execution model:
|
|
261
|
+
|
|
262
|
+
```text id="z3q4z1"
|
|
263
|
+
Function → Runtime Container → Peg → PegStore
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
# Runtime Backends
|
|
269
|
+
|
|
270
|
+
Workpeg supports multiple execution backends.
|
|
271
|
+
|
|
272
|
+
| Runtime | Purpose | Status |
|
|
273
|
+
| ------- | --------------------------- | --------- |
|
|
274
|
+
| docker | Local Peg development | Available |
|
|
275
|
+
| cracker | Firecracker microVM runtime | Planned |
|
|
276
|
+
|
|
277
|
+
Select backend:
|
|
278
|
+
|
|
279
|
+
```bash id="f94kq8"
|
|
280
|
+
workpeg function run --with docker
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Runtime resolution order:
|
|
284
|
+
|
|
285
|
+
1. CLI flag
|
|
286
|
+
2. `workpeg.json`
|
|
287
|
+
3. Fallback default (`cracker`)
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
# Configuration
|
|
292
|
+
|
|
293
|
+
Optional project configuration:
|
|
294
|
+
|
|
295
|
+
```text id="u2pq39"
|
|
296
|
+
workpeg.json
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Example:
|
|
300
|
+
|
|
301
|
+
```json id="9cv47i"
|
|
302
|
+
{
|
|
303
|
+
"runtime": {
|
|
304
|
+
"default": "docker",
|
|
305
|
+
"docker": {
|
|
306
|
+
"port": 8000,
|
|
307
|
+
"network": "workpeg_net",
|
|
308
|
+
"restart": "unless-stopped"
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
"build": {
|
|
312
|
+
"image": "my-custom-image"
|
|
313
|
+
},
|
|
314
|
+
"function": {
|
|
315
|
+
"entrypoint": "app.main:main"
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
# Function Contract
|
|
323
|
+
|
|
324
|
+
Functions implement:
|
|
325
|
+
|
|
326
|
+
```python id="9a3e3r"
|
|
327
|
+
def main(context: dict, payload: dict):
|
|
328
|
+
return {...}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Input:
|
|
332
|
+
|
|
333
|
+
```json id="xgcw6e"
|
|
334
|
+
{
|
|
335
|
+
"context": {...},
|
|
336
|
+
"payload": {...}
|
|
337
|
+
}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
Success output:
|
|
341
|
+
|
|
342
|
+
```json id="zptc4l"
|
|
343
|
+
{
|
|
344
|
+
"status": "success",
|
|
345
|
+
"result": {...}
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
Error output:
|
|
350
|
+
|
|
351
|
+
```json id="c8z1k6"
|
|
352
|
+
{
|
|
353
|
+
"status": "error",
|
|
354
|
+
"error_type": "...",
|
|
355
|
+
"error": "..."
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
# Entrypoint
|
|
362
|
+
|
|
363
|
+
Default entrypoint:
|
|
364
|
+
|
|
365
|
+
```text id="e0nbql"
|
|
366
|
+
app.main:main
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
Override:
|
|
370
|
+
|
|
371
|
+
```bash id="v42ihq"
|
|
372
|
+
FUNCTION_ENTRYPOINT=app.main:handler \
|
|
373
|
+
workpeg function runtime
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
# Docker Requirements
|
|
379
|
+
|
|
380
|
+
Required for:
|
|
381
|
+
|
|
382
|
+
```bash id="p7wvdn"
|
|
383
|
+
workpeg function build
|
|
384
|
+
workpeg function run --with docker
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
Requirements:
|
|
388
|
+
|
|
389
|
+
* Docker installed
|
|
390
|
+
* Docker daemon running
|
|
391
|
+
* Docker CLI available on PATH
|
|
392
|
+
|
|
393
|
+
When running inside another container:
|
|
394
|
+
|
|
395
|
+
```bash id="qho4i4"
|
|
396
|
+
-v /var/run/docker.sock:/var/run/docker.sock
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
# Philosophy
|
|
402
|
+
|
|
403
|
+
Workpeg is designed around composable executable applications.
|
|
404
|
+
|
|
405
|
+
Core progression:
|
|
406
|
+
|
|
407
|
+
```text id="i8n38r"
|
|
408
|
+
Function → Runtime → Peg → PegStore → Ecosystem
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
* Functions provide isolated execution units
|
|
412
|
+
* Pegs package functionality into portable micro-apps
|
|
413
|
+
* PegStore enables distribution
|
|
414
|
+
* Workpeg provides the runtime and orchestration foundation
|
|
415
|
+
|
|
416
|
+
The long-term direction is a platform where developers can build, distribute, and execute intelligent applications inside a unified ecosystem.
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
# Roadmap
|
|
421
|
+
|
|
422
|
+
Planned:
|
|
423
|
+
|
|
424
|
+
* Firecracker runtime backend
|
|
425
|
+
* Persistent microVM execution
|
|
426
|
+
* PegStore tooling
|
|
427
|
+
* Peg packaging workflows
|
|
428
|
+
* Client app tooling
|
|
429
|
+
* Runtime orchestration
|
|
430
|
+
* Streaming execution
|
|
431
|
+
* Registry approvals & governance
|
|
432
|
+
* Distributed runtime scheduling
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
# License
|
|
437
|
+
|
|
438
|
+
MIT License
|