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.
Metadata
Release files for katagoanal 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| katagoanal-0.4.0.tar.gz | 25.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| katagoanal-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.6 kB
Release files / katagoanal-0.4.0.tar.gz
| Download URL | katagoanal-0.4.0.tar.gz |
|---|---|
| Size | 25.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e43bade78c8f05605077c6bf10b9d8467124c6b8ec34ae7e36b3390367a4582b
|
|
BLAKE2b-256 checksum How to use checksums |
a5a85c61af251a3f0b3831036340ca6888d86321f46fe2a0b1744d3c472dacf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.
Transparency logRelease files / katagoanal-0.4.0-py3-none-any.whl
| Download URL | katagoanal-0.4.0-py3-none-any.whl |
|---|---|
| Size | 21.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8fdd667efde812c5ab6df1bcf68511241a894e75330855c7aa3ecff3deb80c2c
|
|
BLAKE2b-256 checksum How to use checksums |
cebab71ee56ba95600944352328f71cf2c77962c9238df0f964e43d7143b3de3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.
Transparency log