yellowdog-python-examples 8.4.1__tar.gz → 8.4.3__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 (81) hide show
  1. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/PKG-INFO +1 -1
  2. yellowdog_python_examples-8.4.3/yellowdog_cli/__init__.py +1 -0
  3. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/show.py +34 -23
  4. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/args.py +19 -13
  5. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/variables.py +7 -0
  6. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_python_examples.egg-info/PKG-INFO +1 -1
  7. yellowdog_python_examples-8.4.1/yellowdog_cli/__init__.py +0 -1
  8. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/LICENSE +0 -0
  9. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/PYPI_README.md +0 -0
  10. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/README.md +0 -0
  11. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/pyproject.toml +0 -0
  12. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/requirements.txt +0 -0
  13. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/setup.cfg +0 -0
  14. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/tests/test_create_remove.py +0 -0
  15. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/tests/test_demos.py +0 -0
  16. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/tests/test_dryruns.py +0 -0
  17. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/tests/test_entrypoints.py +0 -0
  18. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/tests/test_gui.py +0 -0
  19. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/tests/test_list.py +0 -0
  20. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/tests/test_objects.py +0 -0
  21. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/tests/test_variable_processing.py +0 -0
  22. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/abort.py +0 -0
  23. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/admin.py +0 -0
  24. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/application.py +0 -0
  25. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/boost.py +0 -0
  26. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/cancel.py +0 -0
  27. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/cloudwizard.py +0 -0
  28. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/compare.py +0 -0
  29. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/create.py +0 -0
  30. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/delete.py +0 -0
  31. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/download.py +0 -0
  32. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/finish.py +0 -0
  33. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/follow.py +0 -0
  34. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/format_json.py +0 -0
  35. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/hold.py +0 -0
  36. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/instantiate.py +0 -0
  37. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/jsonnet2json.py +0 -0
  38. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/list.py +0 -0
  39. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/provision.py +0 -0
  40. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/remove.py +0 -0
  41. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/resize.py +0 -0
  42. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/shutdown.py +0 -0
  43. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/start.py +0 -0
  44. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/submit.py +0 -0
  45. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/terminate.py +0 -0
  46. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/upload.py +0 -0
  47. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/__init__.py +0 -0
  48. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/check_imports.py +0 -0
  49. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/cloudwizard_aws.py +0 -0
  50. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/cloudwizard_aws_types.py +0 -0
  51. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/cloudwizard_azure.py +0 -0
  52. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/cloudwizard_common.py +0 -0
  53. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/cloudwizard_gcp.py +0 -0
  54. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/compact_json.py +0 -0
  55. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/config_types.py +0 -0
  56. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/csv_data.py +0 -0
  57. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/entity_utils.py +0 -0
  58. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/follow_utils.py +0 -0
  59. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/interactive.py +0 -0
  60. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/items.py +0 -0
  61. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/load_config.py +0 -0
  62. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/load_resources.py +0 -0
  63. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/misc_utils.py +0 -0
  64. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/printing.py +0 -0
  65. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/property_names.py +0 -0
  66. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/provision_utils.py +0 -0
  67. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/rich_console_input_fixed.py +0 -0
  68. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/settings.py +0 -0
  69. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/start_hold_common.py +0 -0
  70. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/submit_utils.py +0 -0
  71. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/type_check.py +0 -0
  72. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/upload_utils.py +0 -0
  73. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/validate_properties.py +0 -0
  74. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/wrapper.py +0 -0
  75. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/utils/ydid_utils.py +0 -0
  76. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_cli/version.py +0 -0
  77. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_python_examples.egg-info/SOURCES.txt +0 -0
  78. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_python_examples.egg-info/dependency_links.txt +0 -0
  79. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_python_examples.egg-info/entry_points.txt +0 -0
  80. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_python_examples.egg-info/requires.txt +0 -0
  81. {yellowdog_python_examples-8.4.1 → yellowdog_python_examples-8.4.3}/yellowdog_python_examples.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yellowdog-python-examples
3
- Version: 8.4.1
3
+ Version: 8.4.3
4
4
  Summary: Python CLI commands using the YellowDog Python SDK
5
5
  Author-email: YellowDog Limited <support@yellowdog.co>
6
6
  License-Expression: Apache-2.0
@@ -0,0 +1 @@
1
+ __version__ = "8.4.3"
@@ -4,6 +4,8 @@
4
4
  Command to show the JSON details of YellowDog entities via their IDs.
