A minimal tournament pairing library for Python.
Project description
NYIG TD
A minimal Python library for tournament pairings.
Features
- Single Elimination pairing with automatic bye handling.
- Swiss pairing with score-based matching and repeat prevention.
- Seed-based matching (1 vs N, 2 vs N-1).
- Type-safe implementation.
Installation
pip install nyig-td
Usage
from nyig_td import Participant, create_single_elimination_bracket
players = [
Participant(id=1, name="Alice", seed=1),
Participant(id=2, name="Bob", seed=2),
Participant(id=3, name="Charlie", seed=3),
]
matches = create_single_elimination_bracket(players)
for match in matches:
p1_name = match.p1.name if match.p1 else "Bye"
p2_name = match.p2.name if match.p2 else "Bye"
print(f"{p1_name} vs {p2_name}")
Swiss Pairings
from nyig_td import Participant, create_swiss_pairings
players = [
Participant(id=1, name="Alice", seed=1),
Participant(id=2, name="Bob", seed=2),
Participant(id=3, name="Charlie", seed=3),
Participant(id=4, name="David", seed=4),
]
# Initial round
scores = {p.id: 0.0 for p in players}
history = {p.id: set() for p in players}
bye_history = set()
pairings = create_swiss_pairings(players, scores, history, round_number=1, bye_history=bye_history)
Development
This project uses uv for dependency management.
uv sync
uv run pytest
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
nyig_td-0.1.0.tar.gz
(3.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nyig_td-0.1.0.tar.gz.
File metadata
- Download URL: nyig_td-0.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c39b86118d004f5f4c531644fd032825d912d01a110b4ecce3eddf41389650f6
|
|
| MD5 |
a506db3208b2fdb2342ec8c474c60783
|
|
| BLAKE2b-256 |
58ef8386451934c96ad06f14061febe63fe5caf7ae62e71cbdacab275e1a3f22
|
File details
Details for the file nyig_td-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nyig_td-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59dfcdb6b6adfeaf2fdc2bd6e615f7e5182d832077bebdc4ab3575522b232f84
|
|
| MD5 |
0f4f41bacababf014f1a6513cc770a33
|
|
| BLAKE2b-256 |
4ac6e085b7ce46456cbeb8fe3cee483c72190e41c591970dd35899069057115d
|