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.3.1.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.3.1-py3-none-any.whl (1.6 MB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for shogiarena-0.3.1.tar.gz
Algorithm Hash digest
SHA256 d6dbe3fc602b326b06c2c15011e93315474ccb4f3817f6d5a98087dfe44e5720
MD5 af6f5438196dc7ce7406fa56b2e4ac00
BLAKE2b-256 28ef6974248a4b63d93a62fcf1e167ba9c8b5fed5ad02f8a5b739ccd64f60127

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for shogiarena-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3333ccb1fbb5e5fd4ee9b4d5f965c48d687d60321b74a6c1e0d5c78184f2609c
MD5 1ff39c99b87b45ea30dac526c7464b9a
BLAKE2b-256 b2aacd7fe037e918a70c1bb1fa14cda1b780116ce861f22a269a6709c3a2a571

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