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/ 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.0.tar.gz (2.2 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.0-py3-none-any.whl (2.5 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: shogiarena-0.3.0.tar.gz
  • Upload date:
  • Size: 2.2 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.0.tar.gz
Algorithm Hash digest
SHA256 efb4e0688ba49e126ebeaab5748c4fe88c95f86a677031fc17ddceacc77d6219
MD5 0a05c12ba40c155811058b6432c5a58c
BLAKE2b-256 09cbe1c079cf16a1379647ac073bd38f0f24e71c25f38be6de05cca51bbb81aa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: shogiarena-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 2.5 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 77d187c83a1cc42241330f8526c9c8b87122228a0c0b0325703cb09df28f2a8f
MD5 3ef9d0777ec762d480fccba3e80b3ede
BLAKE2b-256 d8a691f2d52234816c30bcff0043cb512223b4d52abb2af21a59a5aff0171930

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