yellowdog-python-examples 7.20.0__tar.gz → 7.20.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 (79) hide show
  1. {yellowdog_python_examples-7.20.0/yellowdog_python_examples.egg-info → yellowdog_python_examples-7.20.2}/PKG-INFO +1 -1
  2. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/README.md +40 -27
  3. yellowdog_python_examples-7.20.2/yellowdog_cli/__init__.py +1 -0
  4. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/load_config.py +13 -0
  5. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/misc_utils.py +4 -2
  6. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/settings.py +5 -0
  7. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/variables.py +25 -3
  8. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2/yellowdog_python_examples.egg-info}/PKG-INFO +1 -1
  9. yellowdog_python_examples-7.20.0/yellowdog_cli/__init__.py +0 -1
  10. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/LICENSE +0 -0
  11. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/PYPI_README.md +0 -0
  12. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/pyproject.toml +0 -0
  13. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/requirements.txt +0 -0
  14. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/setup.cfg +0 -0
  15. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/tests/test_create_remove.py +0 -0
  16. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/tests/test_demos.py +0 -0
  17. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/tests/test_dryruns.py +0 -0
  18. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/tests/test_entrypoints.py +0 -0
  19. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/tests/test_gui.py +0 -0
  20. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/tests/test_list.py +0 -0
  21. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/tests/test_objects.py +0 -0
  22. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/tests/test_variable_processing.py +0 -0
  23. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/abort.py +0 -0
  24. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/admin.py +0 -0
  25. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/boost.py +0 -0
  26. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/cancel.py +0 -0
  27. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/cloudwizard.py +0 -0
  28. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/compare.py +0 -0
  29. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/create.py +0 -0
  30. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/delete.py +0 -0
  31. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/download.py +0 -0
  32. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/follow.py +0 -0
  33. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/format_json.py +0 -0
  34. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/hold.py +0 -0
  35. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/instantiate.py +0 -0
  36. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/jsonnet2json.py +0 -0
  37. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/list.py +0 -0
  38. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/provision.py +0 -0
  39. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/remove.py +0 -0
  40. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/resize.py +0 -0
  41. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/show.py +0 -0
  42. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/shutdown.py +0 -0
  43. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/start.py +0 -0
  44. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/submit.py +0 -0
  45. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/terminate.py +0 -0
  46. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/upload.py +0 -0
  47. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/__init__.py +0 -0
  48. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/args.py +0 -0
  49. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/check_imports.py +0 -0
  50. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/cloudwizard_aws.py +0 -0
  51. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/cloudwizard_aws_types.py +0 -0
  52. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/cloudwizard_azure.py +0 -0
  53. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/cloudwizard_common.py +0 -0
  54. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/cloudwizard_gcp.py +0 -0
  55. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/compact_json.py +0 -0
  56. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/config_types.py +0 -0
  57. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/csv_data.py +0 -0
  58. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/entity_utils.py +0 -0
  59. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/follow_utils.py +0 -0
  60. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/interactive.py +0 -0
  61. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/items.py +0 -0
  62. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/load_resources.py +0 -0
  63. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/printing.py +0 -0
  64. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/property_names.py +0 -0
  65. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/provision_utils.py +0 -0
  66. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/rich_console_input_fixed.py +0 -0
  67. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/start_hold_common.py +0 -0
  68. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/submit_utils.py +0 -0
  69. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/type_check.py +0 -0
  70. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/upload_utils.py +0 -0
  71. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/validate_properties.py +0 -0
  72. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/wrapper.py +0 -0
  73. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/utils/ydid_utils.py +0 -0
  74. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_cli/version.py +0 -0
  75. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_python_examples.egg-info/SOURCES.txt +0 -0
  76. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_python_examples.egg-info/dependency_links.txt +0 -0
  77. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_python_examples.egg-info/entry_points.txt +0 -0
  78. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.2}/yellowdog_python_examples.egg-info/requires.txt +0 -0
  79. {yellowdog_python_examples-7.20.0 → yellowdog_python_examples-7.20.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: 7.20.0
3
+ Version: 7.20.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
@@ -133,7 +133,7 @@
133
133
  * [yd-compare](#yd-compare)
134
134
 
135
135
  <!-- Created by https://github.com/ekalinin/github-markdown-toc -->
136
- <!-- Added by: pwt, at: Fri Aug 15 15:49:13 BST 2025 -->
136
+ <!-- Added by: pwt, at: Thu Oct 2 10:08:27 BST 2025 -->
137
137
 
138
138
  <!--te-->
139
139
 
@@ -235,39 +235,52 @@ Both of the installation methods above will install a number of **`yd-`** comman
235
235
  Commands are run from the command line. Invoking any command with the `--help` or `-h` option will display the command line options applicable to that command, e.g.:
236
236
 
237
237
  ```text
238
- % yd-cancel --help
239
- usage: yd-cancel [-h] [--docs] [--config <config_file.toml>] [--key <app-key>]
240
- [--secret <app-secret>] [--namespace <namespace>] [--tag <tag>] [--url <url>]
241
- [--variable <var1=v1>] [--quiet] [--debug] [--pac] [--abort] [--follow]
242
- [--interactive] [--yes]
238
+ % yd-cancel -h
239
+ usage: yd-cancel [-h] [--docs] [--config <config_file.toml>] [--key <app-key-id>] [--secret <app-key-secret>]
240
+ [--url <url>] [--debug] [--pac] [--no-format] [--quiet] [--env-override] [--print-pid]
241
+ [--variable <var1=v1>] [--namespace [<namespace>]] [--tag [<tag>]] [--abort] [--follow]
242
+ [--interactive] [--yes] [--raw-events]
243
+ [<work-requirement-name-or-ID> ...]
243
244
 
244
245
  YellowDog command line utility for cancelling Work Requirements
245
246
 
247
+ positional arguments:
248
+ <work-requirement-name-or-ID>
249
+ the name(s) or YellowDog ID(s) of the work requirement(s) to be cancelled; can also supply
250
+ task IDs
251
+
246
252
  optional arguments:
247
253
  -h, --help show this help message and exit
248
254
  --docs provide a link to the documentation for this version
249
255
  --config <config_file.toml>, -c <config_file.toml>
250
- configuration file in TOML format; default is 'config.toml' in the current
256
+ configuration file in TOML format; the default to use is 'config.toml' in the current
251
257
  directory
252
- --key <app-key>, -k <app-key>
253
- the YellowDog Application key
254
- --secret <app-secret>, -s <app-secret>
255
- the YellowDog Application secret
256
- --namespace <namespace>, -n <namespace>
257
- the namespace to use when creating and identifying entities
258
- --tag <tag>, -t <tag>
259
- the tag to use for tagging and naming entities
258
+ --key <app-key-id>, -k <app-key-id>
259
+ the application key ID
260
+ --secret <app-key-secret>, -s <app-key-secret>
261
+ the application key secret
260
262
  --url <url>, -u <url>
261
- the URL of the YellowDog Platform API
262
- --variable <var1=v1>, -v <var1=v1>
263
- user-defined variable substitutions; can be supplied multiple times
264
- --quiet, -q suppress (non-error, non-interactive) status and progress messages
265
- --debug print a stack trace (etc.) on error
263
+ the YellowDog Platform API URL (defaults to 'https://api.yellowdog.ai')
264
+ --debug display the Python stack trace on error
266
265
  --pac enable PAC (proxy auto-configuration) support
267
- --abort, -a abort all running tasks with immediate effect
268
- --follow, -f when using --abort, poll until all Tasks have been aborted
269
- --interactive, -i list, and interactively select, items to act on
270
- --yes, -y perform destructive actions without requiring user confirmation
266
+ --no-format, --nf disable colouring and text wrapping in command output
267
+ --quiet, -q suppress (non-error, non-interactive) status and progress messages
268
+ --env-override values in '.env' file override values in the environment
269
+ --print-pid, --pp include the process ID of this CLI invocation alongside timestamp in logging messages
270
+ --variable <var1=v1>, -v <var1=v1>
271
+ user-defined variable substitution; the option can be supplied multiple times, one per
272
+ variable
273
+ --namespace [<namespace>], -n [<namespace>]
274
+ the namespace to use when specifying entities; this is set to '' if the option is provided
275
+ without a value
276
+ --tag [<tag>], -t [<tag>], --prefix [<tag>]
277
+ the tag to use when naming, tagging, or selecting entities, or the prefix (directory) when
278
+ used with the object store; this is set to '' if the option is provided without a value
279
+ --abort, -a abort running tasks with immediate effect
280
+ --follow, -f follow progress after cancelling the work requirement(s)
281
+ --interactive, -i list, and interactively select, the items to act on
282
+ --yes, -y perform modifying/destructive actions without requiring user confirmation
283
+ --raw-events print the raw JSON event stream when following events
271
284
  ```
272
285
 
273
286
  # Configuration
@@ -376,11 +389,11 @@ These options can also be listed by running a command with the `--help` or `-h`
376
389
 
377
390
  The **environment variables** are as follows:
378
391
 
379
- - `YD_KEY`
380
- - `YD_SECRET`
392
+ - `YD_KEY` (or `YD_API_KEY_ID`)
393
+ - `YD_SECRET` (or `YD_API_KEY_SECRET`)
394
+ - `YD_URL` (or `YD_API_URL`)
381
395
  - `YD_NAMESPACE`
382
396
  - `YD_TAG`
383
- - `YD_URL`
384
397
 
385
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.
386
399
 
@@ -0,0 +1 @@
1
+ __version__ = "7.20.2"
@@ -33,10 +33,13 @@ from yellowdog_cli.utils.settings import (
33
33
  TASK_BATCH_SIZE_DEFAULT,
34
34
  TOML_VAR_NESTED_DEPTH,
35
35
  YD_KEY,
36
+ YD_KEY_ALT,
36
37
  YD_NAMESPACE,
37
38
  YD_SECRET,
39
+ YD_SECRET_ALT,
38
40
  YD_TAG,
39
41
  YD_URL,
42
+ YD_URL_ALT,
40
43
  )
41
44
  from yellowdog_cli.utils.type_check import check_list, check_str
42
45
  from yellowdog_cli.utils.validate_properties import validate_properties
@@ -48,6 +51,16 @@ from yellowdog_cli.utils.variables import (
48
51
  process_variable_substitutions_insitu,
49
52
  )
50
53
 
54
+ # Support for alternative common env. vars; written into the normal vars.
55
+ for norm, alt in [
56
+ (YD_KEY, YD_KEY_ALT),
57
+ (YD_SECRET, YD_SECRET_ALT),
58
+ (YD_URL, YD_URL_ALT),
59
+ ]:
60
+ if os.getenv(norm) is None and os.getenv(alt) is not None:
61
+ os.environ[norm] = os.getenv(alt)
62
+ print_log(f"Setting environment variable '{norm}' using value of '{alt}'")
63
+
51
64
  # CLI > YD_CONF > 'config.toml'
52
65
  CONFIG_FILE = relpath(
53
66
  getenv("YD_CONF", "config.toml")
@@ -252,10 +252,12 @@ def load_dotenv_file():
252
252
  unless --env-override option is set.
253
253
  Report on YD vars that are taken from .env.
254
254
  """
255
- dotenv_file = find_dotenv()
255
+ dotenv_file = find_dotenv(usecwd=True)
256
256
  if dotenv_file == "":
257
257
  return
258
258
 
259
+ print_log(f"Loading environment variables from '{dotenv_file}'")
260
+
259
261
  dotenv_yd_substitutions = [ # Find 'YD' variables
260
262
  f"'{key}'"
261
263
  for key in dotenv_values(dotenv_file).keys()
@@ -265,7 +267,7 @@ def load_dotenv_file():
265
267
 
266
268
  if len(dotenv_yd_substitutions) > 0:
267
269
  print_log(
268
- f"Adding 'YD' environment variables from '.env' file '{dotenv_file}': "
270
+ "Adding 'YD' environment variable(s): "
269
271
  f"{', '.join(dotenv_yd_substitutions)}"
270
272
  )
271
273
 
@@ -13,6 +13,11 @@ YD_ENV_VAR_PREFIX = "YD_VAR_"
13
13
  ENV_VAR_SUB_PREFIX = "env:"
14
14
  RAND_VAR_SIZE = 0xFFF
15
15
 
16
+ # Alternative env.var names
17
+ YD_KEY_ALT = "YD_API_KEY_ID"
18
+ YD_SECRET_ALT = "YD_API_KEY_SECRET"
19
+ YD_URL_ALT = "YD_API_URL"
20
+
16
21
  TASK_BATCH_SIZE_DEFAULT = 1000
17
22
  MAX_PARALLEL_TASK_BATCH_UPLOAD_THREADS = 1
18
23
  MAX_BATCH_SUBMIT_ATTEMPTS = 4 # Initial attempt plus retries
@@ -294,11 +294,33 @@ def process_untyped_variable_substitutions(
294
294
  var_name = input_string.replace(
295
295
  f"{opening_delimiter}{ENV_VAR_SUB_PREFIX}", ""
296
296
  ).replace(closing_delimiter, "")
297
+ if VAR_DEFAULT_SEPARATOR in var_name: # Check for a default
298
+ split_result = var_name.split(VAR_DEFAULT_SEPARATOR)
299
+ if split_result[0] == "" or len(split_result) != 2:
300
+ raise Exception(
301
+ f"Malformed '<variable>:=<default>' substitution: '{var_name}'"
302
+ )
303
+ var_name, var_default = split_result
304
+ else:
305
+ var_default = None
297
306
  var = os.getenv(var_name, None)
298
- if var is not None:
307
+ if var is not None: # Matching environment variable
308
+ if var_default is None: # Just replace the prefix and the variable name
309
+ input_string = input_string.replace(
310
+ f"{opening_delimiter}{ENV_VAR_SUB_PREFIX}{var_name}{closing_delimiter}",
311
+ var,
312
+ )
313
+ else: # Also replace the default separator & value
314
+ input_string = input_string.replace(
315
+ f"{opening_delimiter}{ENV_VAR_SUB_PREFIX}{var_name}"
316
+ f"{VAR_DEFAULT_SEPARATOR}{var_default}{closing_delimiter}",
317
+ var,
318
+ )
319
+ elif var_default is not None: # Variable not found, but default exists
299
320
  input_string = input_string.replace(
300
- f"{opening_delimiter}{ENV_VAR_SUB_PREFIX}{var_name}{closing_delimiter}",
301
- var,
321
+ f"{opening_delimiter}{ENV_VAR_SUB_PREFIX}{var_name}"
322
+ f"{VAR_DEFAULT_SEPARATOR}{var_default}{closing_delimiter}",
323
+ var_default,
302
324
  )
303
325
 
304
326
  # Create list of variable substitutions with their default values
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yellowdog-python-examples
3
- Version: 7.20.0
3
+ Version: 7.20.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
@@ -1 +0,0 @@
1
- __version__ = "7.20.0"