File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414! uv.lock
1515! .python-version
1616! run.sh
17+ ! hosting_instructions.md
18+ ! temoa_runner.py
19+ ! frontend /wrangler.toml
20+ ! .github /
1721! .pre-commit-config.yaml
1822! .coderabbit.yaml
1923
Original file line number Diff line number Diff line change 1+ # /// script
2+ # requires-python = ">=3.12"
3+ # dependencies = [
4+ # "temoa>=4.0.0a1",
5+ # "fastapi",
6+ # "uvicorn[standard]",
7+ # "tomlkit",
8+ # "websockets",
9+ # ]
10+ # ///
11+
112import asyncio
213import logging
314import sys
@@ -120,6 +131,42 @@ def list_files(path: str = "."):
120131 raise HTTPException (status_code = 500 , detail = str (e ))
121132
122133
134+ @app .get ("/api/solvers" )
135+ def list_solvers ():
136+ """Detect available solvers on the local system."""
137+ try :
138+ import pyomo .environ as pyo
139+
140+ # List of solvers we want to check for
141+ common_solvers = [
142+ "appsi_highs" ,
143+ "highs" ,
144+ "cbc" ,
145+ "glpk" ,
146+ "ipopt" ,
147+ "gurobi" ,
148+ "cplex" ,
149+ ]
150+ available = []
151+ for s in common_solvers :
152+ try :
153+ # Some solvers might throw errors even on check if not installed correctly
154+ factory = pyo .SolverFactory (s )
155+ if factory .available ():
156+ available .append (s )
157+ except Exception :
158+ continue
159+
160+ # Ensure we return at least a sensible default if detection fails but temoa is present
161+ if not available :
162+ return ["appsi_highs" , "cbc" ]
163+
164+ return available
165+ except ImportError :
166+ # Fallback if pyomo is somehow missing
167+ return ["appsi_highs" , "cbc" ]
168+
169+
123170@app .get ("/api/results/{run_id}" )
124171async def get_results (run_id : str ):
125172 run_dir = output_path / run_id
Original file line number Diff line number Diff line change @@ -12,3 +12,16 @@ dependencies = [
1212 " datasette" ,
1313 " websockets" ,
1414]
15+
16+ [tool .pytest .ini_options ]
17+ pythonpath = [" ." ]
18+ testpaths = [" backend/tests" ]
19+ filterwarnings = [
20+ " ignore:.*deprecated - use.*:pyparsing.PyparsingDeprecationWarning" ,
21+ ]
22+
23+ [dependency-groups ]
24+ dev = [
25+ " httpx>=0.28.1" ,
26+ " pytest>=9.0.2" ,
27+ ]
Original file line number Diff line number Diff line change 44uv sync
55uv add " uvicorn[standard]" websockets
66
7+ # Cleanup existing processes if running
8+ echo " Cleaning up stale processes..."
9+ fuser -k 8000/tcp 2> /dev/null
10+ fuser -k 8001/tcp 2> /dev/null
11+ sleep 1
12+
713# Start FastAPI backend in background
814echo " Starting backend..."
915uv run python backend/main.py &
You can’t perform that action at this time.
0 commit comments