yellowdog-python-examples 8.4.0__tar.gz → 8.4.2__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.0 → yellowdog_python_examples-8.4.2}/PKG-INFO +2 -2
  2. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/requirements.txt +1 -1
  3. yellowdog_python_examples-8.4.2/yellowdog_cli/__init__.py +1 -0
  4. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/show.py +33 -21
  5. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/submit.py +2 -2
  6. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/args.py +24 -8
  7. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/csv_data.py +1 -4
  8. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/load_config.py +2 -5
  9. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/property_names.py +2 -2
  10. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/variables.py +8 -4
  11. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_python_examples.egg-info/PKG-INFO +2 -2
  12. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_python_examples.egg-info/requires.txt +1 -3
  13. yellowdog_python_examples-8.4.0/yellowdog_cli/__init__.py +0 -1
  14. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/LICENSE +0 -0
  15. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/PYPI_README.md +0 -0
  16. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/README.md +0 -0
  17. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/pyproject.toml +0 -0
  18. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/setup.cfg +0 -0
  19. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/tests/test_create_remove.py +0 -0
  20. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/tests/test_demos.py +0 -0
  21. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/tests/test_dryruns.py +0 -0
  22. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/tests/test_entrypoints.py +0 -0
  23. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/tests/test_gui.py +0 -0
  24. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/tests/test_list.py +0 -0
  25. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/tests/test_objects.py +0 -0
  26. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/tests/test_variable_processing.py +0 -0
  27. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/abort.py +0 -0
  28. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/admin.py +0 -0
  29. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/application.py +0 -0
  30. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/boost.py +0 -0
  31. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/cancel.py +0 -0
  32. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/cloudwizard.py +0 -0
  33. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/compare.py +0 -0
  34. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/create.py +0 -0
  35. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/delete.py +0 -0
  36. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/download.py +0 -0
  37. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/finish.py +0 -0
  38. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/follow.py +0 -0
  39. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/format_json.py +0 -0
  40. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/hold.py +0 -0
  41. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/instantiate.py +0 -0
  42. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/jsonnet2json.py +0 -0
  43. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/list.py +0 -0
  44. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/provision.py +0 -0
  45. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/remove.py +0 -0
  46. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/resize.py +0 -0
  47. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/shutdown.py +0 -0
  48. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/start.py +0 -0
  49. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/terminate.py +0 -0
  50. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/upload.py +0 -0
  51. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/__init__.py +0 -0
  52. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/check_imports.py +0 -0
  53. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/cloudwizard_aws.py +0 -0
  54. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/cloudwizard_aws_types.py +0 -0
  55. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/cloudwizard_azure.py +0 -0
  56. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/cloudwizard_common.py +0 -0
  57. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/cloudwizard_gcp.py +0 -0
  58. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/compact_json.py +0 -0
  59. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/config_types.py +0 -0
  60. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/entity_utils.py +0 -0
  61. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/follow_utils.py +0 -0
  62. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/interactive.py +0 -0
  63. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/items.py +0 -0
  64. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/load_resources.py +0 -0
  65. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/misc_utils.py +0 -0
  66. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/printing.py +0 -0
  67. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/provision_utils.py +0 -0
  68. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/rich_console_input_fixed.py +0 -0
  69. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/settings.py +0 -0
  70. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/start_hold_common.py +0 -0
  71. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/submit_utils.py +0 -0
  72. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/type_check.py +0 -0
  73. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/upload_utils.py +0 -0
  74. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/validate_properties.py +0 -0
  75. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/wrapper.py +0 -0
  76. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/utils/ydid_utils.py +0 -0
  77. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_cli/version.py +0 -0
  78. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_python_examples.egg-info/SOURCES.txt +0 -0
  79. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_python_examples.egg-info/dependency_links.txt +0 -0
  80. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/yellowdog_python_examples.egg-info/entry_points.txt +0 -0
  81. {yellowdog_python_examples-8.4.0 → yellowdog_python_examples-8.4.2}/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.0
3
+ Version: 8.4.2
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
@@ -25,7 +25,7 @@ Requires-Dist: python-dotenv
25
25
  Requires-Dist: requests
26
26
  Requires-Dist: rich==13.9.4
27
27
  Requires-Dist: tabulate>=0.9.0
28
- Requires-Dist: tomli>=2.4.0; python_version < "3.11"
28
+ Requires-Dist: tomli>=2.4.0
29
29
  Requires-Dist: yellowdog-sdk>=13.1.0
30
30
  Provides-Extra: jsonnet
31
31
  Requires-Dist: jsonnet; extra == "jsonnet"
@@ -4,5 +4,5 @@ python-dotenv
4
4
  requests
5
5
  rich == 13.9.4
6
6
  tabulate >= 0.9.0
7
- tomli >= 2.4.0; python_version < "3.11"
7
+ tomli >= 2.4.0
8
8
  yellowdog-sdk >= 13.1.0
@@ -0,0 +1 @@
1
+ __version__ = "8.4.2"
@@ -33,7 +33,7 @@ from yellowdog_cli.utils.settings import (
33
33
  RN_ROLE,
34
34
  RN_SOURCE_TEMPLATE,
35
35
  )
