azureml-registry-tools 0.1.0a12__tar.gz → 0.1.0a14__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 (44) hide show
  1. {azureml_registry_tools-0.1.0a12/azureml_registry_tools.egg-info → azureml_registry_tools-0.1.0a14}/PKG-INFO +2 -2
  2. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/_cli/registry_syndication_cli.py +3 -1
  3. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/data/validate_model_schema.py +49 -11
  4. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/mgmt/asset_management.py +7 -4
  5. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14/azureml_registry_tools.egg-info}/PKG-INFO +2 -2
  6. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml_registry_tools.egg-info/requires.txt +1 -1
  7. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/setup.py +2 -2
  8. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/LICENSE.txt +0 -0
  9. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/MANIFEST.in +0 -0
  10. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/__init__.py +0 -0
  11. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/__init__.py +0 -0
  12. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/_cli/__init__.py +0 -0
  13. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/_cli/repo2registry_cli.py +0 -0
  14. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/_rest_client/__init__.py +0 -0
  15. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/_rest_client/arm_client.py +0 -0
  16. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/_rest_client/base_rest_client.py +0 -0
  17. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/_rest_client/registry_management_client.py +0 -0
  18. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/_rest_client/registry_model_client.py +0 -0
  19. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/data/__init__.py +0 -0
  20. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/data/asset.yaml.template +0 -0
  21. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/data/description.md.template +0 -0
  22. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/data/evaluation.md.template +0 -0
  23. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/data/model-variant.schema.json +0 -0
  24. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/data/model.schema.json +0 -0
  25. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/data/model.yaml.template +0 -0
  26. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/data/notes.md.template +0 -0
  27. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/data/validate_model_variant_schema.py +0 -0
  28. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/mgmt/__init__.py +0 -0
  29. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/mgmt/create_asset_template.py +0 -0
  30. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/mgmt/create_manifest.py +0 -0
  31. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/mgmt/create_model_spec.py +0 -0
  32. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/mgmt/model_management.py +0 -0
  33. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/mgmt/registry_config.py +0 -0
  34. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/mgmt/syndication_manifest.py +0 -0
  35. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/tools/__init__.py +0 -0
  36. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/tools/config.py +0 -0
  37. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/tools/create_or_update_assets.py +0 -0
  38. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/tools/registry_utils.py +0 -0
  39. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml/registry/tools/repo2registry_config.py +0 -0
  40. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml_registry_tools.egg-info/SOURCES.txt +0 -0
  41. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml_registry_tools.egg-info/dependency_links.txt +0 -0
  42. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml_registry_tools.egg-info/entry_points.txt +0 -0
  43. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/azureml_registry_tools.egg-info/top_level.txt +0 -0
  44. {azureml_registry_tools-0.1.0a12 → azureml_registry_tools-0.1.0a14}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: azureml-registry-tools
3
- Version: 0.1.0a12
3
+ Version: 0.1.0a14
4
4
  Summary: AzureML Registry tools and CLI
5
5
  Author: Microsoft Corp
6
6
  License: https://aka.ms/azureml-sdk-license
@@ -10,7 +10,7 @@ Requires-Dist: azure-identity<2.0
10
10
  Requires-Dist: ruamel-yaml<0.19,>=0.17.21
11
11
  Requires-Dist: diskcache~=5.6
12
12
  Requires-Dist: azure-ai-ml<2.0
13
- Requires-Dist: azureml-assets<=1.16.86
13
+ Requires-Dist: azureml-assets<2.0
14
14
  Dynamic: author
15
15
  Dynamic: license
16
16
  Dynamic: license-file
@@ -350,6 +350,8 @@ def main() -> None:
350
350
  asset_validate_parser = asset_subparsers.add_parser("validate", help="Validate an asset.")
351
351
  _add_common_args(asset_validate_parser, [dry_run_arg])
352
352
  asset_validate_parser.add_argument("--asset-path", type=Path, help="Path to the asset folder to validate.")
353
+ asset_validate_parser.add_argument("--allow-additional-properties", action="store_true",
354
+ help="Allow additional properties not defined in the schema")
353
355
 
354
356
  # asset deploy command
355
357
  asset_deploy_parser = asset_subparsers.add_parser("deploy", help="Deploy an asset to registry.")
@@ -447,7 +449,7 @@ def main() -> None:
447
449
  elif args.command == "asset":
448
450
  if args.asset_subcommand == "validate":
449
451
  # Config file is not needed for validation
450
- asset_validate(args.asset_path, args.dry_run)
452
+ asset_validate(args.asset_path, args.dry_run, args.allow_additional_properties)
451
453
  elif args.asset_subcommand == "deploy":
