{"id":15896207,"url":"https://github.com/numberoverzero/buscemi","last_synced_at":"2025-04-02T18:25:49.962Z","repository":{"id":142803938,"uuid":"170133583","full_name":"numberoverzero/buscemi","owner":"numberoverzero","description":"python library for interacting with uci https://en.wikipedia.org/wiki/Universal_Chess_Interface","archived":false,"fork":false,"pushed_at":"2024-06-21T15:53:31.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-08T09:12:16.591Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/numberoverzero.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-11T13:30:17.000Z","updated_at":"2024-06-21T15:53:35.000Z","dependencies_parsed_at":"2024-10-28T16:32:57.062Z","dependency_job_id":null,"html_url":"https://github.com/numberoverzero/buscemi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numberoverzero%2Fbuscemi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numberoverzero%2Fbuscemi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numberoverzero%2Fbuscemi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numberoverzero%2Fbuscemi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/numberoverzero","download_url":"https://codeload.github.com/numberoverzero/buscemi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246867727,"owners_count":20846800,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-06T09:06:52.540Z","updated_at":"2025-04-02T18:25:49.927Z","avatar_url":"https://github.com/numberoverzero.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# buscemi\n\nprovides asyncio interfaces to UCI.\n\n\n# High-level API\n\n```python3\n\nimport asyncio\nfrom buscemi import open_connection, SearchConfig, Position\n\n\nasync def main():\n    # https://chess.stackexchange.com/a/12581\n    fen = \"N7/P3pk1p/3p2p1/r4p2/8/4b2B/4P1KP/1R6 w - - 0 34\"\n\n    conn = await open_connection(\"stockfish\")\n    await conn.set_options(MultiPV=3)\n    search = await conn.search(\n        position=Position(fen=fen),\n        config=SearchConfig(movetime=30000))\n\n    seen = 0\n    while not search.is_done:\n        await search.wait_progress()\n        for line in search.info[seen:]:\n            print(line, flush=True)\n        seen = len(search.info)\n    print(search.bestmove, flush=True)\n\n    await conn.close()\n\n\nasyncio.run(main())\n```\n\n## Definitions\n\n```\nasync def open_connection(executable: str) -\u003e Connection\n```\n\n```\nConnection:\n    @classmethod\n    async def from_executable(executable: str) -\u003e Connection\n\n    async def initialize()\n    async def set_options(**options)\n    async def search(\n            position: Position=None,\n            config: SearchConfig=None) -\u003e Search\n    async def close()\n```\n\n```\nSearch:\n    position: Position\n    config: SearchConfig\n    engine_options: Dict[str, Any]\n\n    info: List[str]\n    bestmove: str\n\n    is_done: bool\n    was_stopped: bool\n\n    async def wait_progress()\n    async def wait_done()\n    async def stop()\n```\n\n```\nPosition:\n    fen: Optional[str]\n    moves: Tuple[str, ...]\n```\n\n```\nSearchConfig:\n    searchmoves: Tuple[str, ...] = field(default_factory=tuple)\n\n    wtime:  int = None\n    btime:  int = None\n    winc:  int = None\n    binc:  int = None\n    movestogo: int = None\n\n    depth: int = None\n    nodes: int = None\n    mate: int = None\n\n    movetime: int = None\n```\n\n# Low-level API\n\n```python\n\nimport asyncio\nfrom buscemi.connection import UciConnection, read\n\n\nasync def main():\n    # https://chess.stackexchange.com/a/12581\n    fen = \"N7/P3pk1p/3p2p1/r4p2/8/4b2B/4P1KP/1R6 w - - 0 34\"\n\n    conn = await UciConnection.from_executable(\"stockfish\")\n\n    await conn.uci()\n    await conn.setoption(\"MultiPV\", \"3\")\n    await conn.ucinewgame()\n    await conn.position(fen=fen)\n    await conn.isready()\n    await conn.go([\"movetime\", \"30000\"])\n\n    async for line in read(conn):\n        print(line, flush=True)\n        if line.startswith(\"bestmove\"):\n            break\n\n    await conn.quit()\n\n\nasyncio.run(main())\n```\n\n## Definitions\n\n```\nUciConnection:\n    @classmethod\n    async def from_executable(executable: str) -\u003e UciConnection\n\n    async def uci() -\u003e List[str]\n    async def debug(enable = True)\n    async def isready() -\u003e List[str]\n    async def setoption(name: str, value: str = None)\n    async def ucinewgame()\n    async def position(fen: str = None, moves: Iterable[str] = None)\n    async def go(args: List[str])\n    async def stop()\n    async def ponderhit()\n    async def quit()\n```\n\n```\nasync def read(conn: UciConnection) -\u003e AsyncIterator[str]\nasync def read_until(\n        conn: UciConnection,\n        pattern: Union[str, Pattern]) -\u003e AsyncIterator[str]:\nasync def write(conn: UciConnection, data: str, wait = True)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumberoverzero%2Fbuscemi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumberoverzero%2Fbuscemi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumberoverzero%2Fbuscemi/lists"}