36
- from yellowdog_cli.utils.variables import USERNAME
36
+ from yellowdog_cli.utils.variables import get_user_variable
37
37
  from yellowdog_cli.utils.wrapper import ARGS_PARSER, CLIENT, CONFIG_COMMON, main_wrapper
38
38
  from yellowdog_cli.utils.ydid_utils import YDIDType, get_ydid_type
39
39
 
@@ -41,26 +41,8 @@ from yellowdog_cli.utils.ydid_utils import YDIDType, get_ydid_type
41
41
  @main_wrapper
42
42
  def main():
43
43
 
44
- if ARGS_PARSER.parse_config:
45
- if ARGS_PARSER.quiet:
46
- # Output properties in JSON format
47
- print_json(
48
- {
49
- "namespace": CONFIG_COMMON.namespace,
50
- "tag": CONFIG_COMMON.name_tag,
51
- "username": USERNAME,
52
- }
53
- )
54
- else:
55
- # Print properties inline
56
- print_info("Showing configuration values:")
57
- print(f" namespace = {CONFIG_COMMON.namespace}")
58
- print(f" tag = {CONFIG_COMMON.name_tag}")
59
- print(f" username = {USERNAME}")
60
- return
61
-
62
- if len(ARGS_PARSER.yellowdog_ids) == 0:
63
- print_info("No YellowDog IDs to show")
44
+ if ARGS_PARSER.parse_config: # Report selected variables and return
45
+ _report_variables()
64
46
  return
65
47
 
66
48
  # Generate a JSON list of resources if there are multiple YDIDs
@@ -299,6 +281,36 @@ def show_details(ydid: str, initial_indent: int = 0, with_final_comma: bool = Fa
299
281
  print_error(f"Unable to show details for '{ydid}': {e}")
300
282
 
301
283
 
284
+ def _report_variables():
285
+ """
286
+ Convenience function to report the processed values of user variables.
287
+ """
288
+ data = (
289
+ {}
290
+ if ARGS_PARSER.report_variables is None
291
+ else {
292
+ variable_name: get_user_variable(variable_name)
293
+ for variable_name in ARGS_PARSER.report_variables
294
+ }
295
+ )
296
+ if ARGS_PARSER.quiet:
297
+ print_json(data)
298
+ return
299
+
300
+ if ARGS_PARSER.report_variables is None:
301
+ print_info("No variables selected for reporting")
302
+ return
303
+
304
+ print_info("Reporting selected variable values:")
305
+ for name, value in data.items():
306
+ print(
307
+ f" {name}"
308
+ f"{' '* (20 - len(name)) if len(name) < 20 else ''} "
309
+ f"= {value}"
310
+ )
311
+ return
312
+
313
+
302
314
  # Entry point
303
315
  if __name__ == "__main__":
304
316
  main()
@@ -546,8 +546,8 @@ def create_task_group(
546
546
  ),
547
547
  disablePreallocation=check_bool(
548
548
  task_group_data.get(
549
- DISABLE_PREALLOCTAION,
550
- wr_data.get(DISABLE_PREALLOCTAION, config_wr.disable_prealloaction),
549
+ DISABLE_PREALLOCATION,
550
+ wr_data.get(DISABLE_PREALLOCATION, config_wr.disable_prealloaction),
551
551
  )
552
552
  ),
553
553
  )
@@ -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,25 @@ class CLIParser:
1210
1202
  "configured worker pool"
1211
1203
  ),
1212
1204
  )
1205
+ parser.add_argument(
1206
+ "--parse-config",
1207
+ action="store_true",
1208
+ required=False,
1209
+ help="parse the config and return namespace, tag, username, then exit",
1210
+ )
1211
+ parser.add_argument(
1212
+ "--report-variable",
1213
+ "-r",
1214
+ type=str,
1215
+ required=False,
1216
+ action="append",
1217
+ help=(
1218
+ "report the processed value of the specified variable, "
1219
+ "when used with '--parse-config; the option can be supplied "
1220
+ "multiple times, one per variable"
1221
+ ),
1222
+ metavar="<var>",
1223
+ )
1213
1224
 
1214
1225
  if any(module in sys.argv[0] for module in ["list", "show"]):
