Coverage for src/kwai/core/args.py: 0%
8 statements
« prev ^ index » next coverage.py v7.6.10, created at 2024-01-01 00:00 +0000
« prev ^ index » next coverage.py v7.6.10, created at 2024-01-01 00:00 +0000
1"""Module for handling arguments for starting a uvicorn application."""
3import argparse
5from argparse import Namespace
8def create_args(prog: str, default_port: int = 8000) -> Namespace:
9 """Parse and create cli arguments."""
10 parser = argparse.ArgumentParser(prog=prog)
11 parser.add_argument(
12 "--reload",
13 action=argparse.BooleanOptionalAction,
14 help="Watch for code changes or not",
15 )
16 parser.add_argument(
17 "--host", type=str, default="0.0.0.0", help="The host of the server."
18 )
19 parser.add_argument(
20 "--port", type=int, default=default_port, help="The port of the server."
21 )
22 return parser.parse_args()