polyapi-python 0.3.8.dev5__tar.gz → 0.3.8.dev7__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 (46) hide show
  1. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/PKG-INFO +1 -1
  2. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/cli.py +15 -0
  3. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/deployables.py +5 -7
  4. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/prepare.py +5 -7
  5. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi_python.egg-info/PKG-INFO +1 -1
  6. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/pyproject.toml +1 -1
  7. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/tests/test_deployables.py +3 -3
  8. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/LICENSE +0 -0
  9. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/README.md +0 -0
  10. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/__init__.py +0 -0
  11. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/__main__.py +0 -0
  12. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/api.py +0 -0
  13. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/auth.py +0 -0
  14. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/client.py +0 -0
  15. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/config.py +0 -0
  16. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/constants.py +0 -0
  17. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/error_handler.py +0 -0
  18. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/exceptions.py +0 -0
  19. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/execute.py +0 -0
  20. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/function_cli.py +0 -0
  21. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/generate.py +0 -0
  22. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/parser.py +0 -0
  23. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/poly_schemas.py +0 -0
  24. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/py.typed +0 -0
  25. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/rendered_spec.py +0 -0
  26. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/schema.py +0 -0
  27. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/server.py +0 -0
  28. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/sync.py +0 -0
  29. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/typedefs.py +0 -0
  30. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/utils.py +0 -0
  31. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/variables.py +0 -0
  32. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi/webhook.py +0 -0
  33. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi_python.egg-info/SOURCES.txt +0 -0
  34. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi_python.egg-info/dependency_links.txt +0 -0
  35. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi_python.egg-info/requires.txt +0 -0
  36. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/polyapi_python.egg-info/top_level.txt +0 -0
  37. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/setup.cfg +0 -0
  38. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/tests/test_api.py +0 -0
  39. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/tests/test_auth.py +0 -0
  40. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/tests/test_generate.py +0 -0
  41. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/tests/test_parser.py +0 -0
  42. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/tests/test_rendered_spec.py +0 -0
  43. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/tests/test_schema.py +0 -0
  44. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/tests/test_server.py +0 -0
  45. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/tests/test_utils.py +0 -0
  46. {polyapi_python-0.3.8.dev5 → polyapi_python-0.3.8.dev7}/tests/test_variables.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polyapi-python
3
- Version: 0.3.8.dev5
3
+ Version: 0.3.8.dev7
4
4
  Summary: The Python Client for PolyAPI, the IPaaS by Developers for Developers
5
5
  Author-email: Dan Fellin <dan@polyapi.io>
6
6
  License: MIT License
@@ -14,6 +14,16 @@ from .sync import sync_deployables
14
14
  CLI_COMMANDS = ["setup", "generate", "function", "clear", "help", "update_rendered_spec"]
15
15
 
16
16
 
17
+ def _get_version_string():
18
+ """Get the version string for the package."""
19
+ try:
20
+ import importlib.metadata
21
+ version = importlib.metadata.version('polyapi-python')
22
+ return version
23
+ except Exception:
24
+ return "Unknown"
25
+
26
+
17
27
  def execute_from_cli():
18
28
  # First we setup all our argument parsing logic
19
29
  # Then we parse the arguments (waaay at the bottom)
@@ -22,6 +32,11 @@ def execute_from_cli():
22
32
  description="Manage your Poly API configurations and functions",
23
33
  formatter_class=argparse.RawTextHelpFormatter
24
34
  )
35
+
36
+ # Add global --version/-v flag
37
+ parser.add_argument('-v', '--version', action='version',
38
+ version=_get_version_string(),
39
+ help="Show version information")
25
40
 
26
41
  subparsers = parser.add_subparsers(help="Available commands")
27
42
 
@@ -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"\\<polyConfig: {name}\\>" for name in config["type_names"]) or 'polyConfig'
117
+ pattern = ' '.join(f"/C:\"polyConfig: {name}\"" for name in config["type_names"]) or '/C:"polyConfig"'
118
118
 
119
- # Using two regular quotes or two smart quotes throws "The syntax of the command is incorrect".
120
- # For some reason, starting with a regular quote and leaving the end without a quote works.
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 is not '.':
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)
@@ -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-function-description", headers=headers, json=data)
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-function-description", headers=headers, json=data)
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
- deployableName = deployable["file"].replace('\\', '/').replace(f"{rootPath}/", '')
145
- if deployableName in staged:
146
- print(f'Staging {deployableName}')
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polyapi-python
3
- Version: 0.3.8.dev5
3
+ Version: 0.3.8.dev7
4
4
  Summary: The Python Client for PolyAPI, the IPaaS by Developers for Developers
5
5
  Author-email: Dan Fellin <dan@polyapi.io>
6
6
  License: MIT License
@@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"]
3
3
 
4
4
  [project]
5
5
  name = "polyapi-python"
6
- version = "0.3.8.dev5"
6
+ version = "0.3.8.dev7"
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 = [
@@ -66,11 +66,11 @@ def foobar(foo: str, bar: Dict[str, str]) -> int:
66
66
  """A function that does something really import.
67
67
 
68
68
  Args:
69
- foo (str):
70
- bar (Dict[str, str]):
69
+ foo (str):
70
+ bar (Dict[str, str]):
71
71
 
72
72
  Returns:
73
- int:
73
+ int:
74
74
  """
75
75
  print("Okay then!")
76
76
  return 7