workpeg 0.158.1__tar.gz → 0.160.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.160.0/MANIFEST.in +4 -0
- {workpeg-0.158.1/src/workpeg.egg-info → workpeg-0.160.0}/PKG-INFO +13 -8
- {workpeg-0.158.1 → workpeg-0.160.0}/README.md +12 -7
- {workpeg-0.158.1 → workpeg-0.160.0}/pyproject.toml +1 -1
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/build.py +33 -7
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/cli.py +383 -11
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/config.py +21 -0
- workpeg-0.160.0/src/workpeg/function_envelopes.py +126 -0
- workpeg-0.160.0/src/workpeg/function_local.py +186 -0
- workpeg-0.160.0/src/workpeg/listen.py +1053 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/project.py +10 -4
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/run.py +60 -7
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/runtime.py +98 -13
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/submit.py +73 -16
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/project/README.md +3 -2
- workpeg-0.160.0/src/workpeg/templates/project/function/app/main.py +12 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/project/workpeg.json +1 -1
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/terminal.py +2 -1
- {workpeg-0.158.1 → workpeg-0.160.0/src/workpeg.egg-info}/PKG-INFO +13 -8
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg.egg-info/SOURCES.txt +9 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_cli.py +67 -0
- workpeg-0.160.0/tests/test_dev_functions_wire.py +62 -0
- workpeg-0.160.0/tests/test_dev_install_example.py +95 -0
- workpeg-0.160.0/tests/test_function_envelopes.py +198 -0
- workpeg-0.160.0/tests/test_function_listen.py +1751 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_project_create.py +33 -3
- workpeg-0.160.0/tests/test_run_cli.py +90 -0
- workpeg-0.160.0/tests/test_runtime_invoke_key.py +179 -0
- workpeg-0.160.0/tests/test_submit.py +695 -0
- workpeg-0.158.1/MANIFEST.in +0 -2
- workpeg-0.158.1/src/workpeg/templates/project/function/app/main.py +0 -8
- workpeg-0.158.1/tests/test_submit.py +0 -379
- {workpeg-0.158.1 → workpeg-0.160.0}/LICENSE +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/setup.cfg +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/auth.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/cdn.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/context.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/create_new.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/doctor.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/function_base.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/function_check.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/sandbox/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/sandbox/docker_driver.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/sandbox/driver.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/starter.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/agents/AGENTS.md +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/agents/CLAUDE.md +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/functions/Dockerfile +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/functions/LICENSE +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/functions/README.md +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/functions/app/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/functions/app/main.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/functions/requirements.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/functions/wheels/README.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/project/function/Dockerfile +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/project/function/app/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/project/function/requirements.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/project/function/wheels/README.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/starter/app_shell.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/starter/components.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/starter/main.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/starter/pages/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/starter/pages/customer.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/starter/pages/customers.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/starter/pages/home.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/templates/starter/pages/not_found.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/actions.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/actions_manifest.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/app.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/build.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/calendar.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/compiler/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/compiler/ast_parser.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/compiler/ir.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/compiler/js_generator.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/compiler/rtc_checks.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/compiler/rtc_tables.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/create.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/dates.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/dev_refused_names.json +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/devmode.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/devserve.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/devsite.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/fake_cloud.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/minify.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/render_nodes.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/renderers_manifest.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/rtc.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/ai-concurrent-replies.md +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/ai-prompt-queue.md +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/ai-question-frame.md +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/ai-subagent-frame.md +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/ai.js +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/editor.js +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/fonts/OFL.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/fonts/geist-italic-cyrillic-ext.af944491.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/fonts/geist-italic-cyrillic.88be6946.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/fonts/geist-italic-latin-ext.370a8962.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/fonts/geist-italic-latin.7611b95c.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/fonts/geist-italic-vietnamese.8dfcf303.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/fonts/geist-normal-cyrillic-ext.b7a545bb.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/fonts/geist-normal-cyrillic.6129fc85.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/fonts/geist-normal-latin-ext.58a6b173.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/fonts/geist-normal-latin.9b6f5ff4.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/fonts/geist-normal-vietnamese.f689f638.woff2 +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/icons.css.gz +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/overlay.js +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/pegment.css +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/rtc.js +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/scaffold.js +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/runtime/workpeg-runtime.js +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/scaffold.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/search_manifest.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/serve.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/skills_manifest.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/state.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/validators.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/watcher.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/widgets/__init__.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/widgets/base.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/widgets/canvas.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/widgets/display.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/widgets/fields.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/widgets/forms.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/widgets/futures.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/widgets/gestures.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/widgets/interactive.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/widgets/layout.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/ui/widgets/pickers.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg/utils.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg.egg-info/dependency_links.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg.egg-info/entry_points.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg.egg-info/requires.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/src/workpeg.egg-info/top_level.txt +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_agents_guide.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_auth.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_build.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_cdn.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_cdn_publish.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_changelog.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_changelog_guard.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_config.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_context.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_create_new.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_doctor.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_function_check.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_pegfn_base.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_release_script.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_run.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_runtime.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_utils.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.0}/tests/test_version.py +0 -0
- {workpeg-0.158.1 → workpeg-0.160.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.160.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 |
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import subprocess
|
|
3
3
|
import sys
|
|
4
4
|
from pathlib import Path
|
|
5
|
+
from typing import Callable
|
|
5
6
|
|
|
6
|
-
from workpeg.config import
|
|
7
|
+
from workpeg.config import load_function_config
|
|
7
8
|
from workpeg.function_check import BundleRefused, check_config, check_files
|
|
8
9
|
|
|
9
10
|
#: What Workpeg's install adds to every function build (the api's
|
|
@@ -49,6 +50,7 @@ def build_image(
|
|
|
49
50
|
tag: str | None = None,
|
|
50
51
|
timeout: "float | None" = None,
|
|
51
52
|
like_workpeg: bool = False,
|
|
53
|
+
output: "Callable[[str], None] | None" = None,
|
|
52
54
|
) -> str:
|
|
53
55
|
"""Build the function at *path* and return the image's tag.
|
|
54
56
|
|
|
@@ -60,7 +62,13 @@ def build_image(
|
|
|
60
62
|
local tag, with a warning, because only the upload is refused for it.
|
|
61
63
|
|
|
62
64
|
*like_workpeg* adds WORKPEG_BUILD_FLAGS, so the build fails here when a
|
|
63
|
-
step downloads, or when the wheels are not for linux/amd64.
|
|
65
|
+
step downloads, or when the wheels are not for linux/amd64.
|
|
66
|
+
|
|
67
|
+
*output*, when given, takes what Docker prints instead of the terminal
|
|
68
|
+
(stdout and stderr together, once the build ends, whether it passed or
|
|
69
|
+
failed), and the ``build.image`` warning too, so that a caller can
|
|
70
|
+
escape it before it is printed: a Dockerfile's RUN steps print
|
|
71
|
+
whatever they like."""
|
|
64
72
|
project_path = Path(path).resolve()
|
|
65
73
|
|
|
66
74
|
validate_function_project(project_path)
|
|
@@ -68,10 +76,14 @@ def build_image(
|
|
|
68
76
|
try:
|
|
69
77
|
check_config(project_path)
|
|
70
78
|
except BundleRefused as refused:
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
warning = (f"WARNING: {refused} `workpeg function submit` will "
|
|
80
|
+
"refuse this project.")
|
|
81
|
+
if output is None:
|
|
82
|
+
print(warning, file=sys.stderr)
|
|
83
|
+
else:
|
|
84
|
+
output(warning)
|
|
73
85
|
|
|
74
|
-
cfg =
|
|
86
|
+
cfg = load_function_config(project_path)
|
|
75
87
|
|
|
76
88
|
image = tag or cfg.get("build", {}).get("image") or default_image_name(project_path)
|
|
77
89
|
|
|
@@ -80,11 +92,15 @@ def build_image(
|
|
|
80
92
|
argv += WORKPEG_BUILD_FLAGS
|
|
81
93
|
argv += ["-t", image, str(project_path)]
|
|
82
94
|
|
|
95
|
+
captured = {} if output is None else {
|
|
96
|
+
"stdout": subprocess.PIPE, "stderr": subprocess.STDOUT,
|
|
97
|
+
"text": True, "errors": "replace"}
|
|
83
98
|
try:
|
|
84
|
-
subprocess.run(
|
|
99
|
+
done = subprocess.run(
|
|
85
100
|
argv,
|
|
86
|
-
check=
|
|
101
|
+
check=output is None,
|
|
87
102
|
timeout=timeout,
|
|
103
|
+
**captured,
|
|
88
104
|
)
|
|
89
105
|
except FileNotFoundError as exc:
|
|
90
106
|
raise RuntimeError(
|
|
@@ -92,6 +108,9 @@ def build_image(
|
|
|
92
108
|
"command is on your PATH."
|
|
93
109
|
) from exc
|
|
94
110
|
except subprocess.TimeoutExpired as exc:
|
|
111
|
+
if output is not None and exc.output:
|
|
112
|
+
output(exc.output if isinstance(exc.output, str)
|
|
113
|
+
else exc.output.decode("utf-8", "replace"))
|
|
95
114
|
raise RuntimeError(
|
|
96
115
|
f"Docker build timed out after {timeout}s — it never finished, so "
|
|
97
116
|
"the run was abandoned rather than left hanging."
|
|
@@ -102,4 +121,11 @@ def build_image(
|
|
|
102
121
|
"Check the output above for details."
|
|
103
122
|
) from exc
|
|
104
123
|
|
|
124
|
+
if output is not None:
|
|
125
|
+
if done.stdout:
|
|
126
|
+
output(done.stdout)
|
|
127
|
+
if done.returncode != 0:
|
|
128
|
+
raise RuntimeError(
|
|
129
|
+
f"Docker build failed (exit {done.returncode}). "
|
|
130
|
+
"Check the output above for details.")
|
|
105
131
|
return image
|