amapy 1.0.2__tar.gz → 1.1.0.dev4__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.
- {amapy-1.0.2 → amapy-1.1.0.dev4}/PKG-INFO +12 -13
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/app.py +1 -1
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/alias_actions/alias_add.py +1 -1
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/alias_actions/alias_help.py +2 -2
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/alias_actions/alias_info.py +2 -2
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/alias_actions/alias_remove.py +2 -2
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/alias_actions/alias_set.py +2 -2
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/add.py +2 -2
- amapy-1.1.0.dev4/amapy/commands/asset_actions/commit.py +25 -0
- amapy-1.1.0.dev4/amapy/commands/asset_actions/diff.py +42 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/discard.py +1 -1
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/tests/test_asset_cmds.py +10 -10
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/update.py +1 -1
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_class_actions/list.py +0 -6
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/cli_option.py +1 -1
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/cmd_group.py +2 -2
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/parser.py +4 -4
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/refs_actions/ref_add.py +1 -1
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/python_api/artifact.py +5 -5
- amapy-1.1.0.dev4/amapy/python_api/tests/test_artifact.py +81 -0
- amapy-1.1.0.dev4/amapy/python_api/tests/test_klass.py +20 -0
- amapy-1.1.0.dev4/amapy/python_api/tests/test_project.py +27 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy.egg-info/PKG-INFO +12 -13
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy.egg-info/SOURCES.txt +0 -1
- amapy-1.1.0.dev4/amapy.egg-info/requires.txt +9 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/pyproject.toml +12 -13
- amapy-1.0.2/amapy/commands/asset_actions/commit.py +0 -28
- amapy-1.0.2/amapy/commands/asset_actions/diff.py +0 -39
- amapy-1.0.2/amapy/python_api/tests/test_artifact.py +0 -110
- amapy-1.0.2/amapy/python_api/tests/test_auth.py +0 -37
- amapy-1.0.2/amapy/python_api/tests/test_klass.py +0 -16
- amapy-1.0.2/amapy/python_api/tests/test_project.py +0 -18
- amapy-1.0.2/amapy.egg-info/requires.txt +0 -10
- {amapy-1.0.2 → amapy-1.1.0.dev4}/README.md +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/__init__.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/app_debug.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/arg_parse.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/__init__.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/alias_actions/__init__.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/__init__.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/clone.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/cp.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/dashboard.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/debug.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/delete.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/download.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/fetch.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/find.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/hash.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/history.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/info.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/init.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/join.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/list.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/pull.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/remote.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/remove.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/report.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/restore.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/status.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/switch.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/tests/__init__.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/tests/test_add.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/tests/test_info.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/tree.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/union.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/upload.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/user_prompt_setting.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_actions/versions.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_class_actions/__init__.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_class_actions/discard.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_class_actions/fetch.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_class_actions/info.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_class_actions/init.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_class_actions/rename.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_class_actions/tests/__init__.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_class_actions/tests/test_asset_class_actions.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/asset_class_actions/upload.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/auth_actions/__init__.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/auth_actions/auth_info.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/auth_actions/auth_login.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/auth_actions/auth_logout.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/auth_actions/auth_remove.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/auth_actions/auth_set.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/auth_actions/auth_signup.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/auth_actions/auth_update.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/base_action.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/cli_action.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/config_actions/__init__.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/config_actions/config_info.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/config_actions/reset_configs.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/config_actions/set_configs.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/package_actions/__init__.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/package_actions/info.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/project_actions/__init__.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/project_actions/project_activate.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/project_actions/project_info.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/project_actions/project_list.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/refs_actions/__init__.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/refs_actions/ref_info.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/refs_actions/ref_remove.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/store_actions/__init__.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/store_actions/store_clear.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/store_actions/store_info.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/store_actions/store_prune.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/store_actions/store_set.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/tests/__init__.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/tests/test_cli_arg.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/tests/test_cmd_group.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/commands/tests/test_parser.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/plugins.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/python_api/__init__.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/python_api/artifact_ref.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/python_api/asset.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/python_api/auth.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/python_api/config.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/python_api/file.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/python_api/inputs.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/python_api/klass.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/python_api/project.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/python_api/store.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/python_api/tests/__init__.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy/python_api/tests/test_file.py +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy.egg-info/dependency_links.txt +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy.egg-info/entry_points.txt +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/amapy.egg-info/top_level.txt +0 -0
- {amapy-1.0.2 → amapy-1.1.0.dev4}/setup.cfg +0 -0
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: amapy
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.1.0.dev4
|
|
4
4
|
Summary: The client side tool for ama project.
|
|
5
5
|
Author-email: Swarup Mahanti <swarup.mahanti@roche.com>
|
|
6
6
|
Maintainer-email: Swarup Mahanti <swarup.mahanti@roche.com>
|
|
7
7
|
License: Copyright (c) 2024 Roche Diagnostics Computation Science & Informatics
|
|
8
|
-
Requires-Python: <3.
|
|
8
|
+
Requires-Python: <3.13,>=3.12
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
|
-
Requires-Dist: amapy-contents==1.0
|
|
11
|
-
Requires-Dist: amapy-core==1.0
|
|
12
|
-
Requires-Dist: amapy-db==1.0
|
|
13
|
-
Requires-Dist: amapy-pluggy==1.0
|
|
14
|
-
Requires-Dist: amapy-plugin-gcr==1.0
|
|
15
|
-
Requires-Dist: amapy-plugin-gcs==1.0
|
|
16
|
-
Requires-Dist: amapy-plugin-posix==1.0
|
|
17
|
-
Requires-Dist: amapy-plugin-s3==1.0
|
|
18
|
-
Requires-Dist: amapy-utils==1.0
|
|
19
|
-
Requires-Dist: markupsafe==2.1.*
|
|
10
|
+
Requires-Dist: amapy-contents==1.1.0
|
|
11
|
+
Requires-Dist: amapy-core==1.1.0
|
|
12
|
+
Requires-Dist: amapy-db==1.1.0
|
|
13
|
+
Requires-Dist: amapy-pluggy==1.1.0
|
|
14
|
+
Requires-Dist: amapy-plugin-gcr==1.1.0
|
|
15
|
+
Requires-Dist: amapy-plugin-gcs==1.1.0
|
|
16
|
+
Requires-Dist: amapy-plugin-posix==1.1.0
|
|
17
|
+
Requires-Dist: amapy-plugin-s3==1.1.0
|
|
18
|
+
Requires-Dist: amapy-utils==1.1.0
|
|
20
19
|
|
|
21
20
|
# amapy
|
|
22
21
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from amapy.commands import CliAction
|
|
1
|
+
from amapy.commands import CliAction
|
|
2
2
|
from amapy_utils.common.user_commands import UserCommands
|
|
3
3
|
|
|
4
4
|
|
|
@@ -13,5 +13,5 @@ class AliasHelp(CliAction):
|
|
|
13
13
|
msg += f"{UserCommands().alias_info()}\n"
|
|
14
14
|
self.user_log.message(msg)
|
|
15
15
|
|
|
16
|
-
def get_options(self)
|
|
16
|
+
def get_options(self):
|
|
17
17
|
return []
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from amapy.commands import CliAction
|
|
1
|
+
from amapy.commands import CliAction
|
|
2
2
|
from amapy_core.api.repo_api import AssetAPI
|
|
3
3
|
|
|
4
4
|
|
|
@@ -11,5 +11,5 @@ class AliasInfo(CliAction):
|
|
|
11
11
|
with api.environment():
|
|
12
12
|
api.list_alias()
|
|
13
13
|
|
|
14
|
-
def get_options(self)
|
|
14
|
+
def get_options(self):
|
|
15
15
|
return []
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from amapy.commands import CliAction
|
|
1
|
+
from amapy.commands import CliAction
|
|
2
2
|
from amapy_core.api.repo_api import AssetAPI
|
|
3
3
|
|
|
4
4
|
|
|
@@ -11,5 +11,5 @@ class RemoveAlias(CliAction):
|
|
|
11
11
|
with api.environment():
|
|
12
12
|
api.remove_alias()
|
|
13
13
|
|
|
14
|
-
def get_options(self)
|
|
14
|
+
def get_options(self):
|
|
15
15
|
return []
|
|
@@ -8,13 +8,13 @@ class SetAlias(CliAction):
|
|
|
8
8
|
|
|
9
9
|
def run(self, args):
|
|
10
10
|
if not args.alias:
|
|
11
|
-
self.user_log.error("missing
|
|
11
|
+
self.user_log.error("missing required parameter <alias>")
|
|
12
12
|
return
|
|
13
13
|
api = AssetAPI(self.repo).add
|
|
14
14
|
with api.environment():
|
|
15
15
|
api.add_alias(args.alias)
|
|
16
16
|
|
|
17
|
-
def get_options(self) -> [CliOption]:
|
|
17
|
+
def get_options(self) -> list[CliOption]:
|
|
18
18
|
return [
|
|
19
19
|
CliOption(
|
|
20
20
|
dest="alias",
|
|
@@ -24,7 +24,7 @@ class AddToAsset(CliAction):
|
|
|
24
24
|
if args.credentials:
|
|
25
25
|
os.unsetenv("ASSET_CREDENTIALS")
|
|
26
26
|
|
|
27
|
-
def get_options(self) -> [CliOption]:
|
|
27
|
+
def get_options(self) -> list[CliOption]:
|
|
28
28
|
return [
|
|
29
29
|
CliOption(
|
|
30
30
|
dest="target",
|
|
@@ -68,5 +68,5 @@ class AddToAsset(CliAction):
|
|
|
68
68
|
is_boolean=True,
|
|
69
69
|
short_name="f",
|
|
70
70
|
full_name="force"
|
|
71
|
-
)
|
|
71
|
+
)
|
|
72
72
|
]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from amapy.commands import CliAction, CliOption
|
|
2
|
+
from amapy_core.api.repo_api import AssetAPI
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class CommitMessage(CliAction):
|
|
6
|
+
name = "commit"
|
|
7
|
+
help_msg = "commit message for the changes"
|
|
8
|
+
|
|
9
|
+
def run(self, args):
|
|
10
|
+
if args.message:
|
|
11
|
+
api = AssetAPI(self.repo).add
|
|
12
|
+
with api.environment():
|
|
13
|
+
api.add_commit_message(message=args.message)
|
|
14
|
+
else:
|
|
15
|
+
self.user_log.message("missing commit message, please use asset commit -m <message text>")
|
|
16
|
+
|
|
17
|
+
def get_options(self) -> list[CliOption]:
|
|
18
|
+
return [
|
|
19
|
+
CliOption(
|
|
20
|
+
dest="message",
|
|
21
|
+
help_msg="commit message",
|
|
22
|
+
short_name="m",
|
|
23
|
+
full_name="message"
|
|
24
|
+
)
|
|
25
|
+
]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from amapy.commands import CliAction, CliOption
|
|
2
|
+
from amapy_core.api.repo_api import AssetAPI
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class AssetDiff(CliAction):
|
|
6
|
+
name = "diff"
|
|
7
|
+
help_msg = "Displays the differences between two versions of an asset"
|
|
8
|
+
|
|
9
|
+
def run(self, args):
|
|
10
|
+
api = AssetAPI(self.repo).diff
|
|
11
|
+
with api.environment():
|
|
12
|
+
api.diff(file=args.file, src_ver=args.src_ver, dst_ver=args.dst_ver, html=args.html)
|
|
13
|
+
|
|
14
|
+
def get_options(self) -> list[CliOption]:
|
|
15
|
+
return [
|
|
16
|
+
CliOption(
|
|
17
|
+
dest="src_ver",
|
|
18
|
+
short_name="s",
|
|
19
|
+
full_name="src",
|
|
20
|
+
help_msg="src version",
|
|
21
|
+
n_args="?",
|
|
22
|
+
),
|
|
23
|
+
CliOption(
|
|
24
|
+
dest="dst_ver",
|
|
25
|
+
short_name="d",
|
|
26
|
+
full_name="dst",
|
|
27
|
+
help_msg="dst version",
|
|
28
|
+
n_args="?",
|
|
29
|
+
),
|
|
30
|
+
CliOption(
|
|
31
|
+
dest="file",
|
|
32
|
+
short_name="f",
|
|
33
|
+
full_name="file",
|
|
34
|
+
help_msg="file path",
|
|
35
|
+
n_args="?",
|
|
36
|
+
),
|
|
37
|
+
CliOption(
|
|
38
|
+
dest="html",
|
|
39
|
+
help_msg="if true diff is shown as html",
|
|
40
|
+
is_boolean=True
|
|
41
|
+
)
|
|
42
|
+
]
|
|
@@ -26,32 +26,32 @@ def test_asset_actions():
|
|
|
26
26
|
CloneAsset()
|
|
27
27
|
)
|
|
28
28
|
|
|
29
|
-
args = parser.parse_args(["add", "myfile.txt"])
|
|
29
|
+
args, _ = parser.parse_args(["add", "myfile.txt"])
|
|
30
30
|
assert args.group == "add" and args.target == ["myfile.txt"]
|
|
31
31
|
|
|
32
|
-
args = parser.parse_args(["remove", "myfile.txt", "1.log"])
|
|
32
|
+
args, _ = parser.parse_args(["remove", "myfile.txt", "1.log"])
|
|
33
33
|
assert args.group == "remove" and args.target == ["myfile.txt", "1.log"]
|
|
34
34
|
|
|
35
|
-
args = parser.parse_args(["init"])
|
|
35
|
+
args, _ = parser.parse_args(["init"])
|
|
36
36
|
assert args.group == "init"
|
|
37
37
|
|
|
38
|
-
args = parser.parse_args(["init", "genetics"])
|
|
38
|
+
args, _ = parser.parse_args(["init", "genetics"])
|
|
39
39
|
assert args.group == "init" and args.class_name == "genetics"
|
|
40
40
|
|
|
41
|
-
args = parser.parse_args(["upload"])
|
|
41
|
+
args, _ = parser.parse_args(["upload"])
|
|
42
42
|
assert args.group == "upload" and not args.message
|
|
43
43
|
|
|
44
|
-
args = parser.parse_args(["upload", "-m", "first commit"])
|
|
44
|
+
args, _ = parser.parse_args(["upload", "-m", "first commit"])
|
|
45
45
|
assert args.group == "upload" and args.message == "first commit"
|
|
46
46
|
|
|
47
|
-
args = parser.parse_args(["upload", "--message", "second commit"])
|
|
47
|
+
args, _ = parser.parse_args(["upload", "--message", "second commit"])
|
|
48
48
|
assert args.group == "upload" and args.message == "second commit"
|
|
49
49
|
|
|
50
|
-
args = parser.parse_args(["download"])
|
|
50
|
+
args, _ = parser.parse_args(["download"])
|
|
51
51
|
assert args.group == "download"
|
|
52
52
|
|
|
53
|
-
args = parser.parse_args(["info", "--hash"])
|
|
53
|
+
args, _ = parser.parse_args(["info", "--hash"])
|
|
54
54
|
assert args.group == "info"
|
|
55
55
|
|
|
56
|
-
args = parser.parse_args(["clone", "model_visualizations/1"])
|
|
56
|
+
args, _ = parser.parse_args(["clone", "model_visualizations/1"])
|
|
57
57
|
assert args.group == "clone"
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import cached_property
|
|
2
|
-
|
|
3
1
|
from amapy.commands import CliAction
|
|
4
2
|
from amapy_core.api.store_api.list import ListAPI
|
|
5
3
|
|
|
@@ -16,7 +14,3 @@ class ListAssetClass(CliAction):
|
|
|
16
14
|
|
|
17
15
|
def get_options(self):
|
|
18
16
|
return []
|
|
19
|
-
|
|
20
|
-
@cached_property.cached_property
|
|
21
|
-
def api(self):
|
|
22
|
-
return ListAPI(store=self.asset_store, repo=self.repo)
|
|
@@ -36,8 +36,8 @@ class CommandGroup(BaseAction):
|
|
|
36
36
|
description=self.description,
|
|
37
37
|
formatter_class=parent.formatter_class,
|
|
38
38
|
)
|
|
39
|
-
cmd_sub_parser = group_parser.add_subparsers(metavar=
|
|
40
|
-
dest=
|
|
39
|
+
cmd_sub_parser = group_parser.add_subparsers(metavar="actions",
|
|
40
|
+
dest="action")
|
|
41
41
|
for action in self.actions.values():
|
|
42
42
|
action.add_parser(sub_parsers=cmd_sub_parser)
|
|
43
43
|
|
|
@@ -7,7 +7,7 @@ from amapy_utils.utils.log_utils import LoggingMixin
|
|
|
7
7
|
class DefaultHelpParser(ArgumentParser):
|
|
8
8
|
|
|
9
9
|
def error(self, message):
|
|
10
|
-
sys.stderr.write(
|
|
10
|
+
sys.stderr.write("error in command: %s\n" % message)
|
|
11
11
|
self.print_help()
|
|
12
12
|
sys.exit(2)
|
|
13
13
|
|
|
@@ -40,7 +40,7 @@ class DefaultHelpParser(ArgumentParser):
|
|
|
40
40
|
class NewLineFormatter(RawTextHelpFormatter):
|
|
41
41
|
def _split_lines(self, text: str, width):
|
|
42
42
|
# print(f"splitting lines: {text}")
|
|
43
|
-
if text.endswith(
|
|
43
|
+
if text.endswith("\n"):
|
|
44
44
|
return text[2:].splitlines()
|
|
45
45
|
return super()._split_lines(text, width=width)
|
|
46
46
|
|
|
@@ -60,10 +60,10 @@ class CommandParser(LoggingMixin):
|
|
|
60
60
|
description=self.user_log.colorize("Asset Manager Command Line Tool",
|
|
61
61
|
color=self.user_log.colors.cyan),
|
|
62
62
|
formatter_class=NewLineFormatter,
|
|
63
|
-
epilog=self.user_log.colorize(
|
|
63
|
+
epilog=self.user_log.colorize("Command Line tool for interacting with assets",
|
|
64
64
|
color=self.user_log.colors.cyan)
|
|
65
65
|
)
|
|
66
|
-
sub_parsers = self.parser.add_subparsers(metavar=
|
|
66
|
+
sub_parsers = self.parser.add_subparsers(metavar="groups", dest="group")
|
|
67
67
|
sub_parsers.required = True
|
|
68
68
|
self.sub_parsers = sub_parsers
|
|
69
69
|
|
|
@@ -32,7 +32,7 @@ class AddRef(CliAction):
|
|
|
32
32
|
self.user_log.message(UserCommands().inputs_add())
|
|
33
33
|
self.user_log.message(UserCommands().inputs_add_remote())
|
|
34
34
|
|
|
35
|
-
def get_options(self) -> [CliOption]:
|
|
35
|
+
def get_options(self) -> list[CliOption]:
|
|
36
36
|
return [
|
|
37
37
|
CliOption(
|
|
38
38
|
dest="input_asset",
|
|
@@ -187,14 +187,14 @@ class Artifact:
|
|
|
187
187
|
@property
|
|
188
188
|
def is_temp(self) -> bool:
|
|
189
189
|
"""Returns True if the asset is temporary."""
|
|
190
|
-
return self.info.get(
|
|
190
|
+
return self.info.get("asset").get("cloning") == (False, "temp_asset")
|
|
191
191
|
|
|
192
192
|
@cached_property
|
|
193
193
|
def inputs(self) -> ArtifactInputs:
|
|
194
194
|
from amapy import ArtifactInputs
|
|
195
195
|
return ArtifactInputs(artifact=self)
|
|
196
196
|
|
|
197
|
-
def sanitize_targets(self, targets: [str], copy_to_asset: bool = False) -> [str]:
|
|
197
|
+
def sanitize_targets(self, targets: list[str], copy_to_asset: bool = False) -> list[str]:
|
|
198
198
|
"""
|
|
199
199
|
Checks if the target files are within the asset directory, if not, then copies the files to the asset directory
|
|
200
200
|
based on the force flag and returns the sanitized list of targets.
|
|
@@ -214,7 +214,7 @@ class Artifact:
|
|
|
214
214
|
filtered_targets.append(target)
|
|
215
215
|
return filtered_targets
|
|
216
216
|
|
|
217
|
-
def add(self, targets: [str], proxy: bool = False, copy_to_asset: bool = False, force: bool = False):
|
|
217
|
+
def add(self, targets: list[str], proxy: bool = False, copy_to_asset: bool = False, force: bool = False):
|
|
218
218
|
"""Adds files and directories to the asset.
|
|
219
219
|
|
|
220
220
|
Parameters
|
|
@@ -242,7 +242,7 @@ class Artifact:
|
|
|
242
242
|
with ch_dir(self.path):
|
|
243
243
|
api.add_files(targets=sanitized_targets, prompt_user=False, proxy=proxy, force=force)
|
|
244
244
|
|
|
245
|
-
def add_remote(self, targets: [str], credentials: str = None):
|
|
245
|
+
def add_remote(self, targets: list[str], credentials: str = None):
|
|
246
246
|
"""Adds remote files to the asset.
|
|
247
247
|
|
|
248
248
|
Parameters
|
|
@@ -608,7 +608,7 @@ class Artifact:
|
|
|
608
608
|
# Custom key function to sort by integer id and then version
|
|
609
609
|
def sort_key(name):
|
|
610
610
|
# Split the string by '/' and extract parts
|
|
611
|
-
parts = name.split(
|
|
611
|
+
parts = name.split("/")
|
|
612
612
|
return parts[0], int(parts[1]), tuple(map(int, parts[2].split(".")))
|
|
613
613
|
|
|
614
614
|
# Sort the existing assets by the custom key function
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import tempfile
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
from amapy.python_api.artifact import Artifact, File
|
|
7
|
+
from amapy_utils.common import exceptions
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_fixtures(asset_root, repo, asset, store):
|
|
11
|
+
"""Verify that all conftest fixtures are created properly."""
|
|
12
|
+
assert asset_root and os.path.isdir(asset_root)
|
|
13
|
+
assert repo is not None
|
|
14
|
+
assert asset is not None
|
|
15
|
+
assert store is not None
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_init():
|
|
19
|
+
# Should raise exception if path is missing or None
|
|
20
|
+
with pytest.raises(Exception) as e:
|
|
21
|
+
Artifact(path=None)
|
|
22
|
+
assert e.type == exceptions.AssetException
|
|
23
|
+
|
|
24
|
+
# also raise exception if not a valid repo
|
|
25
|
+
temp_dir = tempfile.mkdtemp()
|
|
26
|
+
try:
|
|
27
|
+
with pytest.raises(Exception) as e:
|
|
28
|
+
Artifact(path=temp_dir)
|
|
29
|
+
assert e.type == exceptions.NotAssetRepoError
|
|
30
|
+
finally:
|
|
31
|
+
os.rmdir(temp_dir)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def test_info(asset):
|
|
35
|
+
artifact = Artifact(path=asset.repo.fs_path)
|
|
36
|
+
info = artifact.info
|
|
37
|
+
info_keys = ["asset", "objects"]
|
|
38
|
+
for key in info_keys:
|
|
39
|
+
assert key in info
|
|
40
|
+
|
|
41
|
+
# objects
|
|
42
|
+
object_keys = ["linked_path", "path", "size", "cloned"]
|
|
43
|
+
for item in info.get("objects"):
|
|
44
|
+
for key in object_keys:
|
|
45
|
+
assert key in item
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_versions(asset):
|
|
49
|
+
artifact = Artifact(path=asset.repo.fs_path)
|
|
50
|
+
versions = artifact.versions
|
|
51
|
+
assert versions is None # local asset
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def test_history(asset):
|
|
55
|
+
artifact = Artifact(path=asset.repo.fs_path)
|
|
56
|
+
history = artifact.history
|
|
57
|
+
assert history is None # local asset
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def test_status(asset):
|
|
61
|
+
artifact = Artifact(path=asset.repo.fs_path)
|
|
62
|
+
status = artifact.status
|
|
63
|
+
status_keys = ["staged_changes", "unstaged_changes", "untracked_changes"]
|
|
64
|
+
for key in status_keys:
|
|
65
|
+
assert key in status
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def test_files(asset):
|
|
69
|
+
artifact = Artifact(path=asset.repo.fs_path)
|
|
70
|
+
files = artifact.files
|
|
71
|
+
for item in files.values():
|
|
72
|
+
assert isinstance(item, File)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def test_read_file(asset):
|
|
76
|
+
artifact = Artifact(path=asset.repo.fs_path)
|
|
77
|
+
files = artifact.files
|
|
78
|
+
for item in files.values():
|
|
79
|
+
with item.open() as f:
|
|
80
|
+
file_contents = f.read()
|
|
81
|
+
assert file_contents is not None
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from unittest.mock import patch
|
|
2
|
+
|
|
3
|
+
from amapy.python_api.klass import Klass
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_list(store):
|
|
7
|
+
with patch("amapy.python_api.klass.AssetStore.shared", return_value=store):
|
|
8
|
+
klass = Klass()
|
|
9
|
+
class_list = klass.list()
|
|
10
|
+
assert class_list and type(class_list) is dict
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_info(store):
|
|
14
|
+
with patch("amapy.python_api.klass.AssetStore.shared", return_value=store):
|
|
15
|
+
klass = Klass()
|
|
16
|
+
class_info = klass.info(class_name="test_class")
|
|
17
|
+
assert type(class_info) is dict
|
|
18
|
+
expected = ["name", "id", "created_at", "created_by", "class_type", "project"]
|
|
19
|
+
for key in expected:
|
|
20
|
+
assert key in class_info
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from unittest.mock import patch
|
|
2
|
+
|
|
3
|
+
from amapy.python_api.project import Project
|
|
4
|
+
from amapy_core.configs.app_settings import AppSettings
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_list(test_environment):
|
|
8
|
+
settings = AppSettings.shared()
|
|
9
|
+
settings.data = AppSettings.validate(data=test_environment)
|
|
10
|
+
with patch("amapy_core.api.settings_api.AppSettings.shared", return_value=settings):
|
|
11
|
+
project_list = Project().list()
|
|
12
|
+
assert len(project_list) == len(test_environment.get("projects"))
|
|
13
|
+
expected_keys = ["name", "id", "description", "remote_url", "is_active"]
|
|
14
|
+
for project in project_list:
|
|
15
|
+
for key in expected_keys:
|
|
16
|
+
assert key in project
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def test_active_project(test_environment):
|
|
20
|
+
settings = AppSettings.shared()
|
|
21
|
+
settings.data = AppSettings.validate(data=test_environment)
|
|
22
|
+
with patch("amapy_core.api.settings_api.AppSettings.shared", return_value=settings):
|
|
23
|
+
active_project = Project().active
|
|
24
|
+
assert isinstance(active_project, dict)
|
|
25
|
+
expected_keys = ["name", "id", "description", "remote_url", "is_active"]
|
|
26
|
+
for key in expected_keys:
|
|
27
|
+
assert key in active_project
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: amapy
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.1.0.dev4
|
|
4
4
|
Summary: The client side tool for ama project.
|
|
5
5
|
Author-email: Swarup Mahanti <swarup.mahanti@roche.com>
|
|
6
6
|
Maintainer-email: Swarup Mahanti <swarup.mahanti@roche.com>
|
|
7
7
|
License: Copyright (c) 2024 Roche Diagnostics Computation Science & Informatics
|
|
8
|
-
Requires-Python: <3.
|
|
8
|
+
Requires-Python: <3.13,>=3.12
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
|
-
Requires-Dist: amapy-contents==1.0
|
|
11
|
-
Requires-Dist: amapy-core==1.0
|
|
12
|
-
Requires-Dist: amapy-db==1.0
|
|
13
|
-
Requires-Dist: amapy-pluggy==1.0
|
|
14
|
-
Requires-Dist: amapy-plugin-gcr==1.0
|
|
15
|
-
Requires-Dist: amapy-plugin-gcs==1.0
|
|
16
|
-
Requires-Dist: amapy-plugin-posix==1.0
|
|
17
|
-
Requires-Dist: amapy-plugin-s3==1.0
|
|
18
|
-
Requires-Dist: amapy-utils==1.0
|
|
19
|
-
Requires-Dist: markupsafe==2.1.*
|
|
10
|
+
Requires-Dist: amapy-contents==1.1.0
|
|
11
|
+
Requires-Dist: amapy-core==1.1.0
|
|
12
|
+
Requires-Dist: amapy-db==1.1.0
|
|
13
|
+
Requires-Dist: amapy-pluggy==1.1.0
|
|
14
|
+
Requires-Dist: amapy-plugin-gcr==1.1.0
|
|
15
|
+
Requires-Dist: amapy-plugin-gcs==1.1.0
|
|
16
|
+
Requires-Dist: amapy-plugin-posix==1.1.0
|
|
17
|
+
Requires-Dist: amapy-plugin-s3==1.1.0
|
|
18
|
+
Requires-Dist: amapy-utils==1.1.0
|
|
20
19
|
|
|
21
20
|
# amapy
|
|
22
21
|
|
|
@@ -113,7 +113,6 @@ amapy/python_api/project.py
|
|
|
113
113
|
amapy/python_api/store.py
|
|
114
114
|
amapy/python_api/tests/__init__.py
|
|
115
115
|
amapy/python_api/tests/test_artifact.py
|
|
116
|
-
amapy/python_api/tests/test_auth.py
|
|
117
116
|
amapy/python_api/tests/test_file.py
|
|
118
117
|
amapy/python_api/tests/test_klass.py
|
|
119
118
|
amapy/python_api/tests/test_project.py
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools>=
|
|
2
|
+
requires = ["setuptools>=74.0.0,<=80.10.2"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "amapy"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.1.0.dev4"
|
|
8
8
|
description = "The client side tool for ama project."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|
|
@@ -14,18 +14,17 @@ maintainers = [
|
|
|
14
14
|
{ name = "Swarup Mahanti", email = "swarup.mahanti@roche.com" }
|
|
15
15
|
]
|
|
16
16
|
license = { text = "Copyright (c) 2024 Roche Diagnostics Computation Science & Informatics" }
|
|
17
|
-
requires-python = ">=3.
|
|
17
|
+
requires-python = ">=3.12,<3.13" # "==3.12.*"
|
|
18
18
|
dependencies = [
|
|
19
|
-
"amapy-contents==1.0
|
|
20
|
-
"amapy-core==1.0
|
|
21
|
-
"amapy-db==1.0
|
|
22
|
-
"amapy-pluggy==1.0
|
|
23
|
-
"amapy-plugin-gcr==1.0
|
|
24
|
-
"amapy-plugin-gcs==1.0
|
|
25
|
-
"amapy-plugin-posix==1.0
|
|
26
|
-
"amapy-plugin-s3==1.0
|
|
27
|
-
"amapy-utils==1.0
|
|
28
|
-
"markupsafe==2.1.*",
|
|
19
|
+
"amapy-contents==1.1.0",
|
|
20
|
+
"amapy-core==1.1.0",
|
|
21
|
+
"amapy-db==1.1.0",
|
|
22
|
+
"amapy-pluggy==1.1.0",
|
|
23
|
+
"amapy-plugin-gcr==1.1.0",
|
|
24
|
+
"amapy-plugin-gcs==1.1.0",
|
|
25
|
+
"amapy-plugin-posix==1.1.0",
|
|
26
|
+
"amapy-plugin-s3==1.1.0",
|
|
27
|
+
"amapy-utils==1.1.0"
|
|
29
28
|
]
|
|
30
29
|
|
|
31
30
|
[tool.setuptools.packages.find]
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import cached_property
|
|
2
|
-
|
|
3
|
-
from amapy.commands import CliAction, CliOption
|
|
4
|
-
from amapy_core.api.repo_api import AssetAPI, AddAPI
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class CommitMessage(CliAction):
|
|
8
|
-
name = "commit"
|
|
9
|
-
help_msg = "commit message for the changes"
|
|
10
|
-
|
|
11
|
-
@cached_property.cached_property
|
|
12
|
-
def api(self) -> AddAPI:
|
|
13
|
-
return AssetAPI(self.repo).add
|
|
14
|
-
|
|
15
|
-
def run(self, args):
|
|
16
|
-
if args.message:
|
|
17
|
-
self.api.add_commit_message(message=args.message)
|
|
18
|
-
else:
|
|
19
|
-
self.user_log.message("missing commit message, please use asset commit -m <message text>")
|
|
20
|
-
|
|
21
|
-
def get_options(self):
|
|
22
|
-
return [
|
|
23
|
-
CliOption(dest="message",
|
|
24
|
-
help_msg="commit message",
|
|
25
|
-
short_name="m",
|
|
26
|
-
full_name="message"
|
|
27
|
-
)
|
|
28
|
-
]
|