Skip to main content

chess-results-api

PyPI version Python 3.12+ CI License: Apache 2.0

An experimental Python 3.12+ package for downloading Chess-Results tournament files and decoding Swiss-Manager data. Supports individual Swiss (TUNX), individual round-robin (TURX), team round-robin (TUTX), and team Swiss (TUMX). Local decoding has no runtime dependencies; downloading uses optional Playwright.

Installation

Install into a virtual environment using uv:

uv venv --python 3.12
uv pip install chess-results-api

Usage

from chess_results_api import load_tournament

tournament = load_tournament("tournament.TUMX")
print(tournament.metadata.name, tournament.tournament_type.name)
for round_ in tournament.rounds:
    for game in round_.games:
        print(game.white_player, game.black_player, game.result, game.points)

load_tournament(path) and decode_tournament(data: bytes) detect the format from its contents and return frozen, typed records for metadata, players, teams, rounds, pairings, and scores. Detected malformed or unsupported layouts raise SwissManagerDecodeError; filesystem errors propagate unchanged.

The decoder uses standard 1 / ½ / 0 scoring. Unknown results remain unscored, and unidentified data is preserved. It does not calculate rankings or tie-breaks. Player and team references are one-based, with special values for empty slots, byes, and unpaired entries. See the format notes for these conventions, observed layouts, and validation limits.

Download a tournament

Install the browser extra and Chromium once:

uv pip install "chess-results-api[browser]"
uv run --no-project playwright install chromium
from chess_results_api import download_tournament, load_tournament

path = download_tournament(1502346, "tournament.TUNX")
tournament = load_tournament(path)

The downloader opens the details form and follows the file link in an isolated browser session, blocking images, fonts, and media to reduce page traffic. It validates the binary and tournament ID before writing the destination, replacing an existing file. The parent directory must exist. Browser failures or unavailable downloads raise TournamentDownloadError; unsupported binaries raise SwissManagerDecodeError. Options include timeout=30 (seconds per browser operation) and headless=False.

Development

From a repository checkout:

uv sync --locked --extra browser
uv run playwright install chromium
uv run pytest
uv run ruff check .
uv run ruff format --check .
uv build

Local binaries and reference snapshots belong in tests/fixtures/, which is ignored by Git and excluded from distributions. Tests requiring missing fixtures skip; synthetic tests run offline without them. uv build creates distribution archives in dist/. Built wheels can be installed locally with uv pip install dist/chess_results_api-0.1.0-py3-none-any.whl. Browser tests use intercepted requests and skip when Playwright or Chromium is absent.

See CONTRIBUTING.md for commit and branch conventions, CHANGELOG.md for release notes, and citations.cff for citation metadata.

Metadata

Release files for chess-results-api 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chess-results-api 0.1.0
File Size Uploaded
chess_results_api-0.1.0.tar.gz 29.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chess-results-api 0.1.0
File Interpreter ABI Platform
chess_results_api-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 45.8 kB

Release files / chess_results_api-0.1.0.tar.gz

Download URL chess_results_api-0.1.0.tar.gz
Size 29.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4091fc4710558987aea5a27e3ab57259150de542c6cf0c5d472b3fbb974f6c54
BLAKE2b-256 checksum
How to use checksums
5c60bad585711d51b1dee233b72845f0067f72296e509c81ae7020fd11736127
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / chess_results_api-0.1.0-py3-none-any.whl

Download URL chess_results_api-0.1.0-py3-none-any.whl
Size 16.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86f83f0c81a55175bd14498ef2ec4b5b9bae8044570db8ade32a27fad15ccd5c
BLAKE2b-256 checksum
How to use checksums
db63ca983567f6ad88c5c4c6da1dfa67c780150bb28491d895e872d7d086dd31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page