polyapi-python 0.2.3.dev3__tar.gz → 0.2.3.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.
Files changed (35) hide show
  1. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/PKG-INFO +2 -2
  2. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/function_cli.py +23 -7
  3. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi_python.egg-info/PKG-INFO +2 -2
  4. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi_python.egg-info/requires.txt +1 -1
  5. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/pyproject.toml +2 -2
  6. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/LICENSE +0 -0
  7. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/README.md +0 -0
  8. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/__init__.py +0 -0
  9. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/__main__.py +0 -0
  10. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/api.py +0 -0
  11. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/auth.py +0 -0
  12. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/cli.py +0 -0
  13. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/config.py +0 -0
  14. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/constants.py +0 -0
  15. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/error_handler.py +0 -0
  16. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/exceptions.py +0 -0
  17. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/execute.py +0 -0
  18. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/generate.py +0 -0
  19. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/py.typed +0 -0
  20. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/schema.py +0 -0
  21. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/server.py +0 -0
  22. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/typedefs.py +0 -0
  23. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/utils.py +0 -0
  24. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/variables.py +0 -0
  25. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi/webhook.py +0 -0
  26. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi_python.egg-info/SOURCES.txt +0 -0
  27. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi_python.egg-info/dependency_links.txt +0 -0
  28. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/polyapi_python.egg-info/top_level.txt +0 -0
  29. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/setup.cfg +0 -0
  30. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/tests/test_api.py +0 -0
  31. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/tests/test_auth.py +0 -0
  32. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/tests/test_function_cli.py +0 -0
  33. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/tests/test_server.py +0 -0
  34. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/tests/test_utils.py +0 -0
  35. {polyapi-python-0.2.3.dev3 → polyapi-python-0.2.3.dev5}/tests/test_variables.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: polyapi-python
3
- Version: 0.2.3.dev3
3
+ Version: 0.2.3.dev5
4
4
  Summary: The PolyAPI Python Client
5
5
  Author-email: Dan Fellin <dan@polyapi.io>
6
6
  License: MIT License
@@ -31,7 +31,7 @@ License-File: LICENSE
31
31
  Requires-Dist: requests==2.31.0
32
32
  Requires-Dist: typing_extensions==4.10.0
33
33
  Requires-Dist: jsonschema-gentypes==2.4.0
34
- Requires-Dist: pydantic==2.5.3
34
+ Requires-Dist: pydantic==2.6.4
35
35
  Requires-Dist: stdlib_list==0.10.0
36
36
  Requires-Dist: colorama==0.4.4
37
37
  Requires-Dist: python-socketio[asyncio_client]==5.11.1
@@ -3,7 +3,7 @@ import argparse
3
3
  import json
4
4
  import types
5
5
  import sys
6
- from typing import Dict, List, Tuple
6
+ from typing import Dict, List, Mapping, Optional, Tuple
7
7
  from typing_extensions import _TypedDictMeta # type: ignore
8
8
  import requests
9
9
  from stdlib_list import stdlib_list
@@ -18,7 +18,7 @@ import importlib
18
18
 
19
19
  # these libraries are already installed in the base docker image
20
20
  # and shouldnt be included in additional requirements
21
- BASE_REQUIREMENTS = {"polyapi", "requests", "typing_extensions", "jsonschema-gentypes", "pydantic"}
21
+ BASE_REQUIREMENTS = {"polyapi", "requests", "typing_extensions", "jsonschema-gentypes", "pydantic", "cloudevents"}
22
22
  all_stdlib_symbols = stdlib_list('.'.join([str(v) for v in sys.version_info[0:2]]))
23
23
  BASE_REQUIREMENTS.update(all_stdlib_symbols) # dont need to pip install stuff in the python standard library
24
24
 
@@ -104,6 +104,19 @@ def _get_type(expr: ast.expr | None, schemas: List[Dict]) -> Tuple[str, Dict | N
104
104
  return json_type, _get_type_schema(json_type, python_type, schemas)
105
105
 
106
106
 
107
+ def _get_req_name_if_not_in_base(n: Optional[str], pip_name_lookup: Mapping[str, List[str]]) -> Optional[str]:
108
+ if not n:
109
+ return None
110
+
111
+ if "." in n:
112
+ n = n.split(".")[0]
113
+
114
+ if n in BASE_REQUIREMENTS:
115
+ return None
116
+ else:
117
+ return pip_name_lookup[n][0]
118
+
119
+
107
120
  def _parse_code(code: str, function_name: str):
108
121
  parsed_args = []
109
122
  return_type = None
@@ -121,13 +134,16 @@ def _parse_code(code: str, function_name: str):
121
134
 
122
135
  for node in ast.iter_child_nodes(parsed_code):
123
136
  if isinstance(node, ast.Import):
137
+ # TODO maybe handle `import foo.bar` case?
124
138
  for name in node.names:
125
- if name.name not in BASE_REQUIREMENTS:
126
- requirements.append(name.name)
139
+ req = _get_req_name_if_not_in_base(name.name, pip_name_lookup)
140
+ if req:
141
+ requirements.append(req)
127
142
  elif isinstance(node, ast.ImportFrom):
128
- if node.module and node.module not in BASE_REQUIREMENTS:
129
- req = pip_name_lookup[node.module][0]
130
- requirements.append(req)
143
+ if node.module:
144
+ req = _get_req_name_if_not_in_base(node.module, pip_name_lookup)
145
+ if req:
146
+ requirements.append(req)
131
147
 
132
148
  elif isinstance(node, ast.FunctionDef) and node.name == function_name:
133
149
  function_args = [arg for arg in node.args.args]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: polyapi-python
3
- Version: 0.2.3.dev3
3
+ Version: 0.2.3.dev5
4
4
  Summary: The PolyAPI Python Client
5
5
  Author-email: Dan Fellin <dan@polyapi.io>
6
6
  License: MIT License
@@ -31,7 +31,7 @@ License-File: LICENSE
31
31
  Requires-Dist: requests==2.31.0
32
32
  Requires-Dist: typing_extensions==4.10.0
33
33
  Requires-Dist: jsonschema-gentypes==2.4.0
34
- Requires-Dist: pydantic==2.5.3
34
+ Requires-Dist: pydantic==2.6.4
35
35
  Requires-Dist: stdlib_list==0.10.0
36
36
  Requires-Dist: colorama==0.4.4
37
37
  Requires-Dist: python-socketio[asyncio_client]==5.11.1
@@ -1,7 +1,7 @@
1
1
  requests==2.31.0
2
2
  typing_extensions==4.10.0
3
3
  jsonschema-gentypes==2.4.0
4
- pydantic==2.5.3
4
+ pydantic==2.6.4
5
5
  stdlib_list==0.10.0
6
6
  colorama==0.4.4
7
7
  python-socketio[asyncio_client]==5.11.1
@@ -3,14 +3,14 @@ requires = ["setuptools>=61.2", "wheel"]
3
3
 
4
4
  [project]
5
5
  name = "polyapi-python"
6
- version = "0.2.3.dev3"
6
+ version = "0.2.3.dev5"
7
7
  description = "The PolyAPI Python Client"
8
8
  authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }]
9
9
  dependencies = [
10
10
  "requests==2.31.0",
11
11
  "typing_extensions==4.10.0",
12
12
  "jsonschema-gentypes==2.4.0",
13
- "pydantic==2.5.3",
13
+ "pydantic==2.6.4",
14
14
  "stdlib_list==0.10.0",
15
15
  "colorama==0.4.4",
16
16
  "python-socketio[asyncio_client]==5.11.1",