-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path__main__.py
More file actions
38 lines (25 loc) · 848 Bytes
/
__main__.py
File metadata and controls
38 lines (25 loc) · 848 Bytes
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
37
38
from argparse import ArgumentParser
from . import __version__
__all__ = ["main"]
INSUFFICIENT_DEPENDENCIES_MESSAGE = "To do anything other than print the version and be\
available for importing the client, you must install this package with [server]\
optional dependencies"
def check_server_dependencies():
try:
import uvicorn # noqa
from fastapi import FastAPI # noqa
return True
except ImportError:
return False
def main():
parser = ArgumentParser()
parser.add_argument("-v", "--version", action="version", version=__version__)
parser.parse_args()
if not check_server_dependencies():
print(INSUFFICIENT_DEPENDENCIES_MESSAGE)
else:
from .app import main
main()
# test with: python -m daq_config_server
if __name__ == "__main__":
main()