yellowdog-python-examples 7.20.2__tar.gz → 7.20.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 (79) hide show
  1. {yellowdog_python_examples-7.20.2/yellowdog_python_examples.egg-info → yellowdog_python_examples-7.20.3}/PKG-INFO +1 -1
  2. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/README.md +5 -5
  3. yellowdog_python_examples-7.20.3/yellowdog_cli/__init__.py +1 -0
  4. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/args.py +12 -0
  5. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/load_config.py +44 -34
  6. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3/yellowdog_python_examples.egg-info}/PKG-INFO +1 -1
  7. yellowdog_python_examples-7.20.2/yellowdog_cli/__init__.py +0 -1
  8. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/LICENSE +0 -0
  9. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/PYPI_README.md +0 -0
  10. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/pyproject.toml +0 -0
  11. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/requirements.txt +0 -0
  12. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/setup.cfg +0 -0
  13. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/tests/test_create_remove.py +0 -0
  14. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/tests/test_demos.py +0 -0
  15. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/tests/test_dryruns.py +0 -0
  16. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/tests/test_entrypoints.py +0 -0
  17. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/tests/test_gui.py +0 -0
  18. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/tests/test_list.py +0 -0
  19. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/tests/test_objects.py +0 -0
  20. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/tests/test_variable_processing.py +0 -0
  21. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/abort.py +0 -0
  22. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/admin.py +0 -0
  23. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/boost.py +0 -0
  24. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/cancel.py +0 -0
  25. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/cloudwizard.py +0 -0
  26. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/compare.py +0 -0
  27. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/create.py +0 -0
  28. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/delete.py +0 -0
  29. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/download.py +0 -0
  30. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/follow.py +0 -0
  31. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/format_json.py +0 -0
  32. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/hold.py +0 -0
  33. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/instantiate.py +0 -0
  34. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/jsonnet2json.py +0 -0
  35. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/list.py +0 -0
  36. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/provision.py +0 -0
  37. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/remove.py +0 -0
  38. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/resize.py +0 -0
  39. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/show.py +0 -0
  40. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/shutdown.py +0 -0
  41. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/start.py +0 -0
  42. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/submit.py +0 -0
  43. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/terminate.py +0 -0
  44. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/upload.py +0 -0
  45. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/__init__.py +0 -0
  46. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/check_imports.py +0 -0
  47. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/cloudwizard_aws.py +0 -0
  48. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/cloudwizard_aws_types.py +0 -0
  49. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/cloudwizard_azure.py +0 -0
  50. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/cloudwizard_common.py +0 -0
  51. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/cloudwizard_gcp.py +0 -0
  52. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/compact_json.py +0 -0
  53. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/config_types.py +0 -0
  54. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/csv_data.py +0 -0
  55. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/entity_utils.py +0 -0
  56. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/follow_utils.py +0 -0
  57. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/interactive.py +0 -0
  58. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/items.py +0 -0
  59. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/load_resources.py +0 -0
  60. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/misc_utils.py +0 -0
  61. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/printing.py +0 -0
  62. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/property_names.py +0 -0
  63. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/provision_utils.py +0 -0
  64. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/rich_console_input_fixed.py +0 -0
  65. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/settings.py +0 -0
  66. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/start_hold_common.py +0 -0
  67. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/submit_utils.py +0 -0
  68. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/type_check.py +0 -0
  69. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/upload_utils.py +0 -0
  70. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/validate_properties.py +0 -0
  71. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/variables.py +0 -0
  72. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/wrapper.py +0 -0
  73. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/utils/ydid_utils.py +0 -0
  74. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_cli/version.py +0 -0
  75. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_python_examples.egg-info/SOURCES.txt +0 -0
  76. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_python_examples.egg-info/dependency_links.txt +0 -0
  77. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_python_examples.egg-info/entry_points.txt +0 -0
  78. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.3}/yellowdog_python_examples.egg-info/requires.txt +0 -0
  79. {yellowdog_python_examples-7.20.2 → yellowdog_python_examples-7.20.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: 7.20.2
3
+ Version: 7.20.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
@@ -395,7 +395,7 @@ The **environment variables** are as follows:
395
395
  - `YD_NAMESPACE`
396
396
  - `YD_TAG`
397
397
 
398
- When setting the value of the above properties, a property set on the command line takes precedence over one set via an environment variable, and both take precedence over a value set in a configuration file.
398
+ When setting the value of the above properties, a property set on the command line takes precedence over one set via the configuration file, and both take precedence over a value set in an environment variable.
399
399
 
400
400
  If all the required common properties are set using the command line or environment variables, then the entire `common` section of the TOML file can be omitted.
401
401
 
@@ -486,10 +486,10 @@ User-defined variable names must not include spaces, but are otherwise unconstra
486
486
  The precedence order for setting variables is:
487
487
 
488
488
  1. Command line
489
- 2. `YD_VAR` environment variables
490
- 3. General environment variables
491
- 4. Variables in a `.env` file
492
- 5. TOML file
489
+ 2. TOML configuration file
490
+ 3. `YD_VAR` environment variables
491
+ 4. General environment variables
492
+ 5. Variables in a `.env` file
493
493
 
494
494
  This method can also be used to override the default variables, e.g., setting `-v username="other-user"` will override the default `{{username}}` variable.
495
495
 
@@ -0,0 +1 @@
1
+ __version__ = "7.20.3"
@@ -127,6 +127,13 @@ class CLIParser:
127
127
  required=False,
128
128
  help="include the process ID of this CLI invocation alongside timestamp in logging messages",
129
129
  )