1215
1226
  parser.add_argument(
@@ -1842,6 +1853,11 @@ class CLIParser:
1842
1853
  def auto_select_all(self) -> Optional[bool]:
1843
1854
  return self.args.auto_select_all
1844
1855
 
1856
+ @property
1857
+ @allow_missing_attribute
1858
+ def report_variables(self) -> Optional[List[str]]:
1859
+ return self.args.report_variable
1860
+
1845
1861
 
1846
1862
  def lookup_module_description(module_name: str) -> Optional[str]:
1847
1863
  """
@@ -10,10 +10,7 @@ from json import load as json_load
10
10
  from os.path import relpath
11
11
  from typing import Dict, List, Optional, Tuple
12
12
 
13
- try:
14
- from tomllib import load as toml_load # Available in Python 3.11+
15
- except ImportError:
16
- from tomli import load as toml_load # Fallback for 3.9 and 3.10
13
+ from tomli import load as toml_load
17
14
 
18
15
  from yellowdog_cli.utils.args import ARGS_PARSER
19
16
  from yellowdog_cli.utils.config_types import ConfigWorkRequirement
@@ -9,10 +9,7 @@ from pathlib import Path
9
9
  from sys import exit
10
10
  from typing import Dict
11
11
 
12
- try:
13
- from tomllib import TOMLDecodeError # Available in Python 3.11+
14
- except ImportError:
15
- from tomli import TOMLDecodeError # Fallback for 3.9 and 3.10
12
+ from tomli import TOMLDecodeError
16
13
 
17
14
  from yellowdog_cli.utils.args import ARGS_PARSER
18
15
  from yellowdog_cli.utils.config_types import (
@@ -316,7 +313,7 @@ def load_config_work_requirement() -> ConfigWorkRequirement:
316
313
  upload_taskoutput=wr_section.get(UPLOAD_TASKOUTPUT, False),
317
314
  completed_task_ttl=wr_section.get(COMPLETED_TASK_TTL, None),
318
315
  csv_files=csv_files,
319
- disable_prealloaction=wr_section.get(DISABLE_PREALLOCTAION, None),
316
+ disable_prealloaction=wr_section.get(DISABLE_PREALLOCATION, None),
320
317
  docker_env=wr_section.get(DOCKER_ENV, None),
321
318
  docker_options=wr_section.get(DOCKER_OPTIONS, None),
322
319
  docker_password=wr_section.get(DOCKER_PASSWORD, None),
@@ -15,7 +15,7 @@ COMPUTE_REQUIREMENT_SECTION = "computeRequirement" # No value
15
15
  CR_TAG = "requirementTag" # String
16
16
  CSV_FILE = "csvFile" # String
17
17
  CSV_FILES = "csvFiles" # List of Strings
18
- DISABLE_PREALLOCTAION = "disablePreallocation"
18
+ DISABLE_PREALLOCATION = "disablePreallocation"
19
19
  DEPENDENCIES = "dependencies" # List of Strings
20
20
  DEPENDENT_ON = "dependentOn" # String (Deprecated)
21
21
  DIRECTORY_NAME = "directoryName" # String
@@ -131,7 +131,7 @@ ALL_KEYS = [
131
131
  CR_TAG,
132
132
  CSV_FILE,
133
133
  CSV_FILES,
134
- DISABLE_PREALLOCTAION,
134
+ DISABLE_PREALLOCATION,
135
135
  DEPENDENCIES,
136
136
  DEPENDENT_ON,
137
137
  DIRECTORY_NAME,
@@ -12,10 +12,7 @@ from json import loads as json_loads
12
12
  from random import randint
13
13
  from typing import Dict, List, Optional, Union
14
14
 
15
- try:
16
- from tomllib import load as toml_load # Available in Python 3.11+
17
- except ImportError:
18
- from tomli import load as toml_load # Fallback for 3.9 and 3.10
15
+ from tomli import load as toml_load
19
16
 
20
17
  from yellowdog_cli.utils.args import ARGS_PARSER
21
18
  from yellowdog_cli.utils.check_imports import check_jsonnet_import
@@ -133,6 +130,13 @@ def add_or_update_substitution(key: str, value: str):
133
130
  VARIABLE_SUBSTITUTIONS[key] = str(value)
134
131
 
135
132
 
133
+ def get_user_variable(variable_name: str) -> Optional[str]:
134
+ """
135
+ Get the value of a variable.
136
+ """
137
+ return VARIABLE_SUBSTITUTIONS.get(variable_name)
138
+
139
+
136
140
  def process_variable_substitutions_insitu(
137
141
  data: Union[Dict, List], prefix: str = "", postfix: str = ""
138
142
  ) -> Union[Dict, List]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yellowdog-python-examples
3
- Version: 8.4.0
3
+ Version: 8.4.2
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
@@ -25,7 +25,7 @@ Requires-Dist: python-dotenv
25
25
  Requires-Dist: requests
26
26
  Requires-Dist: rich==13.9.4
27
27
  Requires-Dist: tabulate>=0.9.0
28
- Requires-Dist: tomli>=2.4.0; python_version < "3.11"
28
+ Requires-Dist: tomli>=2.4.0
29
29
  Requires-Dist: yellowdog-sdk>=13.1.0
30
30
  Provides-Extra: jsonnet
31
31
  Requires-Dist: jsonnet; extra == "jsonnet"
@@ -4,10 +4,8 @@ python-dotenv
4
4
  requests
5
5
  rich==13.9.4
6
6
  tabulate>=0.9.0
7
- yellowdog-sdk>=13.1.0
8
-
9
- [:python_version < "3.11"]
10
7
  tomli>=2.4.0
8
+ yellowdog-sdk>=13.1.0
11
9
 
12
10
  [cloudwizard]
13
11
  boto3
@@ -1 +0,0 @@
1
- __version__ = "8.4.0"