14
14
import sys
15
15
import yaml
16
16
17
- import benchpark .cmd .audit
18
- import benchpark .cmd .system
19
- import benchpark .cmd .experiment
20
- import benchpark .cmd .setup
21
- import benchpark .cmd .unit_test
22
- import benchpark .paths
23
- from benchpark .accounting import (
17
+ __version__ = "0.1.0"
18
+ if "-V" in sys .argv or "--version" in sys .argv :
19
+ print (__version__ )
20
+ exit ()
21
+ helpstr = """usage: main.py [-h] [-V] {list,tags,system,experiment,setup,unit-test,audit} ...
22
+
23
+ Benchpark
24
+
25
+ options:
26
+ -h, --help show this help message and exit
27
+ -V, --version show version number and exit
28
+
29
+ Subcommands:
30
+ {list,tags,system,experiment,setup,unit-test,audit}
31
+ list List available experiments, systems, and modifiers
32
+ tags Tags in Benchpark experiments
33
+ system Initialize a system config
34
+ experiment Interact with experiments
35
+ setup Set up an experiment and prepare it to build/run
36
+ unit-test Run benchpark unit tests
37
+ audit Look for problems in System/Experiment repos"""
38
+ if "-h" in sys .argv or "--help" in sys .argv :
39
+ print (helpstr )
40
+ exit ()
41
+
42
+ import benchpark .cmd .audit # noqa: E402
43
+ import benchpark .cmd .system # noqa: E402
44
+ import benchpark .cmd .experiment # noqa: E402
45
+ import benchpark .cmd .setup # noqa: E402
46
+ import benchpark .cmd .unit_test # noqa: E402
47
+ import benchpark .paths # noqa: E402
48
+ from benchpark .accounting import ( # noqa: E402
24
49
benchpark_experiments ,
25
50
benchpark_modifiers ,
26
51
benchpark_systems ,
27
52
)
28
53
29
54
30
- __version__ = "0.1.0"
31
-
32
-
33
55
def main ():
34
56
if sys .version_info [:2 ] < (3 , 8 ):
35
57
raise Exception ("Benchpark requires at least python 3.8+." )
@@ -53,10 +75,6 @@ def main():
53
75
parser .print_help ()
54
76
return 1
55
77
56
- if args .version :
57
- print (get_version ())
58
- return 0
59
-
60
78
if args .subcommand in actions :
61
79
action = actions [args .subcommand ]
62
80
if supports_unknown_args (action ):
@@ -87,11 +105,6 @@ def supports_unknown_args(command):
87
105
return argcount == 2 and varnames [1 ] == "unknown_args"
88
106
89
107
90
- def get_version ():
91
- benchpark_version = __version__
92
- return benchpark_version
93
-
94
-
95
108
def benchpark_list (subparsers , actions_dict ):
96
109
list_parser = subparsers .add_parser (
97
110
"list" , help = "List available experiments, systems, and modifiers"
0 commit comments