testsAndMisc/python_pkg/stockfish_analysis
Krzysztof kuhy Rudnicki 2545d72710 test: achieve 100% branch coverage across all python_pkg packages
- Add comprehensive tests for all packages (3572 tests, 100% branch coverage)
- Split oversized test files to stay under 500-line limit
- Add per-file ruff ignores for test-appropriate suppressions
- Fix _cache_decks.py to properly convert JSON lists to tuples
- Add session-scoped conftest fixture for logging handler cleanup (Python 3.14)
- Update ruff pre-commit hook to v0.15.2
- Add codespell ignore words for test data
- Add generated output files to .gitignore
2026-03-21 17:51:36 +01:00
..
tests test: achieve 100% branch coverage across all python_pkg packages 2026-03-21 17:51:36 +01:00
__init__.py Fix test discovery and coverage for python_pkg modules 2025-12-02 22:33:34 +01:00
_move_analysis.py refactor: enforce 500-line limit on all Python source files 2026-03-17 22:47:42 +01:00
analyze_chess_game.py fix: resolve all pre-commit hook failures after file splits 2026-03-18 22:20:05 +01:00
README.md refactor: rename folders to fix N999, INP001, S311 linting rules 2025-11-30 21:20:17 +01:00
requirements.txt refactor: rename folders to fix N999, INP001, S311 linting rules 2025-11-30 21:20:17 +01:00
run.sh feat: added run sh and makefile scripts 2026-02-22 22:00:50 +01:00

Chess move analysis with Stockfish

This utility parses a PGN (or a log that contains a PGN section) and evaluates each move with a local Stockfish engine, printing a per-move quality rating.

Install

Install python dependencies:

pip install -r PYTHON/stockfish_analysis/requirements.txt

Ensure Stockfish is installed and available in your PATH (or provide the path via --engine). On Linux, you can typically install with your package manager or download a binary.

Run

From the repo root:

python3 PYTHON/analyze_chess_game.py lichess_bot_game_8GSdY3Ci.log

Options:

  • --engine /path/to/stockfish to specify a custom engine path
  • --time 0.2 seconds per evaluation (default)
  • --depth 12 fixed depth instead of time

The script prints a table with, for each ply:

  • side to move, SAN move, eval before/after from mover's POV, delta, classification, and Stockfish best move suggestion.