Skip to main content

Asynchronous tournament and SPSA tuning platform for USI shogi engines

Project description

ShogiArena

CI Docs PyPI Python License

[!NOTE] This project is still moving quickly. Public APIs are being clarified, and breaking changes are accepted during development. See CHANGELOG for release notes.

Documentation: https://nyoki-mtl.github.io/ShogiArena/index.html Japanese README: README_ja.md

ShogiArena is a platform for running shogi engine tournaments, statistical testing, dashboard monitoring, and engine automation.

Public Python API

Supported import paths:

  • shogiarena.engine
  • shogiarena.tournament
  • shogiarena.cli
  • shogiarena.composition

Implementation modules live under shogiarena._core. They are importable but internal, and not covered by compatibility guarantees.

Installation

pip install shogiarena

Optional environment initialization:

shogiarena config init

This is useful when you need artifact-based engine resolution, placeholder variables such as {output_dir} / {engine_dir}, or shared cache settings.

Quick Examples

Use a USI engine from Python

import asyncio

from shogiarena.engine import UsiThinkRequest, create_engine


async def main() -> None:
    async with await create_engine("engine.yaml") as engine:
        result = await engine.think(
            sfen="startpos",
            request=UsiThinkRequest(movetime=5_000),
        )
        print(result.bestmove)


asyncio.run(main())

Run a tournament from Python

import asyncio

from shogiarena.tournament import run_tournament


async def main() -> None:
    await run_tournament(
        "tournament.yaml",
        run_dir="runs/example",
    )


asyncio.run(main())

Advanced runner construction

import asyncio

from shogiarena.tournament import (
    build_tournament_runner,
    create_run_storage,
    load_tournament_config,
)


async def main() -> None:
    config = load_tournament_config("tournament.yaml")
    storage = create_run_storage("runs/example")
    runner = build_tournament_runner(config, storage=storage)
    await runner.run()


asyncio.run(main())

CLI Examples

shogiarena run tournament configs/run/tournament/example.yaml
shogiarena run sprt examples/configs/run/sprt/example.yaml
shogiarena run spsa examples/configs/run/spsa/example.yaml

tournament and sprt are available both from CLI and the public Python API. spsa is currently CLI-first; its Python surface is not yet formalized.

Documentation

License

MIT. See LICENSE.

Project details


Download files

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

Source Distribution

shogiarena-0.4.0.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

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

shogiarena-0.4.0-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file shogiarena-0.4.0.tar.gz.

File metadata

  • Download URL: shogiarena-0.4.0.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for shogiarena-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c10cb89c24eaac426d4c8f392027571b3d045c15a6dda6339301d94e14bd8cad
MD5 96c6e4a3c1cc6f3fde0551163d2d8900
BLAKE2b-256 d53f92339c8b49caba3d067939bbaec508ef70fc3f75c1d884fb561df43c462c

See more details on using hashes here.

File details

Details for the file shogiarena-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: shogiarena-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for shogiarena-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b716310c2e63870c97b04d982d89d4c60999b93d0a678959a9b9bb49aac6a6f
MD5 8a924fce242d2b07515a09e28efde9aa
BLAKE2b-256 a495b70223ee0fc754881d9a4a774aed7dc4578edbca7547ac910c242a15f67d

See more details on using hashes here.

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