130
+ parser.add_argument(
131
+ "--no-config",
132
+ "--nc",
133
+ action="store_true",
134
+ required=False,
135
+ help="ignore the contents of any TOML configuration file (even if specified on the command line)",
136
+ )
130
137
 
131
138
  # Module-specific argument sets
132
139
  if not any(module in sys.argv[0] for module in ["compare"]):
@@ -1287,6 +1294,11 @@ class CLIParser:
1287
1294
  def print_pid(self) -> Optional[bool]:
1288
1295
  return self.args.print_pid
1289
1296
 
1297
+ @property
1298
+ @allow_missing_attribute
1299
+ def no_config(self) -> Optional[bool]:
1300
+ return self.args.no_config
1301
+
1290
1302
  @property
1291
1303
  @allow_missing_attribute
1292
1304
  def work_req_file(self) -> Optional[str]:
@@ -59,7 +59,6 @@ for norm, alt in [
59
59
  ]:
60
60
  if os.getenv(norm) is None and os.getenv(alt) is not None:
61
61
  os.environ[norm] = os.getenv(alt)
62
- print_log(f"Setting environment variable '{norm}' using value of '{alt}'")
63
62
 
64
63
  # CLI > YD_CONF > 'config.toml'
65
64
  CONFIG_FILE = relpath(
@@ -68,42 +67,50 @@ CONFIG_FILE = relpath(
68
67
  else ARGS_PARSER.config_file
69
68
  )
70
69
 
71
- try:
72
- CONFIG_FILE_DIR = dirname(CONFIG_FILE)
73
- config_dir_abs = abspath(CONFIG_FILE_DIR)
74
- config_dir_short = Path(config_dir_abs).parts[-1]
75
- VARIABLE_SUBSTITUTIONS.update(
76
- {"config_dir_abs": config_dir_abs, "config_dir_name": config_dir_short}
77
- )
78
- print_log(f"Loading configuration data from: '{CONFIG_FILE}'")
79
- CONFIG_TOML: Dict = load_toml_file_with_variable_substitutions(CONFIG_FILE)
70
+ if ARGS_PARSER.no_config:
71
+ # Suppress use of any TOML config file
72
+ print_log(f"Configuration file ('{CONFIG_FILE}') ignored")
73
+ CONFIG_TOML = {COMMON_SECTION: {}}
74
+ CONFIG_FILE_DIR = os.getcwd()
75
+
76
+ else:
77
+ # Attempt to load configuration data from TOML file
80
78
  try:
81
- validate_properties(CONFIG_TOML, f"'{CONFIG_FILE}'")
82
- except Exception as e:
83
- print_error(e)
79
+ CONFIG_FILE_DIR = dirname(CONFIG_FILE)
80
+ config_dir_abs = abspath(CONFIG_FILE_DIR)
81
+ config_dir_short = Path(config_dir_abs).parts[-1]
82
+ VARIABLE_SUBSTITUTIONS.update(
83
+ {"config_dir_abs": config_dir_abs, "config_dir_name": config_dir_short}
84
+ )
85
+ print_log(f"Loading configuration data from: '{CONFIG_FILE}'")
86
+ CONFIG_TOML: Dict = load_toml_file_with_variable_substitutions(CONFIG_FILE)
87
+ try:
88
+ validate_properties(CONFIG_TOML, f"'{CONFIG_FILE}'")
89
+ except Exception as e:
90
+ print_error(e)
91
+ exit(1)
92
+
93
+ except FileNotFoundError as e:
94
+ if ARGS_PARSER.config_file is not None:
95
+ print_error(e)
96
+ exit(1)
97
+ # No config file, so create a stub config dictionary
98
+ print_log(
99
+ "No configuration file; expecting configuration data on command line "
100
+ "or in environment variables"
101
+ )
102
+ CONFIG_TOML = {COMMON_SECTION: {}}
103
+ CONFIG_FILE_DIR = os.getcwd()
104
+
105
+ except (PermissionError, TomlDecodeError) as e:
106
+ print_error(
107
+ f"Unable to load configuration data from '{CONFIG_FILE}': {e}",
108
+ )
84
109
  exit(1)
85
110
 
86
- except FileNotFoundError as e:
87
- if ARGS_PARSER.config_file is not None:
111
+ except Exception as e:
88
112
  print_error(e)
89
113
  exit(1)
90
- # No config file, so create a stub config dictionary
91
- print_log(
92
- "No configuration file; expecting configuration data on command line "
93
- "or in environment variables"
94
- )
95
- CONFIG_TOML = {COMMON_SECTION: {}}
96
- CONFIG_FILE_DIR = os.getcwd()
97
-
98
- except (PermissionError, TomlDecodeError) as e:
99
- print_error(
100
- f"Unable to load configuration data from '{CONFIG_FILE}': {e}",
101
- )
102
- exit(1)
103
-
104
- except Exception as e:
105
- print_error(e)
106
- exit(1)
107
114
 
108
115
 
109
116
  def load_config_common() -> ConfigCommon:
@@ -123,7 +130,7 @@ def load_config_common() -> ConfigCommon:
123
130
 
124
131
  # Replace common section properties with command line or
125
132
  # environment variable overrides. Precedence is:
126
- # command line > environment variable > config file
133
+ # command line > config file > environment variable
127
134
  for key_name, args_parser_value, env_var_name in [
128
135
  (KEY, ARGS_PARSER.key, YD_KEY),
129
136
  (SECRET, ARGS_PARSER.secret, YD_SECRET),
@@ -137,7 +144,10 @@ def load_config_common() -> ConfigCommon:
137
144
  f"Using '{key_name}' provided on command line "
138
145
  "(or automatically set)"
139
146
  )
140
- elif os.environ.get(env_var_name, None) is not None:
147
+ elif (
148
+ common_section.get(key_name, None) is None
149
+ and os.environ.get(env_var_name, None) is not None
150
+ ):
141
151
  common_section[key_name] = os.environ[env_var_name]
142
152
  print_log(f"Using '{key_name}' provided via the environment")
143
153
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yellowdog-python-examples
3
- Version: 7.20.2
3
+ Version: 7.20.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__ = "7.20.2"