diff --git a/python-web-io/pyproject.toml b/python-web-io/pyproject.toml index 0f9ef70..53eeccc 100644 --- a/python-web-io/pyproject.toml +++ b/python-web-io/pyproject.toml @@ -33,4 +33,7 @@ openai = "^0.27.8" [build-system] requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" \ No newline at end of file +build-backend = "poetry.core.masonry.api" + +[tool.poetry.scripts] +python_web_io = "python_web_io.main:test_mode" \ No newline at end of file diff --git a/python-web-io/python_web_io/main.py b/python-web-io/python_web_io/main.py index a2b7182..41a6109 100644 --- a/python-web-io/python_web_io/main.py +++ b/python-web-io/python_web_io/main.py @@ -51,7 +51,7 @@ async def lifespan(app: FastAPI): "icon": "🎯", "css": [ "https://unpkg.com/normalize.css@8.0.1/normalize.css", - "https://cdn.jsdelivr.net/npm/water.css@2/out/water.css" + "https://cdn.jsdelivr.net/npm/water.css@2/out/water.css", ], } @@ -306,7 +306,8 @@ async def http_exception_handler(request: Request, exc: HTTPException): ) -if __name__ == "__main__": +# test mode +def test_mode(): """ If running python_web_io/main.py directly (instead of via uvicorn with an entrypoint), accept CLI arguments. Ideal for quickly testing capabilities without creating `.envrc` or `.pythonwebio/config.toml` files. @@ -321,7 +322,6 @@ def parse_command_line_arguments(): parser.add_argument( "--script", type=str, - default="default_value1", help="Set the python script (override `config.toml` settings) (format: e.g.:`path/to/file.py:main`).", ) parser.add_argument( @@ -344,3 +344,7 @@ def parse_command_line_arguments(): app.state.config_path = args.config uvicorn.run(app, host=args.host, port=args.port) + + +if __name__ == "__main__": + test_mode()