File size: 1,392 Bytes
adca48b |
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
#!/usr/bin/env python3
"""
PIPS entry-point.
Usage:
python -m pips # starts on 0.0.0.0:8080
python -m pips --port 5000 # custom port
python -m pips --host 127.0.0.1 --debug
"""
import argparse
import sys
# Import the runner we exposed in the simplified web_app.py
from .web_app import run_app
def main() -> None:
parser = argparse.ArgumentParser(
prog="pips",
description="PIPS – Python Iterative Problem Solving web interface",
)
parser.add_argument(
"-p", "--port",
type=int,
default=8080,
help="HTTP port to listen on (default 8080)",
)
parser.add_argument(
"--host",
type=str,
default="0.0.0.0",
help="Bind address (default 0.0.0.0)",
)
parser.add_argument(
"--debug",
action="store_true",
help="Enable Flask/SockeIO debug mode",
)
args = parser.parse_args()
print(f"▶️ PIPS web UI: http://{args.host}:{args.port} (debug={args.debug})")
try:
run_app(host=args.host, port=args.port, debug=args.debug)
except KeyboardInterrupt:
print("\n👋 Shutting down PIPS—good-bye!")
sys.exit(0)
except Exception as exc: # pragma: no cover
print(f"❌ Fatal error starting PIPS: {exc}")
sys.exit(1)
if __name__ == "__main__":
main()
|