eosvc 0.1.2__py3-none-any.whl

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.
eosvc/__init__.py ADDED
File without changes
eosvc/cli.py ADDED
@@ -0,0 +1,62 @@
1
+ import argparse
2
+
3
+ from eosvc.helpers import (
4
+ cmd_clone,
5
+ cmd_download,
6
+ cmd_pull,
7
+ cmd_push,
8
+ cmd_upload,
9
+ cmd_view,
10
+ )
11
+ from eosvc.helpers import DEFAULT_ORG, EVCError, logger
12
+
13
+
14
+ def build_parser():
15
+ p = argparse.ArgumentParser(prog="evc", description="Ersilia Version Control (Git + S3)")
16
+ sub = p.add_subparsers(dest="cmd", required=True)
17
+
18
+ p_clone = sub.add_parser("clone", help="Clone repo from GitHub and fetch artifacts from S3")
19
+ p_clone.add_argument("repo", help="Repository name (e.g., kpneumoniae-gardp)")
20
+ p_clone.add_argument("--org", default=DEFAULT_ORG, help=f"GitHub org (default: {DEFAULT_ORG})")
21
+ p_clone.add_argument("--dest", default=None, help="Destination folder (default: repo name)")
22
+ p_clone.set_defaults(func=cmd_clone)
23
+
24
+ p_pull = sub.add_parser("pull", help="git pull --rebase and refresh artifacts from S3")
25
+ p_pull.add_argument("-y", "--yes", action="store_true", help="Assume yes for delete confirmation")
26
+ p_pull.set_defaults(func=cmd_pull)
27
+
28
+ p_push = sub.add_parser(
29
+ "push", help="git push and upload artifacts to S3 (requires prior git commit)"
30
+ )
31
+ p_push.set_defaults(func=cmd_push)
32
+
33
+ p_dl = sub.add_parser("download", help="Download a file/folder from S3 by relative path")
34
+ p_dl.add_argument("--path", required=True, help="Relative path (e.g., data/processed/file.csv)")
35
+ p_dl.set_defaults(func=cmd_download)
36
+
37
+ p_ul = sub.add_parser("upload", help="Upload a file/folder to S3 by relative path")
38
+ p_ul.add_argument("--path", required=True, help="Relative path (e.g., outputs/some_folder)")
39
+ p_ul.set_defaults(func=cmd_upload)
40
+
41
+ p_view = sub.add_parser("view", help="View S3 folder structure for a path")
42
+ p_view.add_argument("--path", default=".", help="Relative path (e.g., data, outputs, .)")
43
+ p_view.set_defaults(func=cmd_view)
44
+
45
+ return p
46
+
47
+
48
+ def main():
49
+ parser = build_parser()
50
+ args = parser.parse_args()
51
+ try:
52
+ args.func(args)
53
+ except EVCError as e:
54
+ logger.error(str(e))
55
+ raise SystemExit(2)
56
+ except KeyboardInterrupt:
57
+ logger.error("Interrupted.")
58
+ raise SystemExit(130)
59
+
60
+
61
+ if __name__ == "__main__":
62
+ main()