polyapi-python 0.3.12.dev2__tar.gz → 0.3.13.dev2__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.12.dev2/polyapi_python.egg-info → polyapi_python-0.3.13.dev2}/PKG-INFO +1 -1
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/deployables.py +2 -1
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/parser.py +13 -3
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/utils.py +16 -2
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/webhook.py +1 -5
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2/polyapi_python.egg-info}/PKG-INFO +1 -1
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/pyproject.toml +4 -6
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/LICENSE +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/README.md +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/__init__.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/__main__.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/api.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/auth.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/cli.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/client.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/config.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/constants.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/error_handler.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/exceptions.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/execute.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/function_cli.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/generate.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/poly_schemas.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/poly_tables.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/prepare.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/py.typed +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/rendered_spec.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/schema.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/server.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/sync.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/typedefs.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi/variables.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi_python.egg-info/SOURCES.txt +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi_python.egg-info/dependency_links.txt +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi_python.egg-info/requires.txt +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi_python.egg-info/top_level.txt +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/setup.cfg +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/tests/test_api.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/tests/test_auth.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/tests/test_deployables.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/tests/test_generate.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/tests/test_parser.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/tests/test_rendered_spec.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/tests/test_schema.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/tests/test_server.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/tests/test_tabi.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/tests/test_utils.py +0 -0
- {polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/tests/test_variables.py +0 -0
|
@@ -6,6 +6,7 @@ import json
|
|
|
6
6
|
import hashlib
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
from typing import TypedDict, List, Dict, Tuple, Optional, Any, Union
|
|
9
|
+
from typing_extensions import Required
|
|
9
10
|
from subprocess import check_output, CalledProcessError
|
|
10
11
|
|
|
11
12
|
|
|
@@ -54,7 +55,7 @@ class DeployableRecord(ParsedDeployableConfig, total=False):
|
|
|
54
55
|
gitRevision: str
|
|
55
56
|
fileRevision: str
|
|
56
57
|
file: str
|
|
57
|
-
types: DeployableFunctionTypes
|
|
58
|
+
types: Required[DeployableFunctionTypes]
|
|
58
59
|
typeSchemas: Dict[str, Any]
|
|
59
60
|
dependencies: List[str]
|
|
60
61
|
deployments: List[Deployment]
|
|
@@ -3,7 +3,7 @@ import json
|
|
|
3
3
|
import types
|
|
4
4
|
import sys
|
|
5
5
|
import re
|
|
6
|
-
from typing import Dict, List, Mapping, Optional, Tuple, Any
|
|
6
|
+
from typing import Dict, List, Mapping, Optional, Tuple, Any, Union
|
|
7
7
|
from typing import _TypedDictMeta as BaseTypedDict # type: ignore
|
|
8
8
|
from typing_extensions import _TypedDictMeta, cast # type: ignore
|
|
9
9
|
from stdlib_list import stdlib_list
|
|
@@ -390,7 +390,7 @@ def parse_function_code(code: str, name: Optional[str] = "", context: Optional[s
|
|
|
390
390
|
deployable["config"] = _parse_dict(node.value)
|
|
391
391
|
self._name = deployable["config"]["name"]
|
|
392
392
|
|
|
393
|
-
def _extract_docstring_from_function(self, node: ast.FunctionDef):
|
|
393
|
+
def _extract_docstring_from_function(self, node: Union[ast.FunctionDef, ast.AsyncFunctionDef]):
|
|
394
394
|
start_lineno = (node.body[0].lineno if node.body else node.lineno) - 1
|
|
395
395
|
start_offset = self._line_offsets[start_lineno]
|
|
396
396
|
end_offset = start_offset
|
|
@@ -452,15 +452,19 @@ def parse_function_code(code: str, name: Optional[str] = "", context: Optional[s
|
|
|
452
452
|
for name in node.names:
|
|
453
453
|
req = _get_req_name_if_not_in_base(name.name, pip_name_lookup)
|
|
454
454
|
if req:
|
|
455
|
+
if "dependencies" not in deployable or deployable["dependencies"] is None:
|
|
456
|
+
deployable["dependencies"] = []
|
|
455
457
|
deployable["dependencies"].append(req)
|
|
456
458
|
|
|
457
459
|
def visit_ImportFrom(self, node: ast.ImportFrom):
|
|
458
460
|
if node.module:
|
|
459
461
|
req = _get_req_name_if_not_in_base(node.module, pip_name_lookup)
|
|
460
462
|
if req:
|
|
463
|
+
if "dependencies" not in deployable or deployable["dependencies"] is None:
|
|
464
|
+
deployable["dependencies"] = []
|
|
461
465
|
deployable["dependencies"].append(req)
|
|
462
466
|
|
|
463
|
-
def
|
|
467
|
+
def _handle_function_def(self, node: Union[ast.FunctionDef, ast.AsyncFunctionDef]):
|
|
464
468
|
if node.name == self._name:
|
|
465
469
|
# Parse docstring which may contain param types and descriptions
|
|
466
470
|
self._extract_docstring_from_function(node)
|
|
@@ -506,6 +510,12 @@ def parse_function_code(code: str, name: Optional[str] = "", context: Optional[s
|
|
|
506
510
|
else:
|
|
507
511
|
deployable["types"]["returns"]["type"] = "Any"
|
|
508
512
|
|
|
513
|
+
def visit_FunctionDef(self, node: ast.FunctionDef):
|
|
514
|
+
self._handle_function_def(node)
|
|
515
|
+
|
|
516
|
+
def visit_AsyncFunctionDef(self, node: ast.AsyncFunctionDef):
|
|
517
|
+
self._handle_function_def(node)
|
|
518
|
+
|
|
509
519
|
def generic_visit(self, node):
|
|
510
520
|
if hasattr(node, 'lineno') and hasattr(node, 'col_offset'):
|
|
511
521
|
self._current_offset = self._line_offsets[node.lineno - 1] + node.col_offset
|
|
@@ -73,9 +73,23 @@ def print_red(s: str):
|
|
|
73
73
|
|
|
74
74
|
def add_type_import_path(function_name: str, arg: str) -> str:
|
|
75
75
|
"""if not basic type, coerce to camelCase and add the import path"""
|
|
76
|
-
# for now, just treat Callables as basic types
|
|
76
|
+
# outdated og comment - for now, just treat Callables as basic types
|
|
77
|
+
# from now, we start qualifying non-basic types :))
|
|
78
|
+
# e.g. Callable[[EmailAddress, Dict, Dict, Dict], None]
|
|
79
|
+
# becomes Callable[[Set_profile_email.EmailAddress, Dict, Dict, Dict], None]
|
|
80
|
+
|
|
77
81
|
if arg.startswith("Callable"):
|
|
78
|
-
|
|
82
|
+
inner = arg[len("Callable["):-1] # strip outer Callable[...]
|
|
83
|
+
parts = [p.strip() for p in inner.split(",")]
|
|
84
|
+
qualified = []
|
|
85
|
+
for p in parts:
|
|
86
|
+
clean = p.strip("[] ")
|
|
87
|
+
if clean and clean not in BASIC_PYTHON_TYPES:
|
|
88
|
+
replacement = f"{to_func_namespace(function_name)}.{camelCase(clean)}"
|
|
89
|
+
p = p.replace(clean, replacement)
|
|
90
|
+
qualified.append(p)
|
|
91
|
+
return "Callable[" + ",".join(qualified) + "]"
|
|
92
|
+
# return arg
|
|
79
93
|
|
|
80
94
|
if arg in BASIC_PYTHON_TYPES:
|
|
81
95
|
return arg
|
|
@@ -124,11 +124,7 @@ def render_webhook_handle(
|
|
|
124
124
|
) -> Tuple[str, str]:
|
|
125
125
|
try:
|
|
126
126
|
function_args, function_args_def = parse_arguments(function_name, arguments)
|
|
127
|
-
|
|
128
|
-
if "WebhookEventType" in function_args:
|
|
129
|
-
# let's add the function name import!
|
|
130
|
-
function_args = function_args.replace("WebhookEventType", f"{to_func_namespace(function_name)}.WebhookEventType")
|
|
131
|
-
|
|
127
|
+
|
|
132
128
|
func_str = WEBHOOK_TEMPLATE.format(
|
|
133
129
|
description=function_description,
|
|
134
130
|
function_id=function_id,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
[build-system]
|
|
2
2
|
requires = ["setuptools>=61.2", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
3
4
|
|
|
4
5
|
[project]
|
|
5
6
|
name = "polyapi-python"
|
|
6
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.13.dev2" # bump
|
|
7
8
|
description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers"
|
|
8
9
|
authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }]
|
|
9
10
|
dependencies = [
|
|
@@ -23,14 +24,11 @@ requires-python = ">=3.10"
|
|
|
23
24
|
[project.urls]
|
|
24
25
|
Homepage = "https://github.com/polyapi/polyapi-python"
|
|
25
26
|
|
|
26
|
-
[tool.setuptools]
|
|
27
|
-
packages = ["polyapi"]
|
|
28
|
-
|
|
29
|
-
[tools.setuptools.packages.find]
|
|
27
|
+
[tool.setuptools.packages.find]
|
|
30
28
|
include = ["polyapi"]
|
|
31
29
|
exclude = ["polyapi/poly*", "polyapi/vari*", "polyapi/.config.env", "polyapi/cached_deployables*", "polyapi/deployments_revision"] # exclude the generated libraries from builds
|
|
32
30
|
|
|
33
31
|
[tool.mypy]
|
|
34
32
|
# for now redef errors happen sometimes, we will clean this up in the future!
|
|
35
33
|
disable_error_code = "no-redef,name-defined"
|
|
36
|
-
implicit_optional = true
|
|
34
|
+
implicit_optional = true
|
|
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.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi_python.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/polyapi_python.egg-info/requires.txt
RENAMED
|
File without changes
|
{polyapi_python-0.3.12.dev2 → polyapi_python-0.3.13.dev2}/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
|
|
File without changes
|
|
File without changes
|