How vallepurohith/complexity-analyzer works
Complexity Analyzer is a browser-based Python complexity analysis and execution tool. A user edits or selects code in the React interface; the interface requests examples or submits code for analysis, and the FastAPI backend invokes the AST analyzer and returns time/space estimates, metrics, and an explanation for display. The product also offers Python subprocess execution with standard input/output and a timeout. The main internal layer is the analyzer’s AST-based traversal and complexity calculation. The compiler UI’s request wiring is not shown in the excerpts, so that connection is marked unverified.
Main entry points: server.py FastAPI routes · App.jsx Editor and reports · analyzer.py AST analysis · main.jsx React entry
Components 10
Browser interface
- Editor and reports
frontend/src/App.jsx - React entry
frontend/src/main.jsx
Backend API
- FastAPI routes
server.py - Code examples
server.py - Analysis handler
server.py - Run handler
server.py
Static analysis
- AST analysis
complexity_analyzer/analyzer.py - Analysis result
complexity_analyzer/result.py
Code execution
- Python subprocess
server.py
Other components
- User
Connections 11
- User → Editor and reports: edits code
frontend/src/App.jsx - React entry → Editor and reports: renders
frontend/src/main.jsx - Editor and reports → FastAPI routes: requests examples
frontend/src/App.jsx - Editor and reports → FastAPI routes: submits analysis
frontend/src/App.jsx - FastAPI routes → Code examples: routes examples
server.py - FastAPI routes → Analysis handler: routes analysis
server.py - Analysis handler → AST analysis: analyzes code
server.py - AST analysis → Analysis result: returns result
complexity_analyzer/analyzer.py - FastAPI routes → Run handler: routes execution
server.py - Run handler → Python subprocess: executes code
server.py - Editor and reports → FastAPI routes: requests execution