5
5
  """
6
6
 
7
+ from typing import List
8
+
7
9
  from yellowdog_client.model import ConfiguredWorkerPool
8
10
 
9
11
  from yellowdog_cli.list import get_keyring
@@ -33,35 +35,16 @@ from yellowdog_cli.utils.settings import (
33
35
  RN_ROLE,
34
36
  RN_SOURCE_TEMPLATE,
35
37
  )
36
- from yellowdog_cli.utils.variables import get_user_variable
37
- from yellowdog_cli.utils.wrapper import ARGS_PARSER, CLIENT, CONFIG_COMMON, main_wrapper
38
+ from yellowdog_cli.utils.variables import get_all_user_variables, get_user_variable
39
+ from yellowdog_cli.utils.wrapper import ARGS_PARSER, CLIENT, main_wrapper
38
40
  from yellowdog_cli.utils.ydid_utils import YDIDType, get_ydid_type
39
41
 
40
42
 
41
43
  @main_wrapper
42
44
  def main():
43
45
 
44
- if ARGS_PARSER.parse_config:
45
- username = get_user_variable("username")
46
- if ARGS_PARSER.quiet:
47
- # Output properties in JSON format
48
- print_json(
49
- {
50
- "namespace": CONFIG_COMMON.namespace,
51
- "tag": CONFIG_COMMON.name_tag,
52
- "username": username,
53
- }
54
- )
55
- else:
56
- # Print properties inline
57
- print_info("Showing configuration values:")
58
- print(f" namespace = {CONFIG_COMMON.namespace}")
59
- print(f" tag = {CONFIG_COMMON.name_tag}")
60
- print(f" username = {username}")
61
- return
62
-
63
- if len(ARGS_PARSER.yellowdog_ids) == 0:
64
- print_info("No YellowDog IDs to show")
46
+ if ARGS_PARSER.report_variables is not None: # Report selected variables and return
47
+ _report_variables(ARGS_PARSER.report_variables)
65
48
  return
66
49
 
67
50
  # Generate a JSON list of resources if there are multiple YDIDs
@@ -300,6 +283,34 @@ def show_details(ydid: str, initial_indent: int = 0, with_final_comma: bool = Fa
300
283
  print_error(f"Unable to show details for '{ydid}': {e}")
301
284
 
302
285
 
286
+ def _report_variables(variable_names: List[str]):
287
+ """
288
+ Convenience function to report the processed values of user variables.
289
+ """
290
+ if "all" in variable_names:
291
+ variables = get_all_user_variables()
292
+ else:
293
+ variables = {
294
+ variable_name: get_user_variable(variable_name)
295
+ for variable_name in ARGS_PARSER.report_variables
296
+ }
297
+ variables_sorted = dict(sorted(variables.items()))
298
+
299
+ if ARGS_PARSER.quiet:
300
+ print_json(variables_sorted)
301
+ return
302
+
303
+ print_info("Reporting selected variable values:")
304
+ max_var_name = max(len(name) for name in variables_sorted)
305
+ for name, value in variables_sorted.items():
306
+ print(
307
+ f" {name}"
308
+ f"{' '* (max_var_name - len(name))} "
309
+ f"= {value}"
310
+ )
311
+ return
312
+
313
+
303
314
  # Entry point
304
315
  if __name__ == "__main__":
305
316
  main()
@@ -1001,14 +1001,6 @@ class CLIParser:
1001
1001
  help=f"the YellowDog ID(s) of the item(s) to {verb}",
1002
1002
  )
1003
1003
 
1004
- if any(module in sys.argv[0] for module in ["show"]):
1005
- parser.add_argument(
1006
- "--parse-config",
1007
- action="store_true",
1008
- required=False,
1009
- help="parse the config and return namespace, tag, username, then exit",
1010
- )
1011
-
1012
1004
  if any(
1013
1005
  module in sys.argv[0]
1014
1006
  for module in ["upload", "submit", "provision", "instantiate"]
@@ -1210,6 +1202,20 @@ class CLIParser:
1210
1202
  "configured worker pool"
1211
1203
  ),
1212
1204
  )
1205
+ parser.add_argument(
1206
+ "--report-variable",
1207
+ "-r",
1208
+ type=str,
1209
+ required=False,
1210
+ action="append",
1211
+ help=(
1212
+ "report the processed value of the specified variable and exit; "
1213
+ "the option can be supplied multiple times, one per variable, "
1214
+ "or use 'all' to report all variables; use with '--quiet' for "
1215
+ "output in JSON"
1216
+ ),
1217
+ metavar="<var>",
1218
+ )
1213
1219
 
1214
1220
  if any(module in sys.argv[0] for module in ["list", "show"]):
1215
1221
  parser.add_argument(
@@ -1319,11 +1325,6 @@ class CLIParser:
1319
1325
  def print_pid(self) -> Optional[bool]:
1320
1326
  return self.args.print_pid
1321
1327
 
1322
- @property
1323
- @allow_missing_attribute
1324
- def parse_config(self) -> Optional[bool]:
1325
- return self.args.parse_config
1326
-
1327
1328
  @property
1328
1329
  @allow_missing_attribute
1329
1330
  def no_config(self) -> Optional[bool]:
@@ -1842,6 +1843,11 @@ class CLIParser:
1842
1843
  def auto_select_all(self) -> Optional[bool]:
1843
1844
  return self.args.auto_select_all
1844
1845
 
1846
+ @property
1847
+ @allow_missing_attribute
1848
+ def report_variables(self) -> Optional[List[str]]:
1849
+ return self.args.report_variable
1850
+
1845
1851
 
1846
1852
  def lookup_module_description(module_name: str) -> Optional[str]:
1847
1853
  """
@@ -137,6 +137,13 @@ def get_user_variable(variable_name: str) -> Optional[str]:
137
137
  return VARIABLE_SUBSTITUTIONS.get(variable_name)
138
138
 
139
139
 
140
+ def get_all_user_variables() -> Dict:
141
+ """
142
+ Return all the user variables.
143
+ """
144
+ return VARIABLE_SUBSTITUTIONS
145
+
146
+
140
147
  def process_variable_substitutions_insitu(
141
148
  data: Union[Dict, List], prefix: str = "", postfix: str = ""
142
149
  ) -> Union[Dict, List]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yellowdog-python-examples
3
- Version: 8.4.1
3
+ Version: 8.4.3
4
4
  Summary: Python CLI commands using the YellowDog Python SDK
5
5
  Author-email: YellowDog Limited <support@yellowdog.co>
6
6
  License-Expression: Apache-2.0
@@ -1 +0,0 @@
1
- __version__ = "8.4.1"