hcs-core 0.1.295__tar.gz → 0.1.297__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 (71) hide show
  1. {hcs_core-0.1.295 → hcs_core-0.1.297}/.gitignore +1 -0
  2. {hcs_core-0.1.295 → hcs_core-0.1.297}/PKG-INFO +2 -2
  3. hcs_core-0.1.297/hcs_core/__init__.py +1 -0
  4. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/util.py +26 -0
  5. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/sglib/ez_client.py +8 -8
  6. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/util/job_view.py +6 -3
  7. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/util/versions.py +10 -8
  8. {hcs_core-0.1.295 → hcs_core-0.1.297}/pyproject.toml +1 -1
  9. hcs_core-0.1.295/hcs_core/__init__.py +0 -1
  10. {hcs_core-0.1.295 → hcs_core-0.1.297}/README.md +0 -0
  11. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/__init__.py +0 -0
  12. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/_init.py +0 -0
  13. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/built_in_cmds/__init__.py +0 -0
  14. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/built_in_cmds/_ut.py +0 -0
  15. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/built_in_cmds/context.py +0 -0
  16. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/built_in_cmds/profile.py +0 -0
  17. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/cli_options.py +0 -0
  18. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/cli_processor.py +0 -0
  19. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/cmd_util.py +0 -0
  20. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/config.py +0 -0
  21. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/context.py +0 -0
  22. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/data_util.py +0 -0
  23. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/dispatcher.py +0 -0
  24. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/duration.py +0 -0
  25. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/extension.py +0 -0
  26. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/fn_util.py +0 -0
  27. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/fstore.py +0 -0
  28. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/jsondot.py +0 -0
  29. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/logger.py +0 -0
  30. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/profile.py +0 -0
  31. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/profile_store.py +0 -0
  32. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/recent.py +0 -0
  33. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/state.py +0 -0
  34. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/task_schd.py +0 -0
  35. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/telemetry.py +0 -0
  36. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/template_util.py +0 -0
  37. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/timeutil.py +0 -0
  38. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/ctxp/var_template.py +0 -0
  39. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/plan/__init__.py +0 -0
  40. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/plan/actions.py +0 -0
  41. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/plan/base_provider.py +0 -0
  42. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/plan/context.py +0 -0
  43. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/plan/core.py +0 -0
  44. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/plan/dag.py +0 -0
  45. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/plan/helper.py +0 -0
  46. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/plan/kop.py +0 -0
  47. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/plan/provider/__init__.py +0 -0
  48. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/plan/provider/dev/__init__.py +0 -0
  49. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/plan/provider/dev/_prepare.py +0 -0
  50. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/plan/provider/dev/dummy.py +0 -0
  51. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/plan/provider/dev/fibonacci.py +0 -0
  52. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/sglib/__init__.py +0 -0
  53. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/sglib/auth.py +0 -0
  54. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/sglib/cli_options.py +0 -0
  55. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/sglib/client_util.py +0 -0
  56. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/sglib/csp.py +0 -0
  57. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/sglib/hcs_client.py +0 -0
  58. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/sglib/init.py +0 -0
  59. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/sglib/login_support.py +0 -0
  60. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/sglib/payload_util.py +0 -0
  61. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/sglib/requtil.py +0 -0
  62. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/sglib/utils.py +0 -0
  63. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/util/__init__.py +0 -0
  64. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/util/check_license.py +0 -0
  65. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/util/duration.py +0 -0
  66. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/util/exit.py +0 -0
  67. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/util/hcs_constants.py +0 -0
  68. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/util/pki_util.py +0 -0
  69. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/util/query_util.py +0 -0
  70. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/util/scheduler.py +0 -0
  71. {hcs_core-0.1.295 → hcs_core-0.1.297}/hcs_core/util/ssl_util.py +0 -0
