polyapi-python 0.3.8.dev4__py3-none-any.whl → 0.3.8.dev6__py3-none-any.whl
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/client.py +4 -4
- polyapi/deployables.py +5 -7
- polyapi/prepare.py +5 -7
- {polyapi_python-0.3.8.dev4.dist-info → polyapi_python-0.3.8.dev6.dist-info}/METADATA +1 -1
- {polyapi_python-0.3.8.dev4.dist-info → polyapi_python-0.3.8.dev6.dist-info}/RECORD +8 -8
- {polyapi_python-0.3.8.dev4.dist-info → polyapi_python-0.3.8.dev6.dist-info}/WHEEL +0 -0
- {polyapi_python-0.3.8.dev4.dist-info → polyapi_python-0.3.8.dev6.dist-info}/licenses/LICENSE +0 -0
- {polyapi_python-0.3.8.dev4.dist-info → polyapi_python-0.3.8.dev6.dist-info}/top_level.txt +0 -0
polyapi/client.py
CHANGED
|
@@ -10,7 +10,7 @@ from typing import List, Dict, Any, TypedDict
|
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
def _wrap_code_in_try_except(code: str) -> str:
|
|
13
|
+
def _wrap_code_in_try_except(function_name: str, code: str) -> str:
|
|
14
14
|
""" this is necessary because client functions with imports will blow up ALL server functions,
|
|
15
15
|
even if they don't use them.
|
|
16
16
|
because the server function will try to load all client functions when loading the library
|
|
@@ -18,8 +18,8 @@ def _wrap_code_in_try_except(code: str) -> str:
|
|
|
18
18
|
prefix = """logger = logging.getLogger("poly")
|
|
19
19
|
try:
|
|
20
20
|
"""
|
|
21
|
-
suffix = """except ImportError as e:
|
|
22
|
-
logger.
|
|
21
|
+
suffix = f"""except ImportError as e:
|
|
22
|
+
logger.warning("Failed to import client function '{function_name}', function unavailable: " + str(e))"""
|
|
23
23
|
|
|
24
24
|
lines = code.split("\n")
|
|
25
25
|
code = "\n ".join(lines)
|
|
@@ -39,6 +39,6 @@ def render_client_function(
|
|
|
39
39
|
return_type_def=return_type_def,
|
|
40
40
|
)
|
|
41
41
|
|
|
42
|
-
code = _wrap_code_in_try_except(code)
|
|
42
|
+
code = _wrap_code_in_try_except(function_name, code)
|
|
43
43
|
|
|
44
44
|
return code + "\n\n", func_type_defs
|
polyapi/deployables.py
CHANGED
|
@@ -114,18 +114,16 @@ def get_all_deployable_files_windows(config: PolyDeployConfig) -> List[str]:
|
|
|
114
114
|
# Constructing the Windows command using dir and findstr
|
|
115
115
|
include_pattern = " ".join(f"*.{f}" for f in config["include_files_or_extensions"]) or "*"
|
|
116
116
|
exclude_pattern = ' '.join(f"\\{f}" for f in config["exclude_dirs"])
|
|
117
|
-
pattern = ' '.join(f"
|
|
117
|
+
pattern = ' '.join(f"/C:\"polyConfig: {name}\"" for name in config["type_names"]) or '/C:"polyConfig"'
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
exclude_command = f" | findstr /V /I \"{exclude_pattern}" if exclude_pattern else ''
|
|
122
|
-
search_command = f" | findstr /M /I /F:/ {pattern}"
|
|
119
|
+
exclude_command = f" | findstr /V /I \"{exclude_pattern}\"" if exclude_pattern else ''
|
|
120
|
+
search_command = f" | findstr /S /M /I /F:/ {pattern} *.*"
|
|
123
121
|
|
|
124
122
|
result = []
|
|
125
123
|
for dir_path in config["include_dirs"]:
|
|
126
|
-
if dir_path
|
|
124
|
+
if dir_path != '.':
|
|
127
125
|
include_pattern = " ".join(f"{dir_path}*.{f}" for f in config["include_files_or_extensions"]) or "*"
|
|
128
|
-
dir_command = f"dir {include_pattern} /S /P /B"
|
|
126
|
+
dir_command = f"dir {include_pattern} /S /P /B > NUL"
|
|
129
127
|
full_command = f"{dir_command}{exclude_command}{search_command}"
|
|
130
128
|
try:
|
|
131
129
|
output = subprocess.check_output(full_command, shell=True, text=True)
|
polyapi/prepare.py
CHANGED
|
@@ -32,7 +32,7 @@ def get_server_function_description(description: str, arguments, code: str) -> s
|
|
|
32
32
|
api_key, api_url = get_api_key_and_url()
|
|
33
33
|
headers = get_auth_headers(api_key)
|
|
34
34
|
data = {"description": description, "arguments": arguments, "code": code}
|
|
35
|
-
response = requests.post(f"{api_url}/server-
|
|
35
|
+
response = requests.post(f"{api_url}/functions/server/description-generation", headers=headers, json=data)
|
|
36
36
|
return response.json()
|
|
37
37
|
|
|
38
38
|
def get_client_function_description(description: str, arguments, code: str) -> str:
|
|
@@ -40,7 +40,7 @@ def get_client_function_description(description: str, arguments, code: str) -> s
|
|
|
40
40
|
headers = get_auth_headers(api_key)
|
|
41
41
|
# Simulated API call to generate client function descriptions
|
|
42
42
|
data = {"description": description, "arguments": arguments, "code": code}
|
|
43
|
-
response = requests.post(f"{api_url}/client-
|
|
43
|
+
response = requests.post(f"{api_url}/functions/client/description-generation", headers=headers, json=data)
|
|
44
44
|
return response.json()
|
|
45
45
|
|
|
46
46
|
def fill_in_missing_function_details(deployable: DeployableRecord, code: str) -> DeployableRecord:
|
|
@@ -138,13 +138,11 @@ def prepare_deployables(lazy: bool = False, disable_docs: bool = False, disable_
|
|
|
138
138
|
write_updated_deployable(deployable, disable_docs)
|
|
139
139
|
# Re-stage any updated staged files.
|
|
140
140
|
staged = subprocess.check_output('git diff --name-only --cached', shell=True, text=True, ).split('\n')
|
|
141
|
-
rootPath = subprocess.check_output('git rev-parse --show-toplevel', shell=True, text=True).replace('\n', '')
|
|
142
141
|
for deployable in dirty_deployables:
|
|
143
142
|
try:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
subprocess.run(['git', 'add', deployableName])
|
|
143
|
+
if deployable["file"] in staged:
|
|
144
|
+
print(f'Staging {deployable["file"]}')
|
|
145
|
+
subprocess.run(['git', 'add', deployable["file"]])
|
|
148
146
|
except:
|
|
149
147
|
print('Warning: File staging failed, check that all files are staged properly.')
|
|
150
148
|
|
|
@@ -3,10 +3,10 @@ polyapi/__main__.py,sha256=V4zhAh_YGxno5f_KSrlkELxcuDh9bR3WSd0n-2r-qQQ,93
|
|
|
3
3
|
polyapi/api.py,sha256=2nds6ZdNe9OHvCba4IjOPga0CAYIsib2SbhEyDDCmd8,2188
|
|
4
4
|
polyapi/auth.py,sha256=zrIGatjba5GwUTNjKj1GHQWTEDP9B-HrSzCKbLFoqvc,5336
|
|
5
5
|
polyapi/cli.py,sha256=NcLXOUdkcXgsFboO5PXwncK4uzGLu1mIXJDUn5NUgKo,10192
|
|
6
|
-
polyapi/client.py,sha256=
|
|
6
|
+
polyapi/client.py,sha256=DW6ljG_xCwAo2yz23A9QfLooE6ZUDvSpdA4e_dCQjiQ,1418
|
|
7
7
|
polyapi/config.py,sha256=cAMv2n9tGN_BTvqt7V32o5F86qRhxAKyey_PoId2D8s,7638
|
|
8
8
|
polyapi/constants.py,sha256=sc-FnS0SngBLvSu1ZWMs0UCf9EYD1u1Yhfr-sZXGLns,607
|
|
9
|
-
polyapi/deployables.py,sha256=
|
|
9
|
+
polyapi/deployables.py,sha256=Gythjrt6iJel2RnE_rioDYt4g5x9uSB2-cx5WIi9L7Y,12082
|
|
10
10
|
polyapi/error_handler.py,sha256=I_e0iz6VM23FLVQWJljxs2NGcl_OODbi43OcbnqBlp8,2398
|
|
11
11
|
polyapi/exceptions.py,sha256=Zh7i7eCUhDuXEdUYjatkLFTeZkrx1BJ1P5ePgbJ9eIY,89
|
|
12
12
|
polyapi/execute.py,sha256=sjI6BMBYPSCD6UngV9DzpJIRSU6p02aShNaTXhDExtY,3457
|
|
@@ -14,7 +14,7 @@ polyapi/function_cli.py,sha256=H0sVrbvRBXw_xeApe2MvQw8p_xE7jVTTOU-07Dg041A,4220
|
|
|
14
14
|
polyapi/generate.py,sha256=rzRb9TW5VjdqT13beIezQratdfAvE7yYWX_ODlZJTK0,16105
|
|
15
15
|
polyapi/parser.py,sha256=mdoh4pNq8pyiHE0-i6Coqj8frEXfBLRk6itpAXMrrgI,20373
|
|
16
16
|
polyapi/poly_schemas.py,sha256=T4kfZyfgVLiqLD28GmYNiHnrNx77J_HO4uzk8LUAhlo,3137
|
|
17
|
-
polyapi/prepare.py,sha256=
|
|
17
|
+
polyapi/prepare.py,sha256=pRWBhpgqMtKP04P9F6PIA3eCkOpCxQSv9TZdR3qR34I,7216
|
|
18
18
|
polyapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
19
|
polyapi/rendered_spec.py,sha256=nJEj2vRgG3N20fU4s-ThRtOIwAuTzXwXuOBIkXljDVc,2240
|
|
20
20
|
polyapi/schema.py,sha256=Czh94VsbVCOT44Eym3fzO5p-g3icjPHpebE40-JOPuY,4709
|
|
@@ -24,8 +24,8 @@ polyapi/typedefs.py,sha256=MGDwWaijLNqokXF9UCHGAP-yKixOzztrH4Lsj800AJs,2328
|
|
|
24
24
|
polyapi/utils.py,sha256=1F7Dwst_PbPuUBUSxx5r8d2DHDgqHtu07QW92T_YSdw,12454
|
|
25
25
|
polyapi/variables.py,sha256=j7WWrGLr2O5SkWGxnsusnnfl25kVL3b6SQYcVGEoC8c,4277
|
|
26
26
|
polyapi/webhook.py,sha256=NTSXYOl_QqsFekWRepPyVTsV9SVkgUu0HfG1SJJDHOE,4958
|
|
27
|
-
polyapi_python-0.3.8.
|
|
28
|
-
polyapi_python-0.3.8.
|
|
29
|
-
polyapi_python-0.3.8.
|
|
30
|
-
polyapi_python-0.3.8.
|
|
31
|
-
polyapi_python-0.3.8.
|
|
27
|
+
polyapi_python-0.3.8.dev6.dist-info/licenses/LICENSE,sha256=6b_I7aPVp8JXhqQwdw7_B84Ca0S4JGjHj0sr_1VOdB4,1068
|
|
28
|
+
polyapi_python-0.3.8.dev6.dist-info/METADATA,sha256=03eEZOFFs246r2OYMqHuU8OLCqE5CGEhRW6fkn7JCCg,5782
|
|
29
|
+
polyapi_python-0.3.8.dev6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
30
|
+
polyapi_python-0.3.8.dev6.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
|
|
31
|
+
polyapi_python-0.3.8.dev6.dist-info/RECORD,,
|
|
File without changes
|
{polyapi_python-0.3.8.dev4.dist-info → polyapi_python-0.3.8.dev6.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|