From df3fa0af9fbfc4e6cb336f543a94605bf810fe54 Mon Sep 17 00:00:00 2001 From: dmahan93 Date: Wed, 14 May 2025 09:57:08 -0500 Subject: [PATCH] move argparse to main() --- atroposlib/cli/run_api.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/atroposlib/cli/run_api.py b/atroposlib/cli/run_api.py index d4442486..0e5e0a40 100644 --- a/atroposlib/cli/run_api.py +++ b/atroposlib/cli/run_api.py @@ -7,7 +7,7 @@ import argparse import uvicorn -def main(host: str, port: int, reload: bool): +def main(): """ Run the API server. Args: @@ -15,13 +15,15 @@ def main(host: str, port: int, reload: bool): port: The port to run the API server on. reload: Whether to reload the API server on code changes. """ - uvicorn.run("atroposlib.api:app", host=host, port=port, reload=reload) - - -if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--host", type=str, default="0.0.0.0") parser.add_argument("--port", type=int, default=8000) - parser.add_argument("--reload", type=bool, default=False) + parser.add_argument("--reload", action="store_true") args = parser.parse_args() - main(args.host, args.port, args.reload) + uvicorn.run( + "atroposlib.api:app", host=args.host, port=args.port, reload=args.reload + ) + + +if __name__ == "__main__": + main()