-
Notifications
You must be signed in to change notification settings - Fork 3
/
runner.py
36 lines (29 loc) · 937 Bytes
/
runner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from smpy import run
from argparse import ArgumentParser, ArgumentTypeError
from pathlib import Path
"""Command line interface for SMPy.
Provides a simple command line tool to run SMPy mass mapping operations
using configuration files.
"""
def main(args):
"""Execute SMPy operation from command line arguments.
Parameters
----------
args : `argparse.Namespace`
Parsed command line arguments containing config path
"""
run.run(args.config)
if __name__ == "__main__":
parser = ArgumentParser(description='Runner script for SMPy operations.')
parser.add_argument(
'-config', '-c',
type=Path,
help='Path to configuration file (.yaml)',
required=True,
metavar='PATH'
)
args = parser.parse_args()
# Check if file exists
if not args.config.is_file():
raise ArgumentTypeError(f"Not a valid file: {args.config}")
main(args)