workpeg 0.2.1__tar.gz → 0.3.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.2.1/src/workpeg.egg-info → workpeg-0.3.0}/PKG-INFO +1 -1
- {workpeg-0.2.1 → workpeg-0.3.0}/pyproject.toml +4 -4
- {workpeg-0.2.1/src/workpeg_sdk → workpeg-0.3.0/src/workpeg}/__init__.py +1 -1
- {workpeg-0.2.1/src/workpeg_sdk → workpeg-0.3.0/src/workpeg}/build.py +2 -2
- {workpeg-0.2.1/src/workpeg_sdk → workpeg-0.3.0/src/workpeg}/cli.py +1 -1
- {workpeg-0.2.1/src/workpeg_sdk → workpeg-0.3.0/src/workpeg}/config.py +1 -1
- {workpeg-0.2.1/src/workpeg_sdk → workpeg-0.3.0/src/workpeg}/create_new.py +4 -4
- {workpeg-0.2.1/src/workpeg_sdk → workpeg-0.3.0/src/workpeg}/run.py +3 -3
- {workpeg-0.2.1/src/workpeg_sdk → workpeg-0.3.0/src/workpeg}/runtime.py +1 -1
- {workpeg-0.2.1 → workpeg-0.3.0/src/workpeg.egg-info}/PKG-INFO +1 -1
- workpeg-0.3.0/src/workpeg.egg-info/SOURCES.txt +31 -0
- workpeg-0.3.0/src/workpeg.egg-info/entry_points.txt +2 -0
- workpeg-0.3.0/src/workpeg.egg-info/top_level.txt +1 -0
- {workpeg-0.2.1 → workpeg-0.3.0}/tests/test_build.py +1 -1
- {workpeg-0.2.1 → workpeg-0.3.0}/tests/test_cli.py +1 -1
- {workpeg-0.2.1 → workpeg-0.3.0}/tests/test_create_new.py +1 -1
- {workpeg-0.2.1 → workpeg-0.3.0}/tests/test_run.py +1 -1
- {workpeg-0.2.1 → workpeg-0.3.0}/tests/test_runtime.py +1 -1
- {workpeg-0.2.1 → workpeg-0.3.0}/tests/test_submit.py +7 -7
- workpeg-0.2.1/src/workpeg.egg-info/SOURCES.txt +0 -31
- workpeg-0.2.1/src/workpeg.egg-info/entry_points.txt +0 -2
- workpeg-0.2.1/src/workpeg.egg-info/top_level.txt +0 -1
- {workpeg-0.2.1 → workpeg-0.3.0}/LICENSE +0 -0
- {workpeg-0.2.1 → workpeg-0.3.0}/MANIFEST.in +0 -0
- {workpeg-0.2.1 → workpeg-0.3.0}/README.md +0 -0
- {workpeg-0.2.1 → workpeg-0.3.0}/setup.cfg +0 -0
- {workpeg-0.2.1/src/workpeg_sdk → workpeg-0.3.0/src/workpeg}/submit.py +0 -0
- {workpeg-0.2.1/src/workpeg_sdk → workpeg-0.3.0/src/workpeg}/templates/__init__.py +0 -0
- {workpeg-0.2.1/src/workpeg_sdk → workpeg-0.3.0/src/workpeg}/templates/functions/Dockerfile +0 -0
- {workpeg-0.2.1/src/workpeg_sdk → workpeg-0.3.0/src/workpeg}/templates/functions/LICENSE +0 -0
- {workpeg-0.2.1/src/workpeg_sdk → workpeg-0.3.0/src/workpeg}/templates/functions/README.md +0 -0
- {workpeg-0.2.1/src/workpeg_sdk → workpeg-0.3.0/src/workpeg}/templates/functions/app/__init__.py +0 -0
- {workpeg-0.2.1/src/workpeg_sdk → workpeg-0.3.0/src/workpeg}/templates/functions/app/main.py +0 -0
- {workpeg-0.2.1/src/workpeg_sdk → workpeg-0.3.0/src/workpeg}/templates/functions/requirements.txt +0 -0
- {workpeg-0.2.1 → workpeg-0.3.0}/src/workpeg.egg-info/dependency_links.txt +0 -0
- {workpeg-0.2.1 → workpeg-0.3.0}/src/workpeg.egg-info/requires.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "workpeg"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.3.0"
|
|
8
8
|
description = "Workpeg function runtime and SDK"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -29,20 +29,20 @@ Homepage = "https://gitlab.com/workpeg/workpeg"
|
|
|
29
29
|
Repository = "https://gitlab.com/workpeg/workpeg"
|
|
30
30
|
|
|
31
31
|
[project.scripts]
|
|
32
|
-
workpeg = "
|
|
32
|
+
workpeg = "workpeg.cli:main"
|
|
33
33
|
|
|
34
34
|
[tool.setuptools]
|
|
35
35
|
package-dir = {"" = "src"}
|
|
36
36
|
|
|
37
37
|
[tool.setuptools.package-data]
|
|
38
|
-
|
|
38
|
+
workpeg = ["templates/**"]
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
[tool.setuptools.packages.find]
|
|
42
42
|
where = ["src"]
|
|
43
43
|
|
|
44
44
|
[tool.setuptools.exclude-package-data]
|
|
45
|
-
|
|
45
|
+
workpeg = [
|
|
46
46
|
"templates/**/__pycache__/**",
|
|
47
47
|
"templates/**/*.pyc",
|
|
48
48
|
"templates/**/*.pyo",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# src/
|
|
1
|
+
# src/workpeg/create_new.py
|
|
2
2
|
import argparse
|
|
3
3
|
import os
|
|
4
4
|
import shutil
|
|
@@ -36,14 +36,14 @@ def _copy_tree(src_root: Path, dst_root: Path, *, force: bool) -> None:
|
|
|
36
36
|
|
|
37
37
|
def create_new_project(target_dir: str, *, force: bool = False) -> Path:
|
|
38
38
|
"""
|
|
39
|
-
Copy the function template from
|
|
39
|
+
Copy the function template from workpeg/templates/functions/*
|
|
40
40
|
into target_dir.
|
|
41
41
|
"""
|
|
42
42
|
target = Path(target_dir).expanduser().resolve()
|
|
43
43
|
|
|
44
|
-
# Get a Traversable pointing at .../
|
|
44
|
+
# Get a Traversable pointing at .../workpeg/templates/functions
|
|
45
45
|
traversable = (
|
|
46
|
-
pkg_resources.files("
|
|
46
|
+
pkg_resources.files("workpeg") / "templates" / "functions"
|
|
47
47
|
)
|
|
48
48
|
|
|
49
49
|
# as_file() gives us a real filesystem path even if the package
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# src/
|
|
1
|
+
# src/workpeg/run.py
|
|
2
2
|
import subprocess
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
from
|
|
5
|
+
from workpeg.build import build_image
|
|
6
|
+
from workpeg.config import load_config
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
def resolve_runtime(with_runtime: str | None, config: dict) -> str:
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
src/workpeg/__init__.py
|
|
6
|
+
src/workpeg/build.py
|
|
7
|
+
src/workpeg/cli.py
|
|
8
|
+
src/workpeg/config.py
|
|
9
|
+
src/workpeg/create_new.py
|
|
10
|
+
src/workpeg/run.py
|
|
11
|
+
src/workpeg/runtime.py
|
|
12
|
+
src/workpeg/submit.py
|
|
13
|
+
src/workpeg.egg-info/PKG-INFO
|
|
14
|
+
src/workpeg.egg-info/SOURCES.txt
|
|
15
|
+
src/workpeg.egg-info/dependency_links.txt
|
|
16
|
+
src/workpeg.egg-info/entry_points.txt
|
|
17
|
+
src/workpeg.egg-info/requires.txt
|
|
18
|
+
src/workpeg.egg-info/top_level.txt
|
|
19
|
+
src/workpeg/templates/__init__.py
|
|
20
|
+
src/workpeg/templates/functions/Dockerfile
|
|
21
|
+
src/workpeg/templates/functions/LICENSE
|
|
22
|
+
src/workpeg/templates/functions/README.md
|
|
23
|
+
src/workpeg/templates/functions/requirements.txt
|
|
24
|
+
src/workpeg/templates/functions/app/__init__.py
|
|
25
|
+
src/workpeg/templates/functions/app/main.py
|
|
26
|
+
tests/test_build.py
|
|
27
|
+
tests/test_cli.py
|
|
28
|
+
tests/test_create_new.py
|
|
29
|
+
tests/test_run.py
|
|
30
|
+
tests/test_runtime.py
|
|
31
|
+
tests/test_submit.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
workpeg
|
|
@@ -18,7 +18,7 @@ def test_create_new_copies_template(tmp_path):
|
|
|
18
18
|
assert (project_dir / "app" / "__init__.py").exists()
|
|
19
19
|
assert (project_dir / "app" / "main.py").exists()
|
|
20
20
|
|
|
21
|
-
template_pkg = "
|
|
21
|
+
template_pkg = "workpeg.templates.functions.app"
|
|
22
22
|
template_main = pkg_resources.files(
|
|
23
23
|
template_pkg).joinpath("main.py").read_text()
|
|
24
24
|
|
|
@@ -6,7 +6,7 @@ from unittest.mock import MagicMock, patch
|
|
|
6
6
|
|
|
7
7
|
import pytest
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import workpeg.submit as submit
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
# ---------- helpers ----------
|
|
@@ -144,7 +144,7 @@ def test_build_tar_gz_bytes_bad_path(tmp_path: Path):
|
|
|
144
144
|
|
|
145
145
|
# ---------- unit tests: submit_bundle (requests.post mocked) ----------
|
|
146
146
|
|
|
147
|
-
@patch("
|
|
147
|
+
@patch("workpeg.submit.requests.post")
|
|
148
148
|
def test_submit_bundle_success_builds_request(mock_post):
|
|
149
149
|
mock_resp = MagicMock()
|
|
150
150
|
mock_resp.status_code = 201
|
|
@@ -177,7 +177,7 @@ def test_submit_bundle_success_builds_request(mock_post):
|
|
|
177
177
|
assert kwargs["timeout"] == 60
|
|
178
178
|
|
|
179
179
|
|
|
180
|
-
@patch("
|
|
180
|
+
@patch("workpeg.submit.requests.post")
|
|
181
181
|
def test_submit_bundle_http_error_json(mock_post):
|
|
182
182
|
mock_resp = MagicMock()
|
|
183
183
|
mock_resp.status_code = 409
|
|
@@ -196,7 +196,7 @@ def test_submit_bundle_http_error_json(mock_post):
|
|
|
196
196
|
assert e.value.code == 1
|
|
197
197
|
|
|
198
198
|
|
|
199
|
-
@patch("
|
|
199
|
+
@patch("workpeg.submit.requests.post")
|
|
200
200
|
def test_submit_bundle_http_error_non_json(mock_post):
|
|
201
201
|
mock_resp = MagicMock()
|
|
202
202
|
mock_resp.status_code = 500
|
|
@@ -239,7 +239,7 @@ def test_main_jwt_missing_peg_namespace(monkeypatch, capsys):
|
|
|
239
239
|
assert "JWT missing peg_namespace" in capsys.readouterr().err
|
|
240
240
|
|
|
241
241
|
|
|
242
|
-
@patch("
|
|
242
|
+
@patch("workpeg.submit.submit_bundle")
|
|
243
243
|
def test_main_happy_path_uses_default_api_base(
|
|
244
244
|
mock_submit_bundle, monkeypatch, tmp_path, capsys):
|
|
245
245
|
# minimal project
|
|
@@ -272,7 +272,7 @@ def test_main_happy_path_uses_default_api_base(
|
|
|
272
272
|
assert len(kwargs["bundle_bytes"]) > 0
|
|
273
273
|
|
|
274
274
|
|
|
275
|
-
@patch("
|
|
275
|
+
@patch("workpeg.submit.submit_bundle")
|
|
276
276
|
def test_main_overrides_api_base_from_env(
|
|
277
277
|
mock_submit_bundle, monkeypatch, tmp_path):
|
|
278
278
|
(tmp_path / "app").mkdir()
|
|
@@ -292,7 +292,7 @@ def test_main_overrides_api_base_from_env(
|
|
|
292
292
|
assert kwargs["peg_id"] == "peg-999"
|
|
293
293
|
|
|
294
294
|
|
|
295
|
-
@patch("
|
|
295
|
+
@patch("workpeg.submit.submit_bundle")
|
|
296
296
|
def test_main_overrides_api_base_from_flag(
|
|
297
297
|
mock_submit_bundle, monkeypatch, tmp_path):
|
|
298
298
|
(tmp_path / "app").mkdir()
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
LICENSE
|
|
2
|
-
MANIFEST.in
|
|
3
|
-
README.md
|
|
4
|
-
pyproject.toml
|
|
5
|
-
src/workpeg.egg-info/PKG-INFO
|
|
6
|
-
src/workpeg.egg-info/SOURCES.txt
|
|
7
|
-
src/workpeg.egg-info/dependency_links.txt
|
|
8
|
-
src/workpeg.egg-info/entry_points.txt
|
|
9
|
-
src/workpeg.egg-info/requires.txt
|
|
10
|
-
src/workpeg.egg-info/top_level.txt
|
|
11
|
-
src/workpeg_sdk/__init__.py
|
|
12
|
-
src/workpeg_sdk/build.py
|
|
13
|
-
src/workpeg_sdk/cli.py
|
|
14
|
-
src/workpeg_sdk/config.py
|
|
15
|
-
src/workpeg_sdk/create_new.py
|
|
16
|
-
src/workpeg_sdk/run.py
|
|
17
|
-
src/workpeg_sdk/runtime.py
|
|
18
|
-
src/workpeg_sdk/submit.py
|
|
19
|
-
src/workpeg_sdk/templates/__init__.py
|
|
20
|
-
src/workpeg_sdk/templates/functions/Dockerfile
|
|
21
|
-
src/workpeg_sdk/templates/functions/LICENSE
|
|
22
|
-
src/workpeg_sdk/templates/functions/README.md
|
|
23
|
-
src/workpeg_sdk/templates/functions/requirements.txt
|
|
24
|
-
src/workpeg_sdk/templates/functions/app/__init__.py
|
|
25
|
-
src/workpeg_sdk/templates/functions/app/main.py
|
|
26
|
-
tests/test_build.py
|
|
27
|
-
tests/test_cli.py
|
|
28
|
-
tests/test_create_new.py
|
|
29
|
-
tests/test_run.py
|
|
30
|
-
tests/test_runtime.py
|
|
31
|
-
tests/test_submit.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
workpeg_sdk
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{workpeg-0.2.1/src/workpeg_sdk → workpeg-0.3.0/src/workpeg}/templates/functions/app/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{workpeg-0.2.1/src/workpeg_sdk → workpeg-0.3.0/src/workpeg}/templates/functions/requirements.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|