452
454
  # Config file is required for deployment
453
455
  asset_deploy(args.asset_path, args.config, args.dry_run)
@@ -2,37 +2,71 @@
2
2
  # Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  # ---------------------------------------------------------
4
4
 
5
- """Validate model variant schema."""
5
+ """Validate model schema."""
6
6
 
7
7
  import argparse
8
- import yaml
9
- import sys
10
8
  import jsonschema
9
+ import sys
10
+ import yaml
11
+
11
12
  from pathlib import Path
12
- from typing import List
13
+ from typing import Any, Dict, List
13
14
 
14
15
  import azureml.assets as assets
15
16
  import azureml.assets.util as util
16
17
  from azureml.assets.util import logger
17
18
 
18
19
 
20
+ def set_additional_properties_true(obj):
21
+ """Recursively set additionalProperties to True in a schema object."""
22
+ if isinstance(obj, dict):
23
+ if "additionalProperties" in obj:
24
+ obj["additionalProperties"] = True
25
+ for v in obj.values():
26
+ set_additional_properties_true(v)
27
+ elif isinstance(obj, list):
28
+ for item in obj:
29
+ set_additional_properties_true(item)
30
+
31
+
32
+ def load_schema(schema_file: Path, allow_additional_properties: bool = False) -> Dict[str, Any]:
33
+ """Load and optionally modify the schema to allow for additional properties.
34
+
35
+ Args:
36
+ schema_file (Path): Path to the schema file
37
+ allow_additional_properties (bool): Whether to allow additional properties not defined in the schema
38
+
39
+ Returns:
40
+ dict: Loaded model schema
41
+ """
42
+ # Load schema from file
43
+ with open(schema_file, 'r') as file:
44
+ schema = yaml.safe_load(file)
45
+
46
+ if allow_additional_properties:
47
+ logger.print('Allowing for additional properties, setting "additionalProperties: true" in the model schema')
48
+ set_additional_properties_true(schema)
49
+
50
+ return schema
51
+
52
+
19
53
  def validate_model_schema(input_dirs: List[Path],
20
54
  schema_file: Path,
21
- asset_config_filename: str) -> bool:
55
+ asset_config_filename: str,
56
+ allow_additional_properties: bool = False) -> bool:
22
57
  """Validate model variant schema.
23
58
 
24
59
  Args:
25
60
  input_dirs (List[Path]): Directories containing assets.
26
61
  schema_file (Path): File containing model variant schema.
27
62
  asset_config_filename (str): Asset config filename to search for.
63
+ allow_additional_properties (bool): Whether to allow additional properties not defined in schema.
28
64
 
29
65
  Returns:
30
66
  bool: True on success.
31
67
  """
32
68
  # Load model schema from file
33
- loaded_schema = {}
34
- with open(schema_file, 'r') as file:
35
- loaded_schema = yaml.safe_load(file)
69
+ loaded_schema = load_schema(schema_file, allow_additional_properties)
36
70
 
37
71
  # Create validator instance for collecting all errors
38
72
  validator = jsonschema.Draft7Validator(loaded_schema)
@@ -99,12 +133,15 @@ def validate_model_schema(input_dirs: List[Path],
99
133
 
100
134
  if __name__ == "__main__":
101
135
  # Handle command-line args
102
- parser = argparse.ArgumentParser()
136
+ parser = argparse.ArgumentParser(description="Validate model specifications against JSON schema")
103
137
  parser.add_argument("-i", "--input-dirs", required=True,
104
138
  help="Comma-separated list of directories containing assets")
105
- parser.add_argument("-m", "--schema-file", default=Path(__file__).parent / "model.schema.json", type=Path, help="Model Schema file")
139
+ parser.add_argument("-m", "--schema-file", default=Path(__file__).parent / "model.schema.json", type=Path,
140
+ help="Model Schema file")
106
141
  parser.add_argument("-a", "--asset-config-filename", default=assets.DEFAULT_ASSET_FILENAME,
107
142
  help="Asset config file name to search for")
143
+ parser.add_argument("--allow-additional-properties", action="store_true",
144
+ help="Allow additional properties not defined in the schema")
108
145
  args = parser.parse_args()
109
146
 
110
147
  # Convert comma-separated values to lists
@@ -113,7 +150,8 @@ if __name__ == "__main__":
113
150
  # Validate against model schema
114
151
  success = validate_model_schema(input_dirs=input_dirs,
115
152
  schema_file=args.schema_file,
116
- asset_config_filename=args.asset_config_filename)
153
+ asset_config_filename=args.asset_config_filename,
154
+ allow_additional_properties=args.allow_additional_properties)
117
155
 
118
156
  if not success:
119
157
  sys.exit(1)
@@ -39,11 +39,12 @@ from azureml.assets.publish_utils import create_asset # noqa: E402
39
39
  from azureml.assets.validate_assets import validate_assets # noqa: E402
40
40
 
41
41
 
42
- def validate_model(asset_path: Path) -> bool:
42
+ def validate_model(asset_path: Path, allow_additional_properties: bool = False) -> bool:
43
43
  """Validate model.
44
44
 
45
45
  Args:
46
46
  asset_path (Path): Path to the asset folder to validate
47
+ allow_additional_properties (bool): Whether to allow additional properties not defined in schema
47
48
 
48
49
  Returns:
49
50
  bool: True if validation passes, False otherwise
@@ -73,7 +74,8 @@ def validate_model(asset_path: Path) -> bool:
73
74
 
74
75
  print("⚙️ [VALIDATION #3]: Validating model schema...")
75
76
  if not validate_model_schema(input_dirs=[asset_path], schema_file=model_schema_file,
76
- asset_config_filename=assets.DEFAULT_ASSET_FILENAME):
77
+ asset_config_filename=assets.DEFAULT_ASSET_FILENAME,
78
+ allow_additional_properties=allow_additional_properties):
77
79
  print("❌ [FAILED] Validation #3: validate_model_schema\n")
78
80
  errors += 1
79
81
  else:
@@ -193,12 +195,13 @@ def create_or_update_asset(readonly_asset: AssetConfig, config: RegistryConfig):
193
195
  print(f" - Azure Portal link: https://ml.azure.com/registries/{config.registry_name}/models/{mutable_asset.name}/version/{mutable_asset.version}?tid={config.tenant_id}")
194
196
 
195
197
 
196
- def asset_validate(asset_path: Path, dry_run: bool = False) -> bool:
198
+ def asset_validate(asset_path: Path, dry_run: bool = False, allow_additional_properties: bool = False) -> bool:
197
199
  """Validate an asset at the specified path.
198
200
 
199
201
  Args:
200
202
  asset_path (Path): Path to the asset folder to validate
201
203
  dry_run (bool): If True, perform a dry run without side effects
204
+ allow_additional_properties (bool): Whether to allow additional properties not defined in schema
202
205
 
203
206
  Returns:
204
207
  bool: True if validation passes, False otherwise
@@ -231,7 +234,7 @@ def asset_validate(asset_path: Path, dry_run: bool = False) -> bool:
231
234
  return False
232
235
 
233
236
  # Perform validation
234
- return validate_model(readonly_asset.file_path)
237
+ return validate_model(readonly_asset.file_path, allow_additional_properties)
235
238
 
236
239
 
237
240
  def asset_deploy(asset_path: Path, config_path: Path, dry_run: bool = False) -> bool:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: azureml-registry-tools
3
- Version: 0.1.0a12
3
+ Version: 0.1.0a14
4
4
  Summary: AzureML Registry tools and CLI
5
5
  Author: Microsoft Corp
6
6
  License: https://aka.ms/azureml-sdk-license
@@ -10,7 +10,7 @@ Requires-Dist: azure-identity<2.0
10
10
  Requires-Dist: ruamel-yaml<0.19,>=0.17.21
11
11
  Requires-Dist: diskcache~=5.6
12
12
  Requires-Dist: azure-ai-ml<2.0
13
- Requires-Dist: azureml-assets<=1.16.86
13
+ Requires-Dist: azureml-assets<2.0
14
14
  Dynamic: author
15
15
  Dynamic: license
16
16
  Dynamic: license-file
@@ -2,4 +2,4 @@ azure-identity<2.0
2
2
  ruamel-yaml<0.19,>=0.17.21
3
3
  diskcache~=5.6
4
4
  azure-ai-ml<2.0
5
- azureml-assets<=1.16.86
5
+ azureml-assets<2.0
@@ -11,14 +11,14 @@ DEPENDENCIES = [
11
11
  "ruamel-yaml>=0.17.21,<0.19",
12
12
  "diskcache~=5.6",
13
13
  "azure-ai-ml<2.0",
14
- "azureml-assets<=1.16.86"
14
+ "azureml-assets<2.0"
15
15
  ]
16
16
 
17
17
  exclude_list = ["*.tests"]
18
18
 
19
19
  setup(
20
20
  name='azureml-registry-tools',
21
- version="0.1.0a12",
21
+ version="0.1.0a14",
22
22
  description='AzureML Registry tools and CLI',
23
23
  author='Microsoft Corp',
24
24
  license="https://aka.ms/azureml-sdk-license",