@@ -180,3 +180,4 @@ ops/*.yml
180
180
  t.json
181
181
  t.py
182
182
  .ruff_cache/
183
+ exp/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hcs-core
3
- Version: 0.1.295
3
+ Version: 0.1.297
4
4
  Summary: Horizon Cloud Service CLI module.
5
5
  Project-URL: Homepage, https://github.com/euc-eng/hcs-cli
6
6
  Project-URL: Bug Tracker, https://github.com/euc-eng/hcs-cli/issues
@@ -36,7 +36,7 @@ Requires-Dist: schedule>=1.1.0
36
36
  Requires-Dist: setuptools>=70.0.0
37
37
  Requires-Dist: tabulate>=0.9.0
38
38
  Requires-Dist: websocket-client>=1.2.3
39
- Requires-Dist: yumako>=0.1.27
39
+ Requires-Dist: yumako>=0.1.30
40
40
  Provides-Extra: dev
41
41
  Requires-Dist: bandit; extra == 'dev'
42
42
  Requires-Dist: black; extra == 'dev'
@@ -0,0 +1 @@
1
+ __version__ = "0.1.297"
@@ -368,3 +368,29 @@ def format_table(data: list, fields_mapping: dict, columns_to_sum: list = None):
368
368
  traceback.print_exc()
369
369
 
370
370
  return tabulate(table, headers=headers) + "\n"
371
+
372
+
373
+ def colorize(data: dict, name: str, mapping: dict):
374
+ if os.environ.get("TERM_COLOR") == "0":
375
+ return
376
+
377
+ s = data.get(name)
378
+ if not s:
379
+ return
380
+
381
+ if isinstance(mapping, dict):
382
+ c = mapping.get(s)
383
+ if c:
384
+ if isinstance(c, str):
385
+ data[name] = click.style(s, fg=c)
386
+ elif callable(c):
387
+ color = c(data)
388
+ data[name] = click.style(s, fg=color)
389
+ else:
390
+ raise Exception(f"Unexpected color type: {type(c)} {c}")
391
+ elif callable(mapping):
392
+ c = mapping(s)
393
+ if c:
394
+ data[name] = click.style(s, fg=c)
395
+ else:
396
+ raise Exception(f"Unexpected mapping type: {type(mapping)} {mapping}")
@@ -206,10 +206,10 @@ class EzClient:
206
206
  raise
207
207
  return data
208
208
 
209
- def get(self, url: str, raise_on_404: bool = False, type: Optional[Type[BaseModel]] = None):
209
+ def get(self, url: str, headers: dict = None, raise_on_404: bool = False, type: Optional[Type[BaseModel]] = None):
210
210
  try:
211
211
  # print("->", url)
212
- resp = self._client().get(url)
212
+ resp = self._client().get(url, headers=headers)
213
213
  data = _parse_resp(resp)
214
214
  if data and type:
215
215
  try:
@@ -228,17 +228,17 @@ class EzClient:
228
228
  else:
229
229
  _raise_http_error(e)
230
230
 
231
- def patch(self, url: str, json: dict):
231
+ def patch(self, url: str, json: dict = None, text=None, headers: dict = None):
232
232
  try:
233
- resp = self._client().patch(url, json=json)
233
+ resp = self._client().patch(url, json=json, content=text, headers=headers)
234
234
  return _parse_resp(resp)
235
235
  except httpx.HTTPStatusError as e:
236
236
  _raise_http_error(e)
237
237
  raise
238
238
 
239
- def delete(self, url: str, raise_on_404: bool = False):
239
+ def delete(self, url: str, headers: dict = None, raise_on_404: bool = False):
240
240
  try:
241
- resp = self._client().delete(url)
241
+ resp = self._client().delete(url, headers=headers)
242
242
  return _parse_resp(resp)
243
243
  except httpx.HTTPStatusError as e:
244
244
  if _is_404(e):
@@ -249,9 +249,9 @@ class EzClient:
249
249
  else:
250
250
  _raise_http_error(e)
251
251
 
252
- def put(self, url: str, json: dict):
252
+ def put(self, url: str, json: dict = None, text=None, headers: dict = None):
253
253
  try:
254
- resp = self._client().put(url, json=json)
254
+ resp = self._client().put(url, json=json, content=text, headers=headers)
255
255
  return _parse_resp(resp)
256
256
  except httpx.HTTPStatusError as e:
257
257
  _raise_http_error(e)
@@ -134,6 +134,9 @@ def _timeout_to_seconds(timeout: str, default: int = 60) -> int:
134
134
  return t
135
135
 
136
136
 
137
+ _NAME_WIDTH = 40
138
+
139
+
137
140
  class JobView:
138
141
  def __init__(self, auto_close: bool = True):
139
142
  self._map = {}
@@ -144,9 +147,9 @@ class JobView:
144
147
  self._view_exited = threading.Event()
145
148
 
146
149
  w, h = os.get_terminal_size()
147
- msg_width = w - 40 - 1 - 1 - 1 - 10 - 1 - 5 - 1 - 1
150
+ msg_width = w - _NAME_WIDTH - 1 - 1 - 1 - 10 - 1 - 5 - 1 - 1
148
151
  self._job_ctl = Progress(
149
- TextColumn("{task.description}", table_column=Column(max_width=40, min_width=10)),
152
+ TextColumn("{task.description}", table_column=Column(max_width=_NAME_WIDTH, min_width=10)),
150
153
  # SpinnerColumn(table_column=Column(min_width=1)),
151
154
  _MySpinnerColumn(table_column=Column(min_width=1)),
152
155
  # BarColumn(pulse_style='white'),
@@ -159,7 +162,7 @@ class JobView:
159
162
  )
160
163
 
161
164
  def add(self, id: str, name: str):
162
- name = _shorten_package_name(name, 30)
165
+ name = _shorten_package_name(name, _NAME_WIDTH)
163
166
  self._map[id] = self._job_ctl.add_task(name, start=False, details="")
164
167
  self._todo.add(id)
165
168
 
@@ -30,14 +30,16 @@ def check_upgrade():
30
30
  checked_at = hcs_core.ctxp.state.get(last_upgrade_check_at, 0)
31
31
 
32
32
  now = time.time()
33
- if now - checked_at > 24 * 60 * 60:
34
- try:
35
- latest = get_latest_version()
36
- current = Version(get_version())
37
- if current < latest:
38
- log.warning(f"New version available: {latest}. Execute 'hcs upgrade' to upgrade.")
39
- except Exception as e:
40
- logging.debug(e)
33
+ if now - checked_at < 24 * 60 * 60:
34
+ return
35
+
36
+ try:
37
+ latest = get_latest_version()
38
+ current = Version(get_version())
39
+ if current < latest:
40
+ log.warning(f"New version available: {latest}. Execute 'hcs upgrade' to upgrade.")
41
+ except Exception as e:
42
+ logging.debug(e)
41
43
 
42
44
  hcs_core.ctxp.state.set(last_upgrade_check_at, now)
43
45
 
@@ -43,7 +43,7 @@ dependencies = [
43
43
  "websocket_client>=1.2.3",
44
44
  "psutil>=7.0.0",
45
45
  "schedule>=1.1.0",
46
- "yumako>=0.1.27",
46
+ "yumako>=0.1.30",
47
47
  "pydantic>=2.11.7",
48
48
  "python-dotenv>=1.1.1",
49
49
  ]
@@ -1 +0,0 @@
1
- __version__ = "0.1.295"
File without changes