workpeg 0.158.1__tar.gz → 0.159.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.
- {workpeg-0.158.1/src/workpeg.egg-info → workpeg-0.159.0}/PKG-INFO +13 -8
- {workpeg-0.158.1 → workpeg-0.159.0}/README.md +12 -7
- {workpeg-0.158.1 → workpeg-0.159.0}/pyproject.toml +1 -1
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/cli.py +13 -3
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/submit.py +73 -16
- {workpeg-0.158.1 → workpeg-0.159.0/src/workpeg.egg-info}/PKG-INFO +13 -8
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_cli.py +67 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_submit.py +307 -1
- {workpeg-0.158.1 → workpeg-0.159.0}/LICENSE +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/MANIFEST.in +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/setup.cfg +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/auth.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/build.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/cdn.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/config.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/context.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/create_new.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/doctor.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/function_base.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/function_check.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/project.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/run.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/runtime.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/sandbox/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/sandbox/docker_driver.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/sandbox/driver.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/starter.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/agents/AGENTS.md +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/agents/CLAUDE.md +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/functions/Dockerfile +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/functions/LICENSE +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/functions/README.md +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/functions/app/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/functions/app/main.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/functions/requirements.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/functions/wheels/README.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/project/README.md +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/project/function/Dockerfile +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/project/function/app/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/project/function/app/main.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/project/function/requirements.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/project/function/wheels/README.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/project/workpeg.json +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/starter/app_shell.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/starter/components.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/starter/main.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/starter/pages/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/starter/pages/customer.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/starter/pages/customers.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/starter/pages/home.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/templates/starter/pages/not_found.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/terminal.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/actions.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/actions_manifest.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/app.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/build.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/calendar.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/compiler/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/compiler/ast_parser.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/compiler/ir.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/compiler/js_generator.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/compiler/rtc_checks.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/compiler/rtc_tables.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/create.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/dates.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/dev_refused_names.json +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/devmode.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/devserve.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/devsite.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/fake_cloud.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/minify.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/render_nodes.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/renderers_manifest.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/rtc.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/ai-concurrent-replies.md +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/ai-prompt-queue.md +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/ai-question-frame.md +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/ai-subagent-frame.md +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/ai.js +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/editor.js +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/fonts/OFL.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/fonts/geist-italic-cyrillic-ext.af944491.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/fonts/geist-italic-cyrillic.88be6946.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/fonts/geist-italic-latin-ext.370a8962.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/fonts/geist-italic-latin.7611b95c.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/fonts/geist-italic-vietnamese.8dfcf303.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/fonts/geist-normal-cyrillic-ext.b7a545bb.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/fonts/geist-normal-cyrillic.6129fc85.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/fonts/geist-normal-latin-ext.58a6b173.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/fonts/geist-normal-latin.9b6f5ff4.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/fonts/geist-normal-vietnamese.f689f638.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/icons.css.gz +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/overlay.js +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/pegment.css +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/rtc.js +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/scaffold.js +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/runtime/workpeg-runtime.js +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/scaffold.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/search_manifest.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/serve.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/skills_manifest.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/state.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/validators.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/watcher.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/widgets/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/widgets/base.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/widgets/canvas.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/widgets/display.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/widgets/fields.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/widgets/forms.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/widgets/futures.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/widgets/gestures.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/widgets/interactive.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/widgets/layout.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/ui/widgets/pickers.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg/utils.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg.egg-info/SOURCES.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg.egg-info/dependency_links.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg.egg-info/entry_points.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg.egg-info/requires.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/src/workpeg.egg-info/top_level.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_agents_guide.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_auth.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_build.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_cdn.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_cdn_publish.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_changelog.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_changelog_guard.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_config.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_context.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_create_new.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_doctor.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_function_check.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_pegfn_base.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_project_create.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_release_script.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_run.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_runtime.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_utils.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_version.py +0 -0
- {workpeg-0.158.1 → workpeg-0.159.0}/tests/test_watch_pipeline.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: workpeg
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.159.0
|
|
4
4
|
Summary: Workpeg function runtime and SDK
|
|
5
5
|
Author-email: Workpeg <support@workpeg.com>
|
|
6
6
|
License: MIT
|
|
@@ -25,13 +25,13 @@ Dynamic: license-file
|
|
|
25
25
|
|
|
26
26
|
# Workpeg SDK
|
|
27
27
|
|
|
28
|
-
Python SDK and CLI for building, packaging
|
|
28
|
+
Python SDK and CLI for building, packaging and submitting Workpeg Pegs.
|
|
29
29
|
|
|
30
30
|
Workpeg is a platform for developing portable applications called **Pegs**. Pegs can be built, packaged, distributed through the PegStore, and integrated into the broader Workpeg ecosystem.
|
|
31
31
|
|
|
32
32
|
The SDK covers:
|
|
33
33
|
|
|
34
|
-
- **Functions** — serverless backend logic, Docker packaging, registry
|
|
34
|
+
- **Functions** — serverless backend logic, Docker packaging, submitting to the registry
|
|
35
35
|
- **CDN** — static asset uploads for Peg branding and distribution
|
|
36
36
|
- **UI Compiler** — compile Python UI apps directly to browser JavaScript
|
|
37
37
|
|
|
@@ -71,7 +71,7 @@ workpeg ui ...
|
|
|
71
71
|
| Namespace | Purpose |
|
|
72
72
|
| ---------- | ------------------------------------------------- |
|
|
73
73
|
| `project` | Scaffold a whole peg — UI, function and manifest |
|
|
74
|
-
| `function` | Create, build, run, and
|
|
74
|
+
| `function` | Create, build, run, and submit Workpeg Functions |
|
|
75
75
|
| `cdn` | Upload public Peg assets to the CDN |
|
|
76
76
|
| `ui` | Scaffold, compile, and serve Python Peg UI apps |
|
|
77
77
|
|
|
@@ -108,7 +108,7 @@ Full reference: [docs/projects.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob
|
|
|
108
108
|
|
|
109
109
|
## Functions
|
|
110
110
|
|
|
111
|
-
Functions are the backend logic of a Peg. They are packaged as Docker images and
|
|
111
|
+
Functions are the backend logic of a Peg. They are packaged as Docker images and submitted to the Workpeg Registry; Workpeg reviews each `main` version and publishes it.
|
|
112
112
|
|
|
113
113
|
**Create a project:**
|
|
114
114
|
|
|
@@ -150,13 +150,18 @@ workpeg function build
|
|
|
150
150
|
workpeg function run --with docker
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
-
**
|
|
153
|
+
**Submit:**
|
|
154
154
|
|
|
155
155
|
```bash
|
|
156
156
|
export WORKPEG_PK=<your-token>
|
|
157
|
-
workpeg function submit
|
|
157
|
+
workpeg function submit 1.0.0 # dev: development only, never installed
|
|
158
|
+
workpeg function submit main:1.0.0 # release: Workpeg reviews each version
|
|
158
159
|
```
|
|
159
160
|
|
|
161
|
+
A bare version goes to the `dev` branch. `main` is the release channel:
|
|
162
|
+
Workpeg reviews each main version, and a main version is installed only once
|
|
163
|
+
approved. No other branch is ever reviewed, installed or run on Workpeg.
|
|
164
|
+
|
|
160
165
|
Full reference: [docs/functions.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/functions.md)
|
|
161
166
|
|
|
162
167
|
---
|
|
@@ -451,7 +456,7 @@ Optional `workpeg.json` in your project root. `namespace` records the peg the pr
|
|
|
451
456
|
| --- | --- |
|
|
452
457
|
| Function runtime (local) | Available |
|
|
453
458
|
| Function runtime (Docker) | Available |
|
|
454
|
-
| Function
|
|
459
|
+
| Function submit | Available |
|
|
455
460
|
| CDN asset uploads | Available |
|
|
456
461
|
| UI Compiler (Python → JS) | Available |
|
|
457
462
|
| `workpeg project create` (scaffold UI + function + manifest) | Available |
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Workpeg SDK
|
|
2
2
|
|
|
3
|
-
Python SDK and CLI for building, packaging
|
|
3
|
+
Python SDK and CLI for building, packaging and submitting Workpeg Pegs.
|
|
4
4
|
|
|
5
5
|
Workpeg is a platform for developing portable applications called **Pegs**. Pegs can be built, packaged, distributed through the PegStore, and integrated into the broader Workpeg ecosystem.
|
|
6
6
|
|
|
7
7
|
The SDK covers:
|
|
8
8
|
|
|
9
|
-
- **Functions** — serverless backend logic, Docker packaging, registry
|
|
9
|
+
- **Functions** — serverless backend logic, Docker packaging, submitting to the registry
|
|
10
10
|
- **CDN** — static asset uploads for Peg branding and distribution
|
|
11
11
|
- **UI Compiler** — compile Python UI apps directly to browser JavaScript
|
|
12
12
|
|
|
@@ -46,7 +46,7 @@ workpeg ui ...
|
|
|
46
46
|
| Namespace | Purpose |
|
|
47
47
|
| ---------- | ------------------------------------------------- |
|
|
48
48
|
| `project` | Scaffold a whole peg — UI, function and manifest |
|
|
49
|
-
| `function` | Create, build, run, and
|
|
49
|
+
| `function` | Create, build, run, and submit Workpeg Functions |
|
|
50
50
|
| `cdn` | Upload public Peg assets to the CDN |
|
|
51
51
|
| `ui` | Scaffold, compile, and serve Python Peg UI apps |
|
|
52
52
|
|
|
@@ -83,7 +83,7 @@ Full reference: [docs/projects.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob
|
|
|
83
83
|
|
|
84
84
|
## Functions
|
|
85
85
|
|
|
86
|
-
Functions are the backend logic of a Peg. They are packaged as Docker images and
|
|
86
|
+
Functions are the backend logic of a Peg. They are packaged as Docker images and submitted to the Workpeg Registry; Workpeg reviews each `main` version and publishes it.
|
|
87
87
|
|
|
88
88
|
**Create a project:**
|
|
89
89
|
|
|
@@ -125,13 +125,18 @@ workpeg function build
|
|
|
125
125
|
workpeg function run --with docker
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
-
**
|
|
128
|
+
**Submit:**
|
|
129
129
|
|
|
130
130
|
```bash
|
|
131
131
|
export WORKPEG_PK=<your-token>
|
|
132
|
-
workpeg function submit
|
|
132
|
+
workpeg function submit 1.0.0 # dev: development only, never installed
|
|
133
|
+
workpeg function submit main:1.0.0 # release: Workpeg reviews each version
|
|
133
134
|
```
|
|
134
135
|
|
|
136
|
+
A bare version goes to the `dev` branch. `main` is the release channel:
|
|
137
|
+
Workpeg reviews each main version, and a main version is installed only once
|
|
138
|
+
approved. No other branch is ever reviewed, installed or run on Workpeg.
|
|
139
|
+
|
|
135
140
|
Full reference: [docs/functions.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/functions.md)
|
|
136
141
|
|
|
137
142
|
---
|
|
@@ -426,7 +431,7 @@ Optional `workpeg.json` in your project root. `namespace` records the peg the pr
|
|
|
426
431
|
| --- | --- |
|
|
427
432
|
| Function runtime (local) | Available |
|
|
428
433
|
| Function runtime (Docker) | Available |
|
|
429
|
-
| Function
|
|
434
|
+
| Function submit | Available |
|
|
430
435
|
| CDN asset uploads | Available |
|
|
431
436
|
| UI Compiler (Python → JS) | Available |
|
|
432
437
|
| `workpeg project create` (scaffold UI + function + manifest) | Available |
|
|
@@ -32,7 +32,8 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
32
32
|
" workpeg function new hello\n"
|
|
33
33
|
" workpeg function build\n"
|
|
34
34
|
" workpeg function run --with docker\n"
|
|
35
|
-
" workpeg function submit
|
|
35
|
+
" workpeg function submit 1.0.0 (dev, not reviewed)\n"
|
|
36
|
+
" workpeg function submit main:1.0.0 (release, reviewed)\n"
|
|
36
37
|
" workpeg cdn submit ./dist\n"
|
|
37
38
|
" workpeg cdn submit ex.png\n"
|
|
38
39
|
" workpeg ui new counter\n"
|
|
@@ -120,9 +121,15 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
120
121
|
|
|
121
122
|
submit_p = function_sub.add_parser(
|
|
122
123
|
"submit",
|
|
123
|
-
help="
|
|
124
|
+
help="Upload a function bundle (dev by default; main is reviewed)",
|
|
125
|
+
description=(
|
|
126
|
+
"Upload a function bundle. A bare version goes to the 'dev' "
|
|
127
|
+
"branch; 'main:<version>' submits a release for Workpeg's "
|
|
128
|
+
"review."
|
|
129
|
+
),
|
|
124
130
|
)
|
|
125
|
-
submit_p.add_argument("ref")
|
|
131
|
+
submit_p.add_argument("ref", help=submit.REF_HELP)
|
|
132
|
+
submit_p.add_argument("--branch", default=None, help=submit.BRANCH_HELP)
|
|
126
133
|
submit_p.add_argument("--api", default=None)
|
|
127
134
|
submit_p.add_argument("--path", default=None)
|
|
128
135
|
submit_p.add_argument("--timeout", type=int, default=None)
|
|
@@ -723,6 +730,9 @@ def main(argv=None) -> None:
|
|
|
723
730
|
|
|
724
731
|
submit_argv = [args.ref]
|
|
725
732
|
|
|
733
|
+
if args.branch is not None:
|
|
734
|
+
submit_argv += ["--branch", args.branch]
|
|
735
|
+
|
|
726
736
|
if args.api:
|
|
727
737
|
submit_argv += ["--api", args.api]
|
|
728
738
|
|
|
@@ -6,7 +6,7 @@ import os
|
|
|
6
6
|
import sys
|
|
7
7
|
import tarfile
|
|
8
8
|
from pathlib import Path
|
|
9
|
-
from typing import Tuple
|
|
9
|
+
from typing import Optional, Tuple
|
|
10
10
|
|
|
11
11
|
import requests
|
|
12
12
|
|
|
@@ -42,24 +42,80 @@ def _fail(msg: str, code: int = 2) -> None:
|
|
|
42
42
|
raise SystemExit(code)
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
# Owner, 2026-11-11. A bare version goes to `dev`, so releasing is always a
|
|
46
|
+
# choice someone typed. `main` is the release channel: Workpeg reviews each
|
|
47
|
+
# main version, and installs or publishes it only once it is approved. No
|
|
48
|
+
# other branch is ever reviewed, installed or run on Workpeg.
|
|
49
|
+
DEFAULT_BRANCH = "dev"
|
|
50
|
+
RELEASE_BRANCH = "main"
|
|
51
|
+
|
|
52
|
+
REF_HELP = (
|
|
53
|
+
"the version to upload, as <version> (goes to the 'dev' branch) or "
|
|
54
|
+
"<branch>:<version>. 'main:<version>' is the release: Workpeg reviews "
|
|
55
|
+
"each main version and installs or publishes it only once it is "
|
|
56
|
+
"approved. Every other branch is for development only and is never "
|
|
57
|
+
"reviewed, installed or run on Workpeg."
|
|
58
|
+
)
|
|
59
|
+
BRANCH_HELP = (
|
|
60
|
+
"the branch to upload to when the ref is a bare version "
|
|
61
|
+
f"(default: {DEFAULT_BRANCH}). Use --branch {RELEASE_BRANCH} or "
|
|
62
|
+
f"{RELEASE_BRANCH}:<version> to submit a release for review."
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def parse_ref(ref: str, branch: Optional[str] = None) -> Tuple[str, str]:
|
|
46
67
|
"""
|
|
47
|
-
Parse "
|
|
68
|
+
Parse "<version>" or "<branch>:<version>" into (branch, version).
|
|
69
|
+
|
|
70
|
+
A bare version goes to ``branch``, or to ``dev`` when none is named. A
|
|
71
|
+
colon ref names its own branch, and a ``branch`` that disagrees with it
|
|
72
|
+
is refused rather than one silently winning.
|
|
48
73
|
"""
|
|
49
|
-
if
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
74
|
+
if branch is not None:
|
|
75
|
+
branch = branch.strip()
|
|
76
|
+
if not branch:
|
|
77
|
+
_fail("--branch is empty")
|
|
78
|
+
|
|
79
|
+
ref = ref.strip()
|
|
80
|
+
if ":" in ref:
|
|
81
|
+
branch_name, version = ref.split(":", 1)
|
|
82
|
+
branch_name = branch_name.strip()
|
|
83
|
+
if not branch_name:
|
|
84
|
+
_fail("branch name before ':' is empty "
|
|
85
|
+
"(example: main:1.0.0, or just 1.0.0 for dev)")
|
|
86
|
+
if branch is not None and branch != branch_name:
|
|
87
|
+
_fail(f"'{ref}' names branch '{branch_name}' but --branch says "
|
|
88
|
+
f"'{branch}'. Give one: '{branch}:{version.strip()}', or "
|
|
89
|
+
f"'{ref}' without --branch.")
|
|
90
|
+
else:
|
|
91
|
+
# `submit main` would upload a version named "main" to dev, the
|
|
92
|
+
# opposite of what was meant, so a bare branch name is refused.
|
|
93
|
+
bare = ref.lower()
|
|
94
|
+
if bare in (RELEASE_BRANCH, DEFAULT_BRANCH):
|
|
95
|
+
_fail(f"'{ref}' is a branch, not a version: "
|
|
96
|
+
f"give {bare}:<version>")
|
|
97
|
+
branch_name = branch if branch is not None else DEFAULT_BRANCH
|
|
98
|
+
version = ref
|
|
53
99
|
version = version.strip()
|
|
54
100
|
|
|
55
|
-
if not branch_name:
|
|
56
|
-
_fail("branch_name is empty")
|
|
57
101
|
if not version:
|
|
58
|
-
_fail("version is empty"
|
|
102
|
+
_fail("version is empty "
|
|
103
|
+
"(example: 1.0.0 for dev, main:1.0.0 for a release)")
|
|
59
104
|
|
|
60
105
|
return branch_name, version
|
|
61
106
|
|
|
62
107
|
|
|
108
|
+
def submitted_line(branch: str, version: str) -> str:
|
|
109
|
+
"""The one line printed after a successful upload: what happens next."""
|
|
110
|
+
ref = f"{branch}:{version}"
|
|
111
|
+
if branch == RELEASE_BRANCH:
|
|
112
|
+
return (f"{ref} is submitted for review. Workpeg installs or "
|
|
113
|
+
"publishes it only once it is approved.")
|
|
114
|
+
return (f"{ref} is uploaded for development only; not reviewed, "
|
|
115
|
+
"installed or run on Workpeg; submit "
|
|
116
|
+
f"{RELEASE_BRANCH}:{version} when it is ready.")
|
|
117
|
+
|
|
118
|
+
|
|
63
119
|
def decode_jwt_payload_no_verify(token: str) -> dict:
|
|
64
120
|
"""
|
|
65
121
|
Extract JWT payload WITHOUT verifying signature.
|
|
@@ -200,11 +256,10 @@ def submit_bundle(
|
|
|
200
256
|
def main(argv=None) -> None:
|
|
201
257
|
parser = argparse.ArgumentParser(
|
|
202
258
|
prog="workpeg submit",
|
|
203
|
-
description="
|
|
259
|
+
description="Upload a Workpeg function bundle to a Peg's registry.")
|
|
204
260
|
parser.add_argument(
|
|
205
|
-
"ref",
|
|
206
|
-
|
|
207
|
-
" (e.g., main:1.0.0)")
|
|
261
|
+
"ref", metavar="ref", help=REF_HELP)
|
|
262
|
+
parser.add_argument("--branch", default=None, help=BRANCH_HELP)
|
|
208
263
|
parser.add_argument("--api", default=os.environ.get(API_ENV,
|
|
209
264
|
DEFAULT_API_BASE), help="API base URL")
|
|
210
265
|
parser.add_argument("--path", default=os.environ.get(PATH_ENV,
|
|
@@ -213,12 +268,12 @@ def main(argv=None) -> None:
|
|
|
213
268
|
help="Request timeout (seconds)")
|
|
214
269
|
args = parser.parse_args(argv)
|
|
215
270
|
|
|
271
|
+
branch_name, version = parse_ref(args.ref, branch=args.branch)
|
|
272
|
+
|
|
216
273
|
token = os.environ.get(JWT_ENV)
|
|
217
274
|
if not token:
|
|
218
275
|
_fail(f"Missing env var {JWT_ENV}")
|
|
219
276
|
|
|
220
|
-
branch_name, version = parse_ref(args.ref)
|
|
221
|
-
|
|
222
277
|
payload = decode_jwt_payload_no_verify(token)
|
|
223
278
|
peg_id = payload.get("peg_namespace")
|
|
224
279
|
if not peg_id:
|
|
@@ -240,6 +295,8 @@ def main(argv=None) -> None:
|
|
|
240
295
|
)
|
|
241
296
|
|
|
242
297
|
print(json.dumps(result, indent=2))
|
|
298
|
+
# stderr, so stdout stays the registry's JSON for anything piping it.
|
|
299
|
+
print(submitted_line(branch_name, version), file=sys.stderr)
|
|
243
300
|
|
|
244
301
|
|
|
245
302
|
if __name__ == "__main__":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: workpeg
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.159.0
|
|
4
4
|
Summary: Workpeg function runtime and SDK
|
|
5
5
|
Author-email: Workpeg <support@workpeg.com>
|
|
6
6
|
License: MIT
|
|
@@ -25,13 +25,13 @@ Dynamic: license-file
|
|
|
25
25
|
|
|
26
26
|
# Workpeg SDK
|
|
27
27
|
|
|
28
|
-
Python SDK and CLI for building, packaging
|
|
28
|
+
Python SDK and CLI for building, packaging and submitting Workpeg Pegs.
|
|
29
29
|
|
|
30
30
|
Workpeg is a platform for developing portable applications called **Pegs**. Pegs can be built, packaged, distributed through the PegStore, and integrated into the broader Workpeg ecosystem.
|
|
31
31
|
|
|
32
32
|
The SDK covers:
|
|
33
33
|
|
|
34
|
-
- **Functions** — serverless backend logic, Docker packaging, registry
|
|
34
|
+
- **Functions** — serverless backend logic, Docker packaging, submitting to the registry
|
|
35
35
|
- **CDN** — static asset uploads for Peg branding and distribution
|
|
36
36
|
- **UI Compiler** — compile Python UI apps directly to browser JavaScript
|
|
37
37
|
|
|
@@ -71,7 +71,7 @@ workpeg ui ...
|
|
|
71
71
|
| Namespace | Purpose |
|
|
72
72
|
| ---------- | ------------------------------------------------- |
|
|
73
73
|
| `project` | Scaffold a whole peg — UI, function and manifest |
|
|
74
|
-
| `function` | Create, build, run, and
|
|
74
|
+
| `function` | Create, build, run, and submit Workpeg Functions |
|
|
75
75
|
| `cdn` | Upload public Peg assets to the CDN |
|
|
76
76
|
| `ui` | Scaffold, compile, and serve Python Peg UI apps |
|
|
77
77
|
|
|
@@ -108,7 +108,7 @@ Full reference: [docs/projects.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob
|
|
|
108
108
|
|
|
109
109
|
## Functions
|
|
110
110
|
|
|
111
|
-
Functions are the backend logic of a Peg. They are packaged as Docker images and
|
|
111
|
+
Functions are the backend logic of a Peg. They are packaged as Docker images and submitted to the Workpeg Registry; Workpeg reviews each `main` version and publishes it.
|
|
112
112
|
|
|
113
113
|
**Create a project:**
|
|
114
114
|
|
|
@@ -150,13 +150,18 @@ workpeg function build
|
|
|
150
150
|
workpeg function run --with docker
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
-
**
|
|
153
|
+
**Submit:**
|
|
154
154
|
|
|
155
155
|
```bash
|
|
156
156
|
export WORKPEG_PK=<your-token>
|
|
157
|
-
workpeg function submit
|
|
157
|
+
workpeg function submit 1.0.0 # dev: development only, never installed
|
|
158
|
+
workpeg function submit main:1.0.0 # release: Workpeg reviews each version
|
|
158
159
|
```
|
|
159
160
|
|
|
161
|
+
A bare version goes to the `dev` branch. `main` is the release channel:
|
|
162
|
+
Workpeg reviews each main version, and a main version is installed only once
|
|
163
|
+
approved. No other branch is ever reviewed, installed or run on Workpeg.
|
|
164
|
+
|
|
160
165
|
Full reference: [docs/functions.md](https://gitlab.com/workpeg/workpeg-sdk/-/blob/main/docs/functions.md)
|
|
161
166
|
|
|
162
167
|
---
|
|
@@ -451,7 +456,7 @@ Optional `workpeg.json` in your project root. `namespace` records the peg the pr
|
|
|
451
456
|
| --- | --- |
|
|
452
457
|
| Function runtime (local) | Available |
|
|
453
458
|
| Function runtime (Docker) | Available |
|
|
454
|
-
| Function
|
|
459
|
+
| Function submit | Available |
|
|
455
460
|
| CDN asset uploads | Available |
|
|
456
461
|
| UI Compiler (Python → JS) | Available |
|
|
457
462
|
| `workpeg project create` (scaffold UI + function + manifest) | Available |
|
|
@@ -164,6 +164,73 @@ def test_cli_function_submit(monkeypatch):
|
|
|
164
164
|
]
|
|
165
165
|
|
|
166
166
|
|
|
167
|
+
def test_cli_function_submit_bare_version(monkeypatch):
|
|
168
|
+
called = {}
|
|
169
|
+
monkeypatch.setattr(cli.submit, "main",
|
|
170
|
+
lambda argv: called.setdefault("argv", argv))
|
|
171
|
+
cli.main(["function", "submit", "1.0.0"])
|
|
172
|
+
# no --branch: submit.main applies the dev default itself
|
|
173
|
+
assert called["argv"] == ["1.0.0"]
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def test_cli_function_submit_passes_branch(monkeypatch):
|
|
177
|
+
called = {}
|
|
178
|
+
monkeypatch.setattr(cli.submit, "main",
|
|
179
|
+
lambda argv: called.setdefault("argv", argv))
|
|
180
|
+
cli.main(["function", "submit", "1.0.0", "--branch", "main"])
|
|
181
|
+
assert called["argv"] == ["1.0.0", "--branch", "main"]
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def test_cli_function_submit_end_to_end_branch(monkeypatch, tmp_path, capsys):
|
|
185
|
+
"""Through the real submit.main: the CLI's --branch reaches the form."""
|
|
186
|
+
import base64
|
|
187
|
+
import json
|
|
188
|
+
from unittest.mock import MagicMock
|
|
189
|
+
|
|
190
|
+
def b64(d):
|
|
191
|
+
return base64.urlsafe_b64encode(
|
|
192
|
+
json.dumps(d).encode()).decode().rstrip("=")
|
|
193
|
+
token = f"{b64({'alg': 'HS256'})}.{b64({'peg_namespace': 'p'})}.sig"
|
|
194
|
+
monkeypatch.setenv("WORKPEG_PK", token)
|
|
195
|
+
(tmp_path / "Dockerfile").write_text("FROM python:3.12-slim\n")
|
|
196
|
+
(tmp_path / "app").mkdir()
|
|
197
|
+
(tmp_path / "app" / "main.py").write_text("x=1\n")
|
|
198
|
+
|
|
199
|
+
for argv, branch in ((["2.0.0"], "dev"),
|
|
200
|
+
(["2.0.0", "--branch", "main"], "main"),
|
|
201
|
+
(["main:2.0.0"], "main")):
|
|
202
|
+
with patch("workpeg.submit.requests.post") as post:
|
|
203
|
+
resp = MagicMock(status_code=201)
|
|
204
|
+
resp.json.return_value = {}
|
|
205
|
+
post.return_value = resp
|
|
206
|
+
cli.main(["function", "submit", *argv, "--path", str(tmp_path)])
|
|
207
|
+
assert post.call_args.kwargs["data"] == {
|
|
208
|
+
"branch_id": branch, "version": "2.0.0"}
|
|
209
|
+
|
|
210
|
+
with patch("workpeg.submit.requests.post") as post:
|
|
211
|
+
with pytest.raises(SystemExit) as e:
|
|
212
|
+
cli.main(["function", "submit", "main:2.0.0", "--branch", "dev",
|
|
213
|
+
"--path", str(tmp_path)])
|
|
214
|
+
assert e.value.code == 2
|
|
215
|
+
post.assert_not_called()
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def test_cli_function_submit_help_explains_ref_and_branch(capsys):
|
|
219
|
+
with pytest.raises(SystemExit):
|
|
220
|
+
cli.main(["function", "submit", "--help"])
|
|
221
|
+
out = " ".join(capsys.readouterr().out.split())
|
|
222
|
+
assert "--branch" in out
|
|
223
|
+
assert "dev" in out and "main" in out
|
|
224
|
+
assert "review" in out
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def test_cli_epilog_submit_example_has_no_function_name_as_branch(capsys):
|
|
228
|
+
help_text = cli.build_parser().format_help()
|
|
229
|
+
assert "submit hello:" not in help_text
|
|
230
|
+
assert "workpeg function submit 1.0.0" in help_text
|
|
231
|
+
assert "workpeg function submit main:1.0.0" in help_text
|
|
232
|
+
|
|
233
|
+
|
|
167
234
|
def test_cli_function_build(monkeypatch, capsys):
|
|
168
235
|
monkeypatch.setattr(
|
|
169
236
|
cli.build,
|