KataGoAnal
Inject KataGo analysis — winrate, score lead, uncertainty — into SGF game records as standard C[...] comments. The output is readable by any SGF viewer (Sabaki, LGS, OGS, etc.), not just Sabaki. Designed exclusively for KataGo and cross-platform (Linux / macOS / Windows).
Project Structure
KataGoAnal/
├── pyproject.toml # pip packaging metadata (name, version, dependencies, entry point)
├── README.md # This document
│
├── KataGoAnal/ # Python package (the body of pip install)
│ ├── __init__.py # Package declaration
│ ├── cli.py # Command dispatch + argparse (-h/-c/-m/-v/-o/--visits)
│ ├── configure.py # katagoanal configure / init interactive setup
│ ├── sgf_io.py # SGF read/write (sgfmill wrapper)
│ ├── katago_driver.py # KataGo analysis subprocess driver
│ ├── inject.py # Inject analysis as C[...] comments into game records
│ ├── paths.py # User config directory + paths.json I/O + cfg read/write
│ └── configs/
│ └── config.cfg # Bundled KataGo engine parameter template (shipped with package)
│
└── tests/ # Test suite (pytest tests/)
├── fixtures.py # Synthetic SGF test data
├── test_cli.py # CLI tests
├── test_configure.py # Configuration flow tests
├── test_sgf_io.py # SGF logic tests
├── test_katago_driver.py # Driver logic tests
├── test_inject.py # Injection logic tests
└── test_paths.py # Paths I/O tests
Configuration Files
| File | Purpose | Consumer |
|---|---|---|
pyproject.toml |
pip packaging metadata: name, version, dependencies, entry point, package scope | pip install |
KataGoAnal/configs/config.cfg |
Bundled KataGo engine parameter template: reportAnalysisWinratesAs=BLACK, maxVisits, numAnalysisThreads, etc. |
Copied by configure on first run |
~/.config/katagoanal/paths.json |
Three user-configured paths: binary, model, config | katagoanal at runtime |
~/.config/katagoanal/config.cfg |
User copy (configure copies from bundled template and rewrites threads/visits) |
katago analysis subprocess |
Installation
pip install katagoanal # Regular install
The console command katagoanal is available after installation. Manual configuration is required before first use.
Configuration
katagoanal configure
Interactive flow (brackets show the saved path; empty on a fresh install):
KataGo engine path []: /home/user/katago/katago
Model file (.bin) []: /home/user/katago/model.bin
Config file (.cfg) [/home/user/.config/katagoanal/config.cfg]:
Threads [8]:
Visits [800]:
- Fresh install: brackets are empty — you must enter the paths.
- Reconfigure: brackets show previously saved paths — press Enter to keep.
- Non-existent paths are rejected with an error and you are prompted again.
Commands
katagoanal -h, --help # Help
katagoanal -v, --version # Version number
katagoanal -c, --config # Current configuration (3 paths + visits/threads)
katagoanal -m, --model # Model weight path + engine version
katagoanal configure | init # Interactive setup
katagoanal <file.sgf> # Inject analysis (winrate, score lead, uncertainty)
katagoanal <file.sgf> --visits 500 -o <dir> # Custom visits and output directory
katagoanal <file.sgf> -l zh # Chinese comment labels
katagoanal <file.sgf> --clear-comments # Overwrite existing comments
Usage
# Basic usage
katagoanal game.sgf
# Specify visits and output directory
katagoanal game.sgf --visits 500 -o output/
# Batch processing
katagoanal record/*.sgf --visits 800 -o injected/
# Chinese labels
katagoanal record/*.sgf --visits 800 -o injected/ -l zh
# Clear existing comments before writing
katagoanal record/*.sgf --visits 800 -o injected/ --clear-comments
# Directories expand to *.sgf automatically
katagoanal record/
-o/--output: Output directory (must already exist; default: current directory). Produces<stem>.injected.sgf.-l/--language: Comment language —en(English) orzh(Chinese). Controls field labels and colon style. Numeric values are always in Arabic numerals. (default:en).--clear-comments: Clear any existingC[...]comments on each node before writing new analysis data. By default, new content is prepended before existing comments, separated by a blank line.--visits: KataGo search visits per move (default:maxVisitsfrom config.cfg, falling back to 800).
Parameter Priority
- Komi, rules (
RU), board size, and handicap from the SGF are always sent with every query and take priority. - Rules are read from the SGF
RUproperty; if absent, they are inferred from komi. config.cfgholds only engine-level defaults (visits, threads, Black perspective) and never overrides game-specific parameters.- Analysis data is written into the standard
C[...]comment property on each node, with perspective dynamically switching per move (Black's turn → Black perspective, White's turn → White perspective). The root node also gets a full metadata header including engine info, match rates, and key deviations. - Per-move comments include winrate/score lead with inline ± uncertainty (from KataGo's
rawStWrError/rawStScoreError), deltas versus the previous position, komi, and an engine info suffix line.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file katagoanal-0.4.0.tar.gz.
File metadata
- Download URL: katagoanal-0.4.0.tar.gz
- Upload date:
- Size: 25.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e43bade78c8f05605077c6bf10b9d8467124c6b8ec34ae7e36b3390367a4582b
|
|
| MD5 |
a81afe5892f47d7e40d033e85a02229f
|
|
| BLAKE2b-256 |
a5a85c61af251a3f0b3831036340ca6888d86321f46fe2a0b1744d3c472dacf0
|
Provenance
The following attestation bundles were made for katagoanal-0.4.0.tar.gz:
Publisher:
publish.yml on Hoigin/KataGoAnal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
katagoanal-0.4.0.tar.gz -
Subject digest:
e43bade78c8f05605077c6bf10b9d8467124c6b8ec34ae7e36b3390367a4582b - Sigstore transparency entry: 2335016348
- Sigstore integration time:
-
Permalink:
Hoigin/KataGoAnal@ad67d6698f5bbc054754005cf3ab51eed95f8b26 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/Hoigin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ad67d6698f5bbc054754005cf3ab51eed95f8b26 -
Trigger Event:
push
-
Statement type:
File details
Details for the file katagoanal-0.4.0-py3-none-any.whl.
File metadata
- Download URL: katagoanal-0.4.0-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fdd667efde812c5ab6df1bcf68511241a894e75330855c7aa3ecff3deb80c2c
|
|
| MD5 |
84584e1d663d31df82b8a1de96291f5d
|
|
| BLAKE2b-256 |
cebab71ee56ba95600944352328f71cf2c77962c9238df0f964e43d7143b3de3
|
Provenance
The following attestation bundles were made for katagoanal-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on Hoigin/KataGoAnal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
katagoanal-0.4.0-py3-none-any.whl -
Subject digest:
8fdd667efde812c5ab6df1bcf68511241a894e75330855c7aa3ecff3deb80c2c - Sigstore transparency entry: 2335016356
- Sigstore integration time:
-
Permalink:
Hoigin/KataGoAnal@ad67d6698f5bbc054754005cf3ab51eed95f8b26 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/Hoigin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ad67d6698f5bbc054754005cf3ab51eed95f8b26 -
Trigger Event:
push
-
Statement type: