workpeg 0.5.2__tar.gz → 0.6.0__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.
Files changed (38) hide show
  1. {workpeg-0.5.2/src/workpeg.egg-info → workpeg-0.6.0}/PKG-INFO +117 -48
  2. {workpeg-0.5.2 → workpeg-0.6.0}/README.md +114 -45
  3. {workpeg-0.5.2 → workpeg-0.6.0}/pyproject.toml +3 -3
  4. workpeg-0.6.0/src/workpeg/cdn.py +239 -0
  5. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg/cli.py +113 -146
  6. {workpeg-0.5.2 → workpeg-0.6.0/src/workpeg.egg-info}/PKG-INFO +117 -48
  7. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg.egg-info/SOURCES.txt +1 -0
  8. {workpeg-0.5.2 → workpeg-0.6.0}/tests/test_cli.py +178 -25
  9. {workpeg-0.5.2 → workpeg-0.6.0}/LICENSE +0 -0
  10. {workpeg-0.5.2 → workpeg-0.6.0}/MANIFEST.in +0 -0
  11. {workpeg-0.5.2 → workpeg-0.6.0}/setup.cfg +0 -0
  12. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg/__init__.py +0 -0
  13. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg/build.py +0 -0
  14. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg/config.py +0 -0
  15. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg/context.py +0 -0
  16. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg/create_new.py +0 -0
  17. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg/run.py +0 -0
  18. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg/runtime.py +0 -0
  19. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg/submit.py +0 -0
  20. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg/templates/__init__.py +0 -0
  21. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg/templates/functions/Dockerfile +0 -0
  22. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg/templates/functions/LICENSE +0 -0
  23. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg/templates/functions/README.md +0 -0
  24. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg/templates/functions/app/__init__.py +0 -0
  25. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg/templates/functions/app/main.py +0 -0
  26. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg/templates/functions/requirements.txt +0 -0
  27. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg/utils.py +0 -0
  28. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg.egg-info/dependency_links.txt +0 -0
  29. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg.egg-info/entry_points.txt +0 -0
  30. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg.egg-info/requires.txt +0 -0
  31. {workpeg-0.5.2 → workpeg-0.6.0}/src/workpeg.egg-info/top_level.txt +0 -0
  32. {workpeg-0.5.2 → workpeg-0.6.0}/tests/test_build.py +0 -0
  33. {workpeg-0.5.2 → workpeg-0.6.0}/tests/test_context.py +0 -0
  34. {workpeg-0.5.2 → workpeg-0.6.0}/tests/test_create_new.py +0 -0
  35. {workpeg-0.5.2 → workpeg-0.6.0}/tests/test_run.py +0 -0
  36. {workpeg-0.5.2 → workpeg-0.6.0}/tests/test_runtime.py +0 -0
  37. {workpeg-0.5.2 → workpeg-0.6.0}/tests/test_submit.py +0 -0
  38. {workpeg-0.5.2 → workpeg-0.6.0}/tests/test_utils.py +0 -0
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: workpeg
3
- Version: 0.5.2
3
+ Version: 0.6.0
4
4
  Summary: Workpeg function runtime and SDK
5
5
  Author-email: Workpeg <support@workpeg.com>
6
6
  License: MIT
7
- Project-URL: Homepage, https://gitlab.com/workpeg/workpeg-sdk
8
- Project-URL: Repository, https://developers.workpeg.com
7
+ Project-URL: Homepage, https://developers.workpeg.com
8
+ Project-URL: Repository, https://gitlab.com/workpeg/workpeg-sdk
9
9
  Keywords: workpeg,serverless,functions,runtime
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: 3 :: Only
@@ -19,22 +19,24 @@ Dynamic: license-file
19
19
 
20
20
  # Workpeg SDK
21
21
 
22
- Python SDK and CLI for building Workpeg Pegs and execution workloads.
22
+ Python SDK and CLI for building Workpeg Pegs and runtime-backed micro-apps.
23
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.
24
+ Workpeg is a platform for developing portable applications called Pegs. Pegs can be packaged, executed, distributed through the PegStore, and integrated into the broader Workpeg ecosystem.
25
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.
26
+ The SDK currently focuses on function-based Peg development, runtime tooling, Docker packaging, and asset distribution, while the CLI architecture is designed to expand into additional capabilities such as client applications, Peg packaging, orchestration, deployment infrastructure, and registry tooling.
27
27
 
28
28
  ## Current capabilities
29
29
 
30
30
  * Peg scaffolding
31
- * Function-based execution model
31
+ * Function-based runtime model
32
32
  * Fast local runtime
33
33
  * Persistent Docker runtime
34
34
  * Docker image packaging
35
35
  * Registry submission
36
+ * Public CDN asset uploads
36
37
  * Runtime configuration
37
38
  * Warm container execution
39
+ * Docker networking support
38
40
 
39
41
  ## Repository
40
42
 
@@ -46,19 +48,19 @@ The SDK currently focuses on function-based Peg development and local runtime to
46
48
 
47
49
  Install from PyPI:
48
50
 
49
- ```bash id="0d2m52"
51
+ ```bash
50
52
  pip install workpeg
51
53
  ```
52
54
 
53
55
  Or install locally from source:
54
56
 
55
- ```bash id="4d9q9q"
57
+ ```bash
56
58
  pip install -e .
57
59
  ```
58
60
 
59
61
  Verify installation:
60
62
 
61
- ```bash id="56gg0t"
63
+ ```bash
62
64
  workpeg --version
63
65
  ```
64
66
 
@@ -68,15 +70,16 @@ workpeg --version
68
70
 
69
71
  Workpeg uses a namespace-oriented CLI inspired by tools like Docker.
70
72
 
71
- Current namespace:
73
+ Current namespaces:
72
74
 
73
- ```bash id="m0u9jj"
75
+ ```bash
74
76
  workpeg function ...
77
+ workpeg cdn ...
75
78
  ```
76
79
 
77
80
  Future namespaces may include:
78
81
 
79
- ```bash id="8itvsl"
82
+ ```bash
80
83
  workpeg client ...
81
84
  workpeg peg ...
82
85
  workpeg registry ...
@@ -85,9 +88,10 @@ workpeg runtime ...
85
88
 
86
89
  Get help:
87
90
 
88
- ```bash id="q3x8r2"
91
+ ```bash
89
92
  workpeg --help
90
93
  workpeg function --help
94
+ workpeg cdn --help
91
95
  ```
92
96
 
93
97
  ---
@@ -98,13 +102,13 @@ workpeg function --help
98
102
 
99
103
  Create a new function project:
100
104
 
101
- ```bash id="kcnw5d"
105
+ ```bash
102
106
  workpeg function new hello
103
107
  ```
104
108
 
105
109
  Generated structure:
106
110
 
107
- ```text id="v6m8d4"
111
+ ```text
108
112
  hello/
109
113
  ├── app/
110
114
  │ ├── __init__.py
@@ -118,7 +122,7 @@ hello/
118
122
 
119
123
  Example function:
120
124
 
121
- ```python id="h6e3xs"
125
+ ```python
122
126
  def main(context, payload):
123
127
  return {
124
128
  "message": "Hello from Workpeg",
@@ -132,14 +136,14 @@ def main(context, payload):
132
136
 
133
137
  For rapid iteration without Docker:
134
138
 
135
- ```bash id="rrl4su"
139
+ ```bash
136
140
  echo '{"context": {}, "payload": {"name":"world"}}' \
137
141
  | workpeg function runtime
138
142
  ```
139
143
 
140
144
  Example response:
141
145
 
142
- ```json id="uohm9u"
146
+ ```json
143
147
  {
144
148
  "status": "success",
145
149
  "result": {
@@ -157,19 +161,19 @@ Example response:
157
161
 
158
162
  Run the runtime as a warm HTTP server:
159
163
 
160
- ```bash id="1n1n3x"
164
+ ```bash
161
165
  workpeg function runtime --server
162
166
  ```
163
167
 
164
168
  Default endpoint:
165
169
 
166
- ```text id="07ubrq"
170
+ ```text
167
171
  http://0.0.0.0:8000
168
172
  ```
169
173
 
170
174
  Invoke:
171
175
 
172
- ```bash id="4z1s1l"
176
+ ```bash
173
177
  curl -X POST http://localhost:8000/invoke \
174
178
  -H "Content-Type: application/json" \
175
179
  -d '{"context": {}, "payload": {"hello":"world"}}'
@@ -177,7 +181,7 @@ curl -X POST http://localhost:8000/invoke \
177
181
 
178
182
  Health check:
179
183
 
180
- ```bash id="lc3bxr"
184
+ ```bash
181
185
  curl http://localhost:8000/healthz
182
186
  ```
183
187
 
@@ -187,13 +191,13 @@ curl http://localhost:8000/healthz
187
191
 
188
192
  Build a Peg runtime image:
189
193
 
190
- ```bash id="l8z59k"
194
+ ```bash
191
195
  workpeg function build
192
196
  ```
193
197
 
194
198
  Specify custom tag:
195
199
 
196
- ```bash id="ofm9pp"
200
+ ```bash
197
201
  workpeg function build --tag my-image
198
202
  ```
199
203
 
@@ -205,20 +209,20 @@ The build process produces a portable runtime container for the Peg.
205
209
 
206
210
  Run a warm containerized runtime:
207
211
 
208
- ```bash id="rbvt3p"
212
+ ```bash
209
213
  workpeg function run --with docker
210
214
  ```
211
215
 
212
216
  This:
213
217
 
214
218
  * Builds the image (unless disabled)
215
- * Starts a persistent runtime container
219
+ * Starts a detached persistent runtime container
216
220
  * Exposes HTTP endpoints
217
221
  * Enables warm execution
218
222
 
219
223
  Default endpoint:
220
224
 
221
- ```text id="ghp23n"
225
+ ```text
222
226
  http://localhost:8000
223
227
  ```
224
228
 
@@ -228,7 +232,7 @@ http://localhost:8000
228
232
 
229
233
  Attach runtimes to a Docker network:
230
234
 
231
- ```bash id="2rx4ji"
235
+ ```bash
232
236
  workpeg function run \
233
237
  --with docker \
234
238
  --network workpeg_net
@@ -236,12 +240,77 @@ workpeg function run \
236
240
 
237
241
  Useful for inter-Peg communication and local ecosystem development:
238
242
 
239
- ```text id="pwnmql"
243
+ ```text
240
244
  http://peg-name:8000
241
245
  ```
242
246
 
243
247
  This enables multiple Peg runtimes to coexist without port collisions.
244
248
 
249
+ Example:
250
+
251
+ ```bash
252
+ workpeg function run \
253
+ --with docker \
254
+ --network workpeg_net \
255
+ --name calendar
256
+ ```
257
+
258
+ Then other containers can reach it at:
259
+
260
+ ```text
261
+ http://calendar:8000
262
+ ```
263
+
264
+ ---
265
+
266
+ # CDN Asset Uploads
267
+
268
+ Upload public Peg assets to the CDN:
269
+
270
+ Single file:
271
+
272
+ ```bash
273
+ workpeg cdn submit logo.png
274
+ ```
275
+
276
+ Directory:
277
+
278
+ ```bash
279
+ workpeg cdn submit ./dist
280
+ ```
281
+
282
+ Current directory:
283
+
284
+ ```bash
285
+ workpeg cdn submit .
286
+ ```
287
+
288
+ Custom CDN path:
289
+
290
+ ```bash
291
+ workpeg cdn submit ./dist --path assets
292
+ ```
293
+
294
+ Upload archive exactly without extraction:
295
+
296
+ ```bash
297
+ workpeg cdn submit ./dist \
298
+ --path archives/dist.tar.gz \
299
+ --exact
300
+ ```
301
+
302
+ Authentication uses:
303
+
304
+ ```bash
305
+ export WORKPEG_PK=<your-token>
306
+ ```
307
+
308
+ Default registry:
309
+
310
+ ```text
311
+ https://repo.workpeg.com
312
+ ```
313
+
245
314
  ---
246
315
 
247
316
  # Detached Warm Runtime Model
@@ -257,9 +326,9 @@ This enables:
257
326
  * Internal networking
258
327
  * Future orchestration support
259
328
 
260
- Example execution model:
329
+ Execution progression:
261
330
 
262
- ```text id="z3q4z1"
331
+ ```text
263
332
  Function → Runtime Container → Peg → PegStore
264
333
  ```
265
334
 
@@ -276,7 +345,7 @@ Workpeg supports multiple execution backends.
276
345
 
277
346
  Select backend:
278
347
 
279
- ```bash id="f94kq8"
348
+ ```bash
280
349
  workpeg function run --with docker
281
350
  ```
282
351
 
@@ -292,13 +361,13 @@ Runtime resolution order:
292
361
 
293
362
  Optional project configuration:
294
363
 
295
- ```text id="u2pq39"
364
+ ```text
296
365
  workpeg.json
297
366
  ```
298
367
 
299
368
  Example:
300
369
 
301
- ```json id="9cv47i"
370
+ ```json
302
371
  {
303
372
  "runtime": {
304
373
  "default": "docker",
@@ -323,14 +392,14 @@ Example:
323
392
 
324
393
  Functions implement:
325
394
 
326
- ```python id="9a3e3r"
395
+ ```python
327
396
  def main(context: dict, payload: dict):
328
397
  return {...}
329
398
  ```
330
399
 
331
400
  Input:
332
401
 
333
- ```json id="xgcw6e"
402
+ ```json
334
403
  {
335
404
  "context": {...},
336
405
  "payload": {...}
@@ -339,7 +408,7 @@ Input:
339
408
 
340
409
  Success output:
341
410
 
342
- ```json id="zptc4l"
411
+ ```json
343
412
  {
344
413
  "status": "success",
345
414
  "result": {...}
@@ -348,7 +417,7 @@ Success output:
348
417
 
349
418
  Error output:
350
419
 
351
- ```json id="c8z1k6"
420
+ ```json
352
421
  {
353
422
  "status": "error",
354
423
  "error_type": "...",
@@ -362,13 +431,13 @@ Error output:
362
431
 
363
432
  Default entrypoint:
364
433
 
365
- ```text id="e0nbql"
434
+ ```text
366
435
  app.main:main
367
436
  ```
368
437
 
369
438
  Override:
370
439
 
371
- ```bash id="v42ihq"
440
+ ```bash
372
441
  FUNCTION_ENTRYPOINT=app.main:handler \
373
442
  workpeg function runtime
374
443
  ```
@@ -379,7 +448,7 @@ FUNCTION_ENTRYPOINT=app.main:handler \
379
448
 
380
449
  Required for:
381
450
 
382
- ```bash id="p7wvdn"
451
+ ```bash
383
452
  workpeg function build
384
453
  workpeg function run --with docker
385
454
  ```
@@ -392,7 +461,7 @@ Requirements:
392
461
 
393
462
  When running inside another container:
394
463
 
395
- ```bash id="qho4i4"
464
+ ```bash
396
465
  -v /var/run/docker.sock:/var/run/docker.sock
397
466
  ```
398
467
 
@@ -400,18 +469,18 @@ When running inside another container:
400
469
 
401
470
  # Philosophy
402
471
 
403
- Workpeg is designed around composable executable applications.
472
+ Workpeg is designed around portable executable applications.
404
473
 
405
474
  Core progression:
406
475
 
407
- ```text id="i8n38r"
476
+ ```text
408
477
  Function → Runtime → Peg → PegStore → Ecosystem
409
478
  ```
410
479
 
411
- * Functions provide isolated execution units
480
+ * Functions provide isolated runtime units
412
481
  * Pegs package functionality into portable micro-apps
413
- * PegStore enables distribution
414
- * Workpeg provides the runtime and orchestration foundation
482
+ * PegStore enables discovery and distribution
483
+ * Workpeg provides runtime, packaging, and orchestration foundations
415
484
 
416
485
  The long-term direction is a platform where developers can build, distribute, and execute intelligent applications inside a unified ecosystem.
417
486