amapy 1.0.0__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 (119) hide show
  1. amapy-1.0.0/PKG-INFO +21 -0
  2. amapy-1.0.0/README.md +1 -0
  3. amapy-1.0.0/amapy.egg-info/PKG-INFO +21 -0
  4. amapy-1.0.0/amapy.egg-info/SOURCES.txt +117 -0
  5. amapy-1.0.0/amapy.egg-info/dependency_links.txt +1 -0
  6. amapy-1.0.0/amapy.egg-info/entry_points.txt +3 -0
  7. amapy-1.0.0/amapy.egg-info/requires.txt +10 -0
  8. amapy-1.0.0/amapy.egg-info/top_level.txt +1 -0
  9. amapy-1.0.0/asset_manager/__init__.py +4 -0
  10. amapy-1.0.0/asset_manager/app.py +18 -0
  11. amapy-1.0.0/asset_manager/app_debug.py +27 -0
  12. amapy-1.0.0/asset_manager/arg_parse.py +48 -0
  13. amapy-1.0.0/asset_manager/commands/__init__.py +3 -0
  14. amapy-1.0.0/asset_manager/commands/alias_actions/__init__.py +29 -0
  15. amapy-1.0.0/asset_manager/commands/alias_actions/alias_add.py +27 -0
  16. amapy-1.0.0/asset_manager/commands/alias_actions/alias_help.py +17 -0
  17. amapy-1.0.0/asset_manager/commands/alias_actions/alias_info.py +15 -0
  18. amapy-1.0.0/asset_manager/commands/alias_actions/alias_remove.py +15 -0
  19. amapy-1.0.0/asset_manager/commands/alias_actions/alias_set.py +25 -0
  20. amapy-1.0.0/asset_manager/commands/asset_actions/__init__.py +66 -0
  21. amapy-1.0.0/asset_manager/commands/asset_actions/add.py +72 -0
  22. amapy-1.0.0/asset_manager/commands/asset_actions/clone.py +100 -0
  23. amapy-1.0.0/asset_manager/commands/asset_actions/commit.py +27 -0
  24. amapy-1.0.0/asset_manager/commands/asset_actions/cp.py +59 -0
  25. amapy-1.0.0/asset_manager/commands/asset_actions/dashboard.py +17 -0
  26. amapy-1.0.0/asset_manager/commands/asset_actions/debug.py +20 -0
  27. amapy-1.0.0/asset_manager/commands/asset_actions/delete.py +25 -0
  28. amapy-1.0.0/asset_manager/commands/asset_actions/diff.py +39 -0
  29. amapy-1.0.0/asset_manager/commands/asset_actions/discard.py +46 -0
  30. amapy-1.0.0/asset_manager/commands/asset_actions/download.py +32 -0
  31. amapy-1.0.0/asset_manager/commands/asset_actions/fetch.py +71 -0
  32. amapy-1.0.0/asset_manager/commands/asset_actions/find.py +50 -0
  33. amapy-1.0.0/asset_manager/commands/asset_actions/hash.py +25 -0
  34. amapy-1.0.0/asset_manager/commands/asset_actions/history.py +26 -0
  35. amapy-1.0.0/asset_manager/commands/asset_actions/info.py +89 -0
  36. amapy-1.0.0/asset_manager/commands/asset_actions/init.py +27 -0
  37. amapy-1.0.0/asset_manager/commands/asset_actions/list.py +50 -0
  38. amapy-1.0.0/asset_manager/commands/asset_actions/pull.py +23 -0
  39. amapy-1.0.0/asset_manager/commands/asset_actions/remote.py +15 -0
  40. amapy-1.0.0/asset_manager/commands/asset_actions/remove.py +41 -0
  41. amapy-1.0.0/asset_manager/commands/asset_actions/report.py +45 -0
  42. amapy-1.0.0/asset_manager/commands/asset_actions/restore.py +21 -0
  43. amapy-1.0.0/asset_manager/commands/asset_actions/status.py +17 -0
  44. amapy-1.0.0/asset_manager/commands/asset_actions/switch.py +37 -0
  45. amapy-1.0.0/asset_manager/commands/asset_actions/tests/__init__.py +0 -0
  46. amapy-1.0.0/asset_manager/commands/asset_actions/tests/test_add.py +24 -0
  47. amapy-1.0.0/asset_manager/commands/asset_actions/tests/test_asset_cmds.py +57 -0
  48. amapy-1.0.0/asset_manager/commands/asset_actions/tests/test_info.py +0 -0
  49. amapy-1.0.0/asset_manager/commands/asset_actions/tree.py +23 -0
  50. amapy-1.0.0/asset_manager/commands/asset_actions/union.py +31 -0
  51. amapy-1.0.0/asset_manager/commands/asset_actions/update.py +35 -0
  52. amapy-1.0.0/asset_manager/commands/asset_actions/upload.py +22 -0
  53. amapy-1.0.0/asset_manager/commands/asset_actions/user_prompt_setting.py +24 -0
  54. amapy-1.0.0/asset_manager/commands/asset_actions/versions.py +21 -0
  55. amapy-1.0.0/asset_manager/commands/asset_class_actions/__init__.py +31 -0
  56. amapy-1.0.0/asset_manager/commands/asset_class_actions/discard.py +20 -0
  57. amapy-1.0.0/asset_manager/commands/asset_class_actions/fetch.py +16 -0
  58. amapy-1.0.0/asset_manager/commands/asset_class_actions/info.py +31 -0
  59. amapy-1.0.0/asset_manager/commands/asset_class_actions/init.py +21 -0
  60. amapy-1.0.0/asset_manager/commands/asset_class_actions/list.py +22 -0
  61. amapy-1.0.0/asset_manager/commands/asset_class_actions/rename.py +25 -0
  62. amapy-1.0.0/asset_manager/commands/asset_class_actions/tests/__init__.py +0 -0
  63. amapy-1.0.0/asset_manager/commands/asset_class_actions/tests/test_asset_class_actions.py +9 -0
  64. amapy-1.0.0/asset_manager/commands/asset_class_actions/upload.py +21 -0
  65. amapy-1.0.0/asset_manager/commands/auth_actions/__init__.py +33 -0
  66. amapy-1.0.0/asset_manager/commands/auth_actions/auth_info.py +24 -0
  67. amapy-1.0.0/asset_manager/commands/auth_actions/auth_login.py +25 -0
  68. amapy-1.0.0/asset_manager/commands/auth_actions/auth_logout.py +16 -0
  69. amapy-1.0.0/asset_manager/commands/auth_actions/auth_remove.py +16 -0
  70. amapy-1.0.0/asset_manager/commands/auth_actions/auth_set.py +64 -0
  71. amapy-1.0.0/asset_manager/commands/auth_actions/auth_signup.py +33 -0
  72. amapy-1.0.0/asset_manager/commands/auth_actions/auth_update.py +17 -0
  73. amapy-1.0.0/asset_manager/commands/base_action.py +78 -0
  74. amapy-1.0.0/asset_manager/commands/cli_action.py +30 -0
  75. amapy-1.0.0/asset_manager/commands/cli_option.py +43 -0
  76. amapy-1.0.0/asset_manager/commands/cmd_group.py +47 -0
  77. amapy-1.0.0/asset_manager/commands/config_actions/__init__.py +25 -0
  78. amapy-1.0.0/asset_manager/commands/config_actions/config_info.py +16 -0
  79. amapy-1.0.0/asset_manager/commands/config_actions/reset_configs.py +24 -0
  80. amapy-1.0.0/asset_manager/commands/config_actions/set_configs.py +31 -0
  81. amapy-1.0.0/asset_manager/commands/package_actions/__init__.py +21 -0
  82. amapy-1.0.0/asset_manager/commands/package_actions/info.py +15 -0
  83. amapy-1.0.0/asset_manager/commands/parser.py +89 -0
  84. amapy-1.0.0/asset_manager/commands/project_actions/__init__.py +25 -0
  85. amapy-1.0.0/asset_manager/commands/project_actions/project_activate.py +25 -0
  86. amapy-1.0.0/asset_manager/commands/project_actions/project_info.py +15 -0
  87. amapy-1.0.0/asset_manager/commands/project_actions/project_list.py +15 -0
  88. amapy-1.0.0/asset_manager/commands/refs_actions/__init__.py +22 -0
  89. amapy-1.0.0/asset_manager/commands/refs_actions/ref_add.py +64 -0
  90. amapy-1.0.0/asset_manager/commands/refs_actions/ref_info.py +58 -0
  91. amapy-1.0.0/asset_manager/commands/refs_actions/ref_remove.py +27 -0
  92. amapy-1.0.0/asset_manager/commands/store_actions/__init__.py +27 -0
  93. amapy-1.0.0/asset_manager/commands/store_actions/store_clear.py +23 -0
  94. amapy-1.0.0/asset_manager/commands/store_actions/store_info.py +15 -0
  95. amapy-1.0.0/asset_manager/commands/store_actions/store_prune.py +15 -0
  96. amapy-1.0.0/asset_manager/commands/store_actions/store_set.py +27 -0
  97. amapy-1.0.0/asset_manager/commands/tests/__init__.py +0 -0
  98. amapy-1.0.0/asset_manager/commands/tests/test_cli_arg.py +8 -0
  99. amapy-1.0.0/asset_manager/commands/tests/test_cmd_group.py +10 -0
  100. amapy-1.0.0/asset_manager/commands/tests/test_parser.py +42 -0
  101. amapy-1.0.0/asset_manager/plugins.py +29 -0
  102. amapy-1.0.0/asset_manager/python_api/__init__.py +0 -0
  103. amapy-1.0.0/asset_manager/python_api/artifact.py +670 -0
  104. amapy-1.0.0/asset_manager/python_api/artifact_ref.py +74 -0
  105. amapy-1.0.0/asset_manager/python_api/asset.py +265 -0
  106. amapy-1.0.0/asset_manager/python_api/auth.py +71 -0
  107. amapy-1.0.0/asset_manager/python_api/config.py +44 -0
  108. amapy-1.0.0/asset_manager/python_api/file.py +21 -0
  109. amapy-1.0.0/asset_manager/python_api/inputs.py +139 -0
  110. amapy-1.0.0/asset_manager/python_api/klass.py +50 -0
  111. amapy-1.0.0/asset_manager/python_api/project.py +53 -0
  112. amapy-1.0.0/asset_manager/python_api/store.py +39 -0
  113. amapy-1.0.0/asset_manager/python_api/tests/__init__.py +0 -0
  114. amapy-1.0.0/asset_manager/python_api/tests/test_artifact.py +110 -0
  115. amapy-1.0.0/asset_manager/python_api/tests/test_auth.py +37 -0
  116. amapy-1.0.0/asset_manager/python_api/tests/test_klass.py +16 -0
  117. amapy-1.0.0/asset_manager/python_api/tests/test_project.py +18 -0
  118. amapy-1.0.0/pyproject.toml +37 -0
  119. amapy-1.0.0/setup.cfg +4 -0
amapy-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.1
2
+ Name: amapy
3
+ Version: 1.0.0
4
+ Summary: The client side tool for asset-manager. It provides a command-line interface and a Python API for programmatic access to manage and distribute digital assets.
5
+ Author-email: Swarup Mahanti <swarup.mahanti@roche.com>
6
+ Maintainer-email: Swarup Mahanti <swarup.mahanti@roche.com>
7
+ License: Copyright (c) 2024 Roche Diagnostics Computation Science & Informatics
8
+ Requires-Python: <3.11,>=3.10
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: amapy-contents==1.0.0
11
+ Requires-Dist: amapy-core==1.0.0
12
+ Requires-Dist: amapy-db==1.0.0
13
+ Requires-Dist: amapy-pluggy==1.0.0
14
+ Requires-Dist: amapy-plugin-gcr==1.0.0
15
+ Requires-Dist: amapy-plugin-gcs==1.0.0
16
+ Requires-Dist: amapy-plugin-posix==1.0.0
17
+ Requires-Dist: amapy-plugin-s3==1.0.0
18
+ Requires-Dist: amapy-utils==1.0.0
19
+ Requires-Dist: markupsafe==2.1.*
20
+
21
+ asset-manager
amapy-1.0.0/README.md ADDED
@@ -0,0 +1 @@
1
+ asset-manager
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.1
2
+ Name: amapy
3
+ Version: 1.0.0
4
+ Summary: The client side tool for asset-manager. It provides a command-line interface and a Python API for programmatic access to manage and distribute digital assets.
5
+ Author-email: Swarup Mahanti <swarup.mahanti@roche.com>
6
+ Maintainer-email: Swarup Mahanti <swarup.mahanti@roche.com>
7
+ License: Copyright (c) 2024 Roche Diagnostics Computation Science & Informatics
8
+ Requires-Python: <3.11,>=3.10
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: amapy-contents==1.0.0
11
+ Requires-Dist: amapy-core==1.0.0
12
+ Requires-Dist: amapy-db==1.0.0
13
+ Requires-Dist: amapy-pluggy==1.0.0
14
+ Requires-Dist: amapy-plugin-gcr==1.0.0
15
+ Requires-Dist: amapy-plugin-gcs==1.0.0
16
+ Requires-Dist: amapy-plugin-posix==1.0.0
17
+ Requires-Dist: amapy-plugin-s3==1.0.0
18
+ Requires-Dist: amapy-utils==1.0.0
19
+ Requires-Dist: markupsafe==2.1.*
20
+
21
+ asset-manager
@@ -0,0 +1,117 @@
1
+ README.md
2
+ pyproject.toml
3
+ amapy.egg-info/PKG-INFO
4
+ amapy.egg-info/SOURCES.txt
5
+ amapy.egg-info/dependency_links.txt
6
+ amapy.egg-info/entry_points.txt
7
+ amapy.egg-info/requires.txt
8
+ amapy.egg-info/top_level.txt
9
+ asset_manager/__init__.py
10
+ asset_manager/app.py
11
+ asset_manager/app_debug.py
12
+ asset_manager/arg_parse.py
13
+ asset_manager/plugins.py
14
+ asset_manager/commands/__init__.py
15
+ asset_manager/commands/base_action.py
16
+ asset_manager/commands/cli_action.py
17
+ asset_manager/commands/cli_option.py
18
+ asset_manager/commands/cmd_group.py
19
+ asset_manager/commands/parser.py
20
+ asset_manager/commands/alias_actions/__init__.py
21
+ asset_manager/commands/alias_actions/alias_add.py
22
+ asset_manager/commands/alias_actions/alias_help.py
23
+ asset_manager/commands/alias_actions/alias_info.py
24
+ asset_manager/commands/alias_actions/alias_remove.py
25
+ asset_manager/commands/alias_actions/alias_set.py
26
+ asset_manager/commands/asset_actions/__init__.py
27
+ asset_manager/commands/asset_actions/add.py
28
+ asset_manager/commands/asset_actions/clone.py
29
+ asset_manager/commands/asset_actions/commit.py
30
+ asset_manager/commands/asset_actions/cp.py
31
+ asset_manager/commands/asset_actions/dashboard.py
32
+ asset_manager/commands/asset_actions/debug.py
33
+ asset_manager/commands/asset_actions/delete.py
34
+ asset_manager/commands/asset_actions/diff.py
35
+ asset_manager/commands/asset_actions/discard.py
36
+ asset_manager/commands/asset_actions/download.py
37
+ asset_manager/commands/asset_actions/fetch.py
38
+ asset_manager/commands/asset_actions/find.py
39
+ asset_manager/commands/asset_actions/hash.py
40
+ asset_manager/commands/asset_actions/history.py
41
+ asset_manager/commands/asset_actions/info.py
42
+ asset_manager/commands/asset_actions/init.py
43
+ asset_manager/commands/asset_actions/list.py
44
+ asset_manager/commands/asset_actions/pull.py
45
+ asset_manager/commands/asset_actions/remote.py
46
+ asset_manager/commands/asset_actions/remove.py
47
+ asset_manager/commands/asset_actions/report.py
48
+ asset_manager/commands/asset_actions/restore.py
49
+ asset_manager/commands/asset_actions/status.py
50
+ asset_manager/commands/asset_actions/switch.py
51
+ asset_manager/commands/asset_actions/tree.py
52
+ asset_manager/commands/asset_actions/union.py
53
+ asset_manager/commands/asset_actions/update.py
54
+ asset_manager/commands/asset_actions/upload.py
55
+ asset_manager/commands/asset_actions/user_prompt_setting.py
56
+ asset_manager/commands/asset_actions/versions.py
57
+ asset_manager/commands/asset_actions/tests/__init__.py
58
+ asset_manager/commands/asset_actions/tests/test_add.py
59
+ asset_manager/commands/asset_actions/tests/test_asset_cmds.py
60
+ asset_manager/commands/asset_actions/tests/test_info.py
61
+ asset_manager/commands/asset_class_actions/__init__.py
62
+ asset_manager/commands/asset_class_actions/discard.py
63
+ asset_manager/commands/asset_class_actions/fetch.py
64
+ asset_manager/commands/asset_class_actions/info.py
65
+ asset_manager/commands/asset_class_actions/init.py
66
+ asset_manager/commands/asset_class_actions/list.py
67
+ asset_manager/commands/asset_class_actions/rename.py
68
+ asset_manager/commands/asset_class_actions/upload.py
69
+ asset_manager/commands/asset_class_actions/tests/__init__.py
70
+ asset_manager/commands/asset_class_actions/tests/test_asset_class_actions.py
71
+ asset_manager/commands/auth_actions/__init__.py
72
+ asset_manager/commands/auth_actions/auth_info.py
73
+ asset_manager/commands/auth_actions/auth_login.py
74
+ asset_manager/commands/auth_actions/auth_logout.py
75
+ asset_manager/commands/auth_actions/auth_remove.py
76
+ asset_manager/commands/auth_actions/auth_set.py
77
+ asset_manager/commands/auth_actions/auth_signup.py
78
+ asset_manager/commands/auth_actions/auth_update.py
79
+ asset_manager/commands/config_actions/__init__.py
80
+ asset_manager/commands/config_actions/config_info.py
81
+ asset_manager/commands/config_actions/reset_configs.py
82
+ asset_manager/commands/config_actions/set_configs.py
83
+ asset_manager/commands/package_actions/__init__.py
84
+ asset_manager/commands/package_actions/info.py
85
+ asset_manager/commands/project_actions/__init__.py
86
+ asset_manager/commands/project_actions/project_activate.py
87
+ asset_manager/commands/project_actions/project_info.py
88
+ asset_manager/commands/project_actions/project_list.py
89
+ asset_manager/commands/refs_actions/__init__.py
90
+ asset_manager/commands/refs_actions/ref_add.py
91
+ asset_manager/commands/refs_actions/ref_info.py
92
+ asset_manager/commands/refs_actions/ref_remove.py
93
+ asset_manager/commands/store_actions/__init__.py
94
+ asset_manager/commands/store_actions/store_clear.py
95
+ asset_manager/commands/store_actions/store_info.py
96
+ asset_manager/commands/store_actions/store_prune.py
97
+ asset_manager/commands/store_actions/store_set.py
98
+ asset_manager/commands/tests/__init__.py
99
+ asset_manager/commands/tests/test_cli_arg.py
100
+ asset_manager/commands/tests/test_cmd_group.py
101
+ asset_manager/commands/tests/test_parser.py
102
+ asset_manager/python_api/__init__.py
103
+ asset_manager/python_api/artifact.py
104
+ asset_manager/python_api/artifact_ref.py
105
+ asset_manager/python_api/asset.py
106
+ asset_manager/python_api/auth.py
107
+ asset_manager/python_api/config.py
108
+ asset_manager/python_api/file.py
109
+ asset_manager/python_api/inputs.py
110
+ asset_manager/python_api/klass.py
111
+ asset_manager/python_api/project.py
112
+ asset_manager/python_api/store.py
113
+ asset_manager/python_api/tests/__init__.py
114
+ asset_manager/python_api/tests/test_artifact.py
115
+ asset_manager/python_api/tests/test_auth.py
116
+ asset_manager/python_api/tests/test_klass.py
117
+ asset_manager/python_api/tests/test_project.py
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ ama = asset_manager.app:run
3
+ asset = asset_manager.app:run
@@ -0,0 +1,10 @@
1
+ amapy-contents==1.0.0
2
+ amapy-core==1.0.0
3
+ amapy-db==1.0.0
4
+ amapy-pluggy==1.0.0
5
+ amapy-plugin-gcr==1.0.0
6
+ amapy-plugin-gcs==1.0.0
7
+ amapy-plugin-posix==1.0.0
8
+ amapy-plugin-s3==1.0.0
9
+ amapy-utils==1.0.0
10
+ markupsafe==2.1.*
@@ -0,0 +1 @@
1
+ asset_manager
@@ -0,0 +1,4 @@
1
+ from .python_api import asset
2
+ from .python_api.artifact import Artifact
3
+ from .python_api.inputs import ArtifactInputs
4
+ from .python_api.artifact_ref import ArtifactRef
@@ -0,0 +1,18 @@
1
+ import sys
2
+
3
+ from asset_core.configs.config_modes import ConfigModes
4
+ from asset_manager.arg_parse import get_parser
5
+ from asset_manager.plugins import register_plugins
6
+
7
+ # change to ConfigModes.PRODUCTION for asset-manager
8
+ # change to ConfigModes.USER_TEST for asset-sandbox
9
+ ACTIVE_CONFIG_MODE = ConfigModes.DEV
10
+
11
+
12
+ def run():
13
+ register_plugins()
14
+ get_parser(mode=ACTIVE_CONFIG_MODE).run(sys.argv[1:])
15
+
16
+
17
+ if __name__ == '__main__':
18
+ run()
@@ -0,0 +1,27 @@
1
+ """
2
+ app wrapper for triggering from IDE run configuration
3
+ """
4
+ import os
5
+
6
+ from asset_core.configs.config_modes import ConfigModes
7
+ from asset_manager.app import run, get_parser
8
+ from asset_utils import common
9
+
10
+
11
+ def main():
12
+ print("----THIS IS THE APP WRAPPER RUNNING FROM LOCAL CODEBASE----")
13
+ if common.DEBUG:
14
+ # temporary work around so that we can mock command line from pycharm run configurations
15
+ args, unknown = get_parser(mode=ConfigModes.USER_TEST).parse_args()
16
+ if unknown and unknown[0] == "--asset_dir":
17
+ debug_dir = unknown[1]
18
+ else:
19
+ debug_dir = ""
20
+ os.makedirs(debug_dir, exist_ok=True)
21
+ os.chdir(debug_dir)
22
+
23
+ run()
24
+
25
+
26
+ if __name__ == "__main__":
27
+ main()
@@ -0,0 +1,48 @@
1
+ import subprocess
2
+
3
+ from asset_core.configs import configs
4
+ from asset_manager.commands.alias_actions import get_action_group as alias_group
5
+ from asset_manager.commands.asset_actions import get_actions as asset_actions
6
+ from asset_manager.commands.asset_class_actions import get_action_group as class_group
7
+ from asset_manager.commands.auth_actions import get_action_group as auth_group
8
+ from asset_manager.commands.config_actions import get_action_group as configs_group
9
+ from asset_manager.commands.package_actions import get_action_group as package_group
10
+ from asset_manager.commands.parser import CommandParser
11
+ from asset_manager.commands.project_actions import get_action_group as projects_group
12
+ from asset_manager.commands.refs_actions import get_action_group as refs_group
13
+ from asset_manager.commands.store_actions import get_action_group as home_group
14
+ from asset_pluggy.storage.storage_factory import StorageFactory
15
+
16
+
17
+ def get_parser(mode: configs.ConfigModes = None) -> CommandParser:
18
+ # turn_off_globbing()
19
+ mode = mode or configs.DEFAULT_MODE
20
+ configs.Configs.shared(mode=mode)
21
+ parser = CommandParser()
22
+ parser.add_actions(*asset_actions())
23
+ parser.add_action_groups(class_group(),
24
+ auth_group(),
25
+ home_group(),
26
+ refs_group(),
27
+ projects_group(),
28
+ alias_group(),
29
+ package_group(),
30
+ configs_group()
31
+ )
32
+ return parser
33
+
34
+
35
+ def turn_off_globbing():
36
+ """turn off globbing - this is temp fix instead of adding alias to .bashrc or .zshrc
37
+ it assumes that the user will use atleast another asset command before passing a glob string
38
+
39
+ Returns
40
+ -------
41
+ """
42
+ subprocess.run(["set", "-o", "noglob"], check=True, text=True, shell=True)
43
+
44
+
45
+ def print_storages():
46
+ prefixes = ["gs://", "s3://", "gcr.io/", "us.gcr.io/", "file://"]
47
+ for prefix in prefixes:
48
+ print(f"{prefix}: {StorageFactory.storage_with_prefix(prefix=prefix)}")
@@ -0,0 +1,3 @@
1
+ from .cli_option import CliOption
2
+ from .cli_action import CliAction
3
+ from .cmd_group import CommandGroup
@@ -0,0 +1,29 @@
1
+ from asset_manager.commands.cmd_group import CommandGroup
2
+ from .alias_add import AddAlias
3
+ from .alias_help import AliasHelp
4
+ from .alias_info import AliasInfo
5
+ from .alias_remove import RemoveAlias
6
+ from .alias_set import SetAlias
7
+
8
+
9
+ def get_actions():
10
+ return [
11
+ SetAlias(),
12
+ AddAlias(),
13
+ RemoveAlias(),
14
+ AliasInfo(),
15
+ AliasHelp()
16
+ ]
17
+
18
+
19
+ def get_action_group():
20
+ group = CommandGroup(name="alias",
21
+ help="asset-manager alias commands",
22
+ description="asset-manager alias commands",
23
+ actions=get_actions(),
24
+ default_action=AliasInfo()
25
+ )
26
+ group.requires_store = True
27
+ group.requires_repo = True
28
+ group.requires_auth = True
29
+ return group
@@ -0,0 +1,27 @@
1
+ from asset_core.api.repo_api import AssetAPI
2
+ from asset_manager.commands import CliAction, CliOption
3
+ from asset_utils.utils.log_utils import LogColors
4
+
5
+
6
+ class AddAlias(CliAction):
7
+ name = "add"
8
+ help_msg = "add alias to asset"
9
+
10
+ def run(self, args):
11
+ self.user_log.alert("'asset alias add' is getting deprecated. Please use 'asset alias set' instead.")
12
+ api = AssetAPI(self.repo).add
13
+ if not args.target:
14
+ self.user_log.message("missing required parameter <alias>", color=LogColors.ERROR)
15
+ return
16
+ with api.environment():
17
+ api.add_alias(args.target)
18
+
19
+ def get_options(self) -> [CliOption]:
20
+ return [
21
+ CliOption(
22
+ dest="target",
23
+ help_msg="alias name",
24
+ n_args="?",
25
+ positional=True
26
+ )
27
+ ]
@@ -0,0 +1,17 @@
1
+ from asset_manager.commands import CliAction, CliOption
2
+ from asset_utils.common.user_commands import UserCommands
3
+
4
+
5
+ class AliasHelp(CliAction):
6
+ name = "help"
7
+ help_msg = "information on alias commands"
8
+
9
+ def run(self, args):
10
+ msg = "alias commands:\n"
11
+ msg += f"{UserCommands().alias_set()}\n"
12
+ msg += f"{UserCommands().alias_remove()}\n"
13
+ msg += f"{UserCommands().alias_info()}\n"
14
+ self.user_log.message(msg)
15
+
16
+ def get_options(self) -> [CliOption]:
17
+ return []
@@ -0,0 +1,15 @@
1
+ from asset_core.api.repo_api import AssetAPI
2
+ from asset_manager.commands import CliAction, CliOption
3
+
4
+
5
+ class AliasInfo(CliAction):
6
+ name = "info"
7
+ help_msg = "view information on asset alias"
8
+
9
+ def run(self, args):
10
+ api = AssetAPI(self.repo).info
11
+ with api.environment():
12
+ api.list_alias()
13
+
14
+ def get_options(self) -> [CliOption]:
15
+ return []
@@ -0,0 +1,15 @@
1
+ from asset_core.api.repo_api import AssetAPI
2
+ from asset_manager.commands import CliAction, CliOption
3
+
4
+
5
+ class RemoveAlias(CliAction):
6
+ name = "remove"
7
+ help_msg = "remove alias from asset"
8
+
9
+ def run(self, args):
10
+ api = AssetAPI(self.repo).remove
11
+ with api.environment():
12
+ api.remove_alias()
13
+
14
+ def get_options(self) -> [CliOption]:
15
+ return []
@@ -0,0 +1,25 @@
1
+ from asset_core.api.repo_api import AssetAPI
2
+ from asset_manager.commands import CliAction, CliOption
3
+
4
+
5
+ class SetAlias(CliAction):
6
+ name = "set"
7
+ help_msg = "set an alias for the asset"
8
+
9
+ def run(self, args):
10
+ if not args.alias:
11
+ self.user_log.error("missing the alias")
12
+ return
13
+ api = AssetAPI(self.repo).add
14
+ with api.environment():
15
+ api.add_alias(args.alias)
16
+
17
+ def get_options(self) -> [CliOption]:
18
+ return [
19
+ CliOption(
20
+ dest="alias",
21
+ help_msg="an alias for the asset",
22
+ n_args="?",
23
+ positional=True
24
+ )
25
+ ]
@@ -0,0 +1,66 @@
1
+ from .add import AddToAsset
2
+ from .clone import CloneAsset
3
+ from .commit import CommitMessage
4
+ from .cp import CopyObject
5
+ from .dashboard import AssetDashboard
6
+ from .debug import DebugAsset
7
+ from .delete import AssetDelete
8
+ from .diff import AssetDiff
9
+ from .discard import AssetDiscard
10
+ from .download import DownloadAsset
11
+ from .fetch import FetchAsset
12
+ from .find import AssetFind
13
+ from .hash import ComputeHashAction
14
+ from .history import AssetHistory
15
+ from .info import AssetInfo
16
+ from .init import InitAsset
17
+ from .list import ListAssets
18
+ from .pull import AssetPull
19
+ from .remote import RemoteInfo
20
+ from .remove import RemoveFromAsset
21
+ from .report import AssetReport
22
+ from .restore import AssetRestore
23
+ from .status import AssetStatus
24
+ from .switch import AssetSwitch
25
+ from .tree import AssetTree
26
+ from .union import AssetUnion
27
+ from .update import UpdateAsset
28
+ from .upload import UploadAsset
29
+ from .user_prompt_setting import UserPromptSetting
30
+ from .versions import AssetVersions
31
+
32
+
33
+ def get_actions():
34
+ return [
35
+ InitAsset(),
36
+ AddToAsset(),
37
+ RemoveFromAsset(),
38
+ ListAssets(),
39
+ AssetSwitch(),
40
+ UploadAsset(),
41
+ DownloadAsset(),
42
+ CommitMessage(),
43
+ AssetVersions(),
44
+ FetchAsset(),
45
+ AssetDiff(),
46
+ AssetHistory(),
47
+ RemoteInfo(),
48
+ AssetStatus(),
49
+ AssetInfo(),
50
+ AssetDiscard(),
51
+ CloneAsset(),
52
+ UpdateAsset(),
53
+ UserPromptSetting(),
54
+ AssetFind(),
55
+ ComputeHashAction(),
56
+ AssetDashboard(),
57
+ AssetTree(),
58
+ AssetUnion(),
59
+ AssetReport(),
60
+ DebugAsset(),
61
+ CopyObject(),
62
+ AssetPull(),
63
+
64
+ # AssetDelete(),
65
+ # AssetRestore()
66
+ ]
@@ -0,0 +1,72 @@
1
+ import os
2
+
3
+ from asset_core.api.repo_api import AssetAPI
4
+ from asset_manager.commands import CliAction, CliOption
5
+
6
+
7
+ class AddToAsset(CliAction):
8
+ name = "add"
9
+ help_msg = "add files to an asset"
10
+
11
+ def run(self, args):
12
+ api = AssetAPI(self.repo).add
13
+ self.user_log.message(f"target: {args.target}")
14
+
15
+ if args.credentials:
16
+ os.environ["ASSET_CREDENTIALS"] = args.credentials
17
+ with api.environment():
18
+ api.add_files(targets=args.target,
19
+ prompt_user=(not args.yes),
20
+ object_type=args.type,
21
+ proxy=args.proxy,
22
+ dest_dir=args.dest_dir if args.dest_dir else None,
23
+ force=args.force)
24
+ if args.credentials:
25
+ os.unsetenv("ASSET_CREDENTIALS")
26
+
27
+ def get_options(self) -> [CliOption]:
28
+ return [
29
+ CliOption(
30
+ dest="target",
31
+ help_msg="files or directories to add to asset, accepts wildcards i.e. *.txt etc",
32
+ n_args="*",
33
+ positional=True
34
+ ),
35
+ CliOption(
36
+ dest="dest_dir",
37
+ short_name="d",
38
+ full_name="dir",
39
+ n_args="?",
40
+ help_msg="create a new directory and add files into it",
41
+ ),
42
+ CliOption(
43
+ dest="type",
44
+ short_name="t",
45
+ full_name="type",
46
+ n_args="?",
47
+ help_msg="combine all files into a single group object (makes it efficient for large number of files)",
48
+ ),
49
+ CliOption(
50
+ dest="proxy",
51
+ help_msg="add as a proxy content",
52
+ is_boolean=True
53
+ ),
54
+ CliOption(
55
+ dest="yes",
56
+ help_msg="if true, asset-manager won't prompt user to confirm",
57
+ is_boolean=True
58
+ ),
59
+ CliOption(
60
+ dest="credentials",
61
+ help_msg="optional: gcs credentials to use for adding (for proxy assets), available only for gcs",
62
+ short_name="c",
63
+ full_name="cred"
64
+ ),
65
+ CliOption(
66
+ dest="force",
67
+ help_msg="force add files even if they are ignored by assetignore",
68
+ is_boolean=True,
69
+ short_name="f",
70
+ full_name="force"
71
+ ),
72
+ ]
@@ -0,0 +1,100 @@
1
+ import os
2
+
3
+ from asset_core.api.store_api import CloneAssetAPI
4
+ from asset_manager.commands import CliAction, CliOption
5
+ from asset_utils.common.user_commands import UserCommands
6
+
7
+
8
+ class CloneAsset(CliAction):
9
+ name = "clone"
10
+ help_msg = "clone an asset to local or remote location"
11
+ requires_repo = False
12
+
13
+ def run(self, args):
14
+ if not args.asset_name:
15
+ self.user_log.alert("missing required parameter asset-name")
16
+ self.user_log.message(UserCommands().clone_asset())
17
+ return
18
+
19
+ target_dir = os.path.abspath(args.dir) if args.dir else None
20
+ api = CloneAssetAPI()
21
+ if args.credentials:
22
+ os.environ["ASSET_CREDENTIALS"] = args.credentials
23
+ # user used remote flag but did not provide the remote url
24
+ if args.remote is None:
25
+ self.user_log.alert("missing the remote-url to clone the asset")
26
+ return
27
+ # user used version flag but did not provide the version number
28
+ if args.version is None:
29
+ self.user_log.alert("missing the version number of the asset")
30
+ return
31
+ with api.environment():
32
+ if args.remote:
33
+ # compare storage prefix to prevent cross platform remote clone
34
+ if not os.path.commonprefix([args.remote, api.store.storage_url()]):
35
+ self.user_log.alert("can not clone to a different storage platform")
36
+ return
37
+ api.remote_clone(asset_name=args.asset_name, remote_url=args.remote)
38
+ return
39
+ # clone asset to local directory
40
+ api.clone_asset(asset_name=args.asset_name,
41
+ target_dir=target_dir,
42
+ recursive=args.r,
43
+ force=args.force,
44
+ soft=args.soft,
45
+ version=args.version)
46
+ # unset credentials
47
+ if args.credentials:
48
+ os.unsetenv("ASSET_CREDENTIALS")
49
+
50
+ def get_options(self):
51
+ return [
52
+ CliOption(
53
+ dest="asset_name",
54
+ help_msg="name of the asset. can be <class-name>/<seq_id> "
55
+ "or <class-name>/<alias>. can also use <asset-name>/<file-name> "
56
+ "or <asset-name>/<name-pattern> to clone parts of the asset",
57
+ positional=True
58
+ ),
59
+ CliOption(
60
+ dest="r",
61
+ help_msg="recursive, if True, all referenced assets will also be cloned",
62
+ is_boolean=True
63
+ ),
64
+ CliOption(
65
+ dest="dir",
66
+ help_msg="optional: a directory name where asset would be cloned",
67
+ short_name="d",
68
+ full_name="dir"
69
+ ),
70
+ CliOption(
71
+ dest="force",
72
+ help_msg="to override any existing files/directory in the target asset location",
73
+ short_name="f",
74
+ is_boolean=True
75
+ ),
76
+ CliOption(
77
+ dest="soft",
78
+ help_msg="optional: shallow clone i.e. only asset meta information, but not the actual files",
79
+ short_name="s",
80
+ is_boolean=True
81
+ ),
82
+ CliOption(
83
+ dest="credentials",
84
+ help_msg="optional: gcs/aws credentials to use for cloning (for proxy assets)",
85
+ short_name="c",
86
+ full_name="cred"
87
+ ),
88
+ CliOption(
89
+ dest="remote",
90
+ help_msg="optional: a remote directory where asset would be cloned",
91
+ short_name="re",
92
+ full_name="remote"
93
+ ),
94
+ CliOption(
95
+ dest="version",
96
+ help_msg="optional: version of the asset to clone, defaults to latest version if missing",
97
+ short_name="v",
98
+ full_name="version"
99
+ ),
100
+ ]