Skip to main content

EN ZH

KataGoAnal

Inject KataGo win-rate (SBKV) and score lead (SBKS) into SGF game records. Sabaki recognizes these properties natively to render dual winrate/score-lead graphs. 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               # Write SBKV/SBKS 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 win-rate + score lead
katagoanal <file.sgf> --visits 500 -o <dir>   # Custom visits and output directory

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/

# Directories expand to *.sgf automatically
katagoanal record/
  • --visits: KataGo search visits per move (default: maxVisits from config.cfg, falling back to 800).
  • -o/--output: Output directory (must already exist; default: current directory). Produces <stem>.injected.sgf.

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 RU property; if absent, they are inferred from komi.
  • config.cfg holds only engine-level defaults (visits, threads, Black perspective) and never overrides game-specific parameters.
  • Injected SBKV (Black winrate, 0–100) and SBKS (Black score lead) are obtained directly from reportAnalysisWinratesAs=BLACK — no per-move flipping needed.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

katagoanal-0.3.0.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

katagoanal-0.3.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file katagoanal-0.3.0.tar.gz.

File metadata

  • Download URL: katagoanal-0.3.0.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for katagoanal-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b78a38670924713a2c9867b3cbb4958bae3d1cafdaf65ba1d42f41fbde2626fd
MD5 a6e668dcffc507055088134e8d5ccb95
BLAKE2b-256 59c2aa1503bde392a52606c3ed6921c28649e5726db9d04ab42077764aed8f00

See more details on using hashes here.

Provenance

The following attestation bundles were made for katagoanal-0.3.0.tar.gz:

Publisher: publish.yml on Hoigin/KataGoAnal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file katagoanal-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: katagoanal-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for katagoanal-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 802e6172a4fb81ad8f73ad77b13a8115dec857e33b9b6845a284126da55526d4
MD5 0f123cfb3fc9f77e964bdd93ce326fbb
BLAKE2b-256 e6882ae530d1a52d923e006ab41a4e6c2c21bc02ee5f23eec784a4b84bc878e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for katagoanal-0.3.0-py3-none-any.whl:

Publisher: publish.yml on Hoigin/KataGoAnal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page