polyapi-python 0.3.1.dev4__tar.gz → 0.3.1.dev5__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.
- {polyapi_python-0.3.1.dev4/polyapi_python.egg-info → polyapi_python-0.3.1.dev5}/PKG-INFO +1 -1
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/deployables.py +2 -1
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/sync.py +27 -10
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5/polyapi_python.egg-info}/PKG-INFO +1 -1
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/pyproject.toml +1 -1
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/LICENSE +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/README.md +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/__init__.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/__main__.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/api.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/auth.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/cli.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/client.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/config.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/constants.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/error_handler.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/exceptions.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/execute.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/function_cli.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/generate.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/parser.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/prepare.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/py.typed +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/rendered_spec.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/schema.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/server.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/typedefs.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/utils.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/variables.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi/webhook.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi_python.egg-info/SOURCES.txt +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi_python.egg-info/dependency_links.txt +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi_python.egg-info/requires.txt +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi_python.egg-info/top_level.txt +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/setup.cfg +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/tests/test_api.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/tests/test_auth.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/tests/test_deployables.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/tests/test_parser.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/tests/test_rendered_spec.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/tests/test_schema.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/tests/test_server.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/tests/test_utils.py +0 -0
- {polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/tests/test_variables.py +0 -0
|
@@ -64,9 +64,10 @@ class SyncDeployment(TypedDict, total=False):
|
|
|
64
64
|
context: str
|
|
65
65
|
name: str
|
|
66
66
|
description: str
|
|
67
|
-
type: str
|
|
67
|
+
type: str
|
|
68
68
|
fileRevision: str
|
|
69
69
|
file: str
|
|
70
|
+
types: DeployableFunctionTypes
|
|
70
71
|
typeSchemas: Dict[str, any]
|
|
71
72
|
dependencies: List[str]
|
|
72
73
|
config: Dict[str, any]
|
|
@@ -3,6 +3,7 @@ from datetime import datetime
|
|
|
3
3
|
from typing import List, Dict
|
|
4
4
|
import requests
|
|
5
5
|
|
|
6
|
+
from polyapi.parser import get_jsonschema_type
|
|
6
7
|
from polyapi.deployables import (
|
|
7
8
|
prepare_deployable_directory, load_deployable_records,
|
|
8
9
|
save_deployable_records, remove_deployable_records,
|
|
@@ -25,31 +26,43 @@ def group_by(items: List[Dict], key: str) -> Dict[str, List[Dict]]:
|
|
|
25
26
|
grouped.setdefault(item[key], []).append(item)
|
|
26
27
|
return grouped
|
|
27
28
|
|
|
28
|
-
def
|
|
29
|
-
|
|
30
|
-
url = f"{deployable['instance']}/{deployable['type']}/{deployable['name']}"
|
|
29
|
+
def remove_deployable_function(deployable: SyncDeployment) -> bool:
|
|
30
|
+
url = f"{deployable['instance']}/functions/{deployable["type"].replace("-function", "")}/{deployable['id']}"
|
|
31
31
|
response = requests.get(url)
|
|
32
32
|
if response.status_code != 200:
|
|
33
33
|
return False
|
|
34
34
|
requests.delete(url)
|
|
35
35
|
return True
|
|
36
36
|
|
|
37
|
-
def
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
def remove_deployable(deployable: SyncDeployment) -> bool:
|
|
38
|
+
|
|
39
|
+
if deployable["type"] == 'client-function' or deployable["type"] == 'server-function':
|
|
40
|
+
return remove_deployable_function(deployable)
|
|
41
|
+
|
|
42
|
+
raise Exception(f"Unsupported deployable type '{deployable["type"]}'")
|
|
43
|
+
|
|
44
|
+
def sync_function_and_get_id(deployable: SyncDeployment, code: str) -> str:
|
|
45
|
+
url = f"{deployable['instance']}/functions/{deployable["type"].replace("-function", "")}"
|
|
41
46
|
payload = {
|
|
42
47
|
"context": deployable["context"],
|
|
43
48
|
"name": deployable["name"],
|
|
44
49
|
"description": deployable["description"],
|
|
45
50
|
"code": code,
|
|
46
51
|
"typeSchemas": deployable["typeSchemas"],
|
|
47
|
-
|
|
52
|
+
**deployable["config"],
|
|
53
|
+
"arguments": [{**p, "type": get_jsonschema_type(p["type"]) } for p in deployable["types"]["params"]],
|
|
48
54
|
}
|
|
49
55
|
response = requests.post(url, json=payload)
|
|
50
56
|
response.raise_for_status()
|
|
51
57
|
return response.json()['id']
|
|
52
58
|
|
|
59
|
+
def sync_deployable_and_get_id(deployable: SyncDeployment, code: str) -> str:
|
|
60
|
+
|
|
61
|
+
if deployable["type"] == 'client-function' or deployable["type"] == 'server-function':
|
|
62
|
+
return sync_function_and_get_id(deployable, code)
|
|
63
|
+
|
|
64
|
+
raise Exception(f"Unsupported deployable type '{deployable["type"]}'")
|
|
65
|
+
|
|
53
66
|
def sync_deployable(deployable: SyncDeployment) -> Deployment:
|
|
54
67
|
code = read_file(deployable['file'])
|
|
55
68
|
id = sync_deployable_and_get_id(deployable, code)
|
|
@@ -93,12 +106,16 @@ def sync_deployables(dry_run: bool, instance: str = os.getenv('POLY_API_BASE_URL
|
|
|
93
106
|
# Any deployable may be deployed to multiple instances/environments at the same time
|
|
94
107
|
# So we reduce the deployable record down to a single instance we want to deploy to
|
|
95
108
|
if previous_deployment:
|
|
96
|
-
sync_deployment = {
|
|
109
|
+
sync_deployment = {
|
|
110
|
+
**deployable,
|
|
111
|
+
**previous_deployment,
|
|
112
|
+
"description": deployable["types"]["description"],
|
|
113
|
+
"instance": instance
|
|
114
|
+
}
|
|
97
115
|
else:
|
|
98
116
|
sync_deployment = { **deployable, "instance": instance }
|
|
99
117
|
if git_revision == deployable['gitRevision']:
|
|
100
118
|
deployment = sync_deployable(sync_deployment)
|
|
101
|
-
print(deployment)
|
|
102
119
|
if previous_deployment:
|
|
103
120
|
previous_deployment.update(deployment)
|
|
104
121
|
else:
|
|
@@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"]
|
|
|
3
3
|
|
|
4
4
|
[project]
|
|
5
5
|
name = "polyapi-python"
|
|
6
|
-
version = "0.3.1.
|
|
6
|
+
version = "0.3.1.dev5"
|
|
7
7
|
description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers"
|
|
8
8
|
authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }]
|
|
9
9
|
dependencies = [
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi_python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi_python.egg-info/requires.txt
RENAMED
|
File without changes
|
{polyapi_python-0.3.1.dev4 → polyapi_python-0.3.1.dev5}/polyapi_python.egg-info/top_level.txt
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|