polyapi-python 0.3.8.dev0__py3-none-any.whl → 0.3.8.dev1__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/deployables.py CHANGED
@@ -112,20 +112,24 @@ class PolyDeployConfig(TypedDict):
112
112
 
113
113
  def get_all_deployable_files_windows(config: PolyDeployConfig) -> List[str]:
114
114
  # Constructing the Windows command using dir and findstr
115
- include_pattern = " ".join(f"*.{f}" if "." in f else f"*.{f}" for f in config["include_files_or_extensions"]) or "*"
116
- exclude_pattern = '|'.join(config["exclude_dirs"])
117
- pattern = '|'.join(f"polyConfig: {name}" for name in config["type_names"]) or 'polyConfig'
115
+ include_pattern = " ".join(f"*.{f}" for f in config["include_files_or_extensions"]) or "*"
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'
118
118
 
119
- exclude_command = f" | findstr /V /I \"{exclude_pattern}\"" if exclude_pattern else ''
120
- search_command = f" | findstr /M /I /F:/ /C:\"{pattern}\""
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}"
121
123
 
122
124
  result = []
123
125
  for dir_path in config["include_dirs"]:
124
- dir_command = f"dir /S /P /B {include_pattern} {dir_path}"
126
+ if dir_path is not '.':
127
+ 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"
125
129
  full_command = f"{dir_command}{exclude_command}{search_command}"
126
130
  try:
127
131
  output = subprocess.check_output(full_command, shell=True, text=True)
128
- result.extend(output.strip().split('\r\n'))
132
+ result.extend(output.strip().split('\n'))
129
133
  except subprocess.CalledProcessError:
130
134
  pass
131
135
  return result
@@ -154,7 +158,7 @@ def get_all_deployable_files(config: PolyDeployConfig) -> List[str]:
154
158
  if not config.get("include_files_or_extensions"):
155
159
  config["include_files_or_extensions"] = ["py"]
156
160
  if not config.get("exclude_dirs"):
157
- config["exclude_dirs"] = ["poly", "node_modules", "dist", "build", "output", ".vscode", ".poly", ".github", ".husky", ".yarn"]
161
+ config["exclude_dirs"] = ["Lib", "node_modules", "dist", "build", "output", ".vscode", ".poly", ".github", ".husky", ".yarn", ".venv"]
158
162
 
159
163
  is_windows = os.name == "nt"
160
164
  if is_windows:
polyapi/prepare.py CHANGED
@@ -1,5 +1,6 @@
1
1
  import os
2
2
  import sys
3
+ import subprocess
3
4
  from typing import List, Tuple, Literal
4
5
  import requests
5
6
 
@@ -135,6 +136,18 @@ def prepare_deployables(lazy: bool = False, disable_docs: bool = False, disable_
135
136
  # NOTE: write_updated_deployable has side effects that update deployable.fileRevision which is in both this list and parsed_deployables
136
137
  for deployable in dirty_deployables:
137
138
  write_updated_deployable(deployable, disable_docs)
139
+ # Re-stage any updated staged files.
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
+ for deployable in dirty_deployables:
143
+ 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])
148
+ except:
149
+ print('Warning: File staging failed, check that all files are staged properly.')
150
+
138
151
 
139
152
  print("Poly deployments are prepared.")
140
153
  save_deployable_records(parsed_deployables)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polyapi-python
3
- Version: 0.3.8.dev0
3
+ Version: 0.3.8.dev1
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
@@ -6,7 +6,7 @@ polyapi/cli.py,sha256=jtKXARbT9AOgYTR6nf3OiwiPvsyUlLVbyynEA84PDzw,8924
6
6
  polyapi/client.py,sha256=CoFDYvyKsqL4wPQbUDIr0Qb8Q5eD92xN4OEEcJEVuGQ,1296
7
7
  polyapi/config.py,sha256=QQxRZ9nMUykItUMAdw97dad0DPEV1luRwkeqOyrEKf8,4316
8
8
  polyapi/constants.py,sha256=sc-FnS0SngBLvSu1ZWMs0UCf9EYD1u1Yhfr-sZXGLns,607
9
- polyapi/deployables.py,sha256=WVcNNB6W5ZW_-ukf_kK3moRcnwIkC-O4te6vLepjcco,11936
9
+ polyapi/deployables.py,sha256=KjVAillK3OMNpT2F5KzmAefoTSmhDN0ZIwzEMXPCRU0,12261
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=hv5K5niegqitT6VwbS7M5ec3nEMyqwVtE6tcpwHoxIk,4125
14
14
  polyapi/generate.py,sha256=1ZwcUEfhYLc64Wh5aYhvU6P594HOL2LYycPKkH39frc,15394
15
15
  polyapi/parser.py,sha256=mdoh4pNq8pyiHE0-i6Coqj8frEXfBLRk6itpAXMrrgI,20373
16
16
  polyapi/poly_schemas.py,sha256=T4kfZyfgVLiqLD28GmYNiHnrNx77J_HO4uzk8LUAhlo,3137
17
- polyapi/prepare.py,sha256=Q8CWV4kmZ2dbXYVsud34AgJkj5ymcQ_IcYhLuikc9yk,6659
17
+ polyapi/prepare.py,sha256=t-Gj5SrLokUuAJ70IKY6myK_OoJ-N7SazeIMlu5cmuc,7396
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.dev0.dist-info/licenses/LICENSE,sha256=6b_I7aPVp8JXhqQwdw7_B84Ca0S4JGjHj0sr_1VOdB4,1068
28
- polyapi_python-0.3.8.dev0.dist-info/METADATA,sha256=iT2GUeSijJZYAZH7SbrD_5vYtxlxPrluvrOsxa11KgU,5782
29
- polyapi_python-0.3.8.dev0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
- polyapi_python-0.3.8.dev0.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
31
- polyapi_python-0.3.8.dev0.dist-info/RECORD,,
27
+ polyapi_python-0.3.8.dev1.dist-info/licenses/LICENSE,sha256=6b_I7aPVp8JXhqQwdw7_B84Ca0S4JGjHj0sr_1VOdB4,1068
28
+ polyapi_python-0.3.8.dev1.dist-info/METADATA,sha256=xDnbtcsNeG5SyystGCPuFMXxChLiloGwaE1HMO2do6U,5782
29
+ polyapi_python-0.3.8.dev1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
+ polyapi_python-0.3.8.dev1.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
31
+ polyapi_python-0.3.8.dev1.dist-info/RECORD,,