For Developers
A technical guide for contributors to the Chess Analyzer Pro codebase.
Project Overview
Chess Analyzer Pro is a desktop application built with Python and PyQt6. It follows a modular architecture to separate the GUI from the heavy Stockfish analysis logic.
- Stack: Python 3.10+, PyQt6 (GUI), Stockfish (Engine), Google Gemini (AI).
- Repo:
imutkarsht/Chess_analyzer
Directory Structure
Chess_analyzer/
├── src/
│ ├── backend/ # Core logic (Analysis, Engine wrapper, APIs)
│ ├── gui/ # PyQt6 Widgets (Board, Graphs, Analysis Panel)
│ └── utils/ # Helpers (Config, Logging)
├── assets/ # Static resources (images, icons)
├── tests/ # pytest suite
├── main.py # Entry point
└── build.spec # PyInstaller configuration
Setup for Development
-
Clone & Install
git clone https://github.com/imutkarsht/Chess_analyzer.git cd Chess_analyzer # Create virtual environment python -m venv venv # Activate (Windows) .\venv\Scripts\activate # Install dependencies pip install -r requirements.txt -
Run Locally
python main.py
Development Guides
Common Scenarios
1. Changing "Blunder" Thresholds
To adjust how strict the move classification is:
- File:
src/backend/analyzer.py - Action: Locate
_classify_moveand adjust thewpl(Win Probability Loss) values.- Example: Change
if wpl >= 0.20:to0.30to make it less strict.
- Example: Change
2. Adding a New Column to Move List
- File:
src/gui/analysis_view.py - Action: In
MoveListPanelclass:- Update
setColumnCountcount. - Add a new header label.
- Populate the data in the
refreshmethod.
- Update
3. Adding a New API (e.g., Lichess)
- Backend: Create a new service in
src/backend/(referencechess_com_api.py). - GUI: Import it in
src/gui/main_window.pyand add a connection to a new Menu Action.
Testing
We use pytest for stability.
# Run all tests
pytest
# Run specific test
pytest tests/test_game_load.py
[!IMPORTANT] Always run tests after adding a new feature.
Building for Distribution
To create the ChessAnalyzerPro.exe file:
pyinstaller build.spec
The output will be located in the dist/ directory.