A Python library for creating and managing tournament brackets
Project description
VersuPy
A comprehensive Python library for creating and managing tournament brackets with automated match handling.
Features
- 🏆 Multiple Tournament Formats: Single elimination, double elimination, round robin, and Swiss system
- 🎯 Clean API: Easy-to-use interface for tournament management
- 📊 Result Tracking: Comprehensive match and tournament result tracking
- 🧪 Well Tested: Extensive test coverage for all tournament formats
- 🔧 Type Safe: Full type hint support for better development experience
Installation
pip install versupy
Quick Start
from versupy import Tournament
# Create a single elimination tournament
competitors = ["Alice", "Bob", "Charlie", "David"]
tournament = Tournament(competitors, style="single")
# Get current round matches
matches = tournament.get_current_round_matches()
# Set match winners
for match in matches:
tournament.set_winner(match, match.competitor_a) # Alice and Charlie win
# Advance to next round
tournament.advance_to_next_round()
# Check if tournament is complete
if tournament.is_tournament_over():
champion = tournament.get_champion()
print(f"Tournament winner: {champion.name}")
Tournament Formats
Single Elimination
tournament = Tournament(competitors, style="single")
Double Elimination
tournament = Tournament(competitors, style="double")
Round Robin
tournament = Tournament(competitors, style="round_robin")
Swiss System
tournament = Tournament(competitors, style="swiss")
API Reference
Tournament Class
get_current_round_matches()- Get matches for the current roundset_winner(match, winner)- Set the winner of a matchadvance_to_next_round()- Progress to the next roundis_tournament_over()- Check if tournament is completeget_champion()- Get the tournament winnerget_results()- Get all match results
Match Class
set_winner(competitor)- Set match winnerget_winner()- Get match winnerget_loser()- Get match loser
Competitor Class
name- Competitor namewins- Number of winsmatches- List of matches played
Examples
See the examples/ directory for more detailed usage examples.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 versupy-0.1.0.tar.gz.
File metadata
- Download URL: versupy-0.1.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd615e2829f01e1e6e5fee3634946e287816c2677f36ad8171d43cb86aa3dc71
|
|
| MD5 |
faedbc8b45adc107bc7e47ffd934787b
|
|
| BLAKE2b-256 |
4f470cf20b260f605092d47247b48a6ba97e0d99e3768be82e4b0b4c3be0f25c
|
File details
Details for the file versupy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: versupy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
956ca627630cbfeea537c20311c1cd50123c569236c31ff33d46a236fa35b778
|
|
| MD5 |
6ae3ef14c1488cf91ac39822d94c2fdc
|
|
| BLAKE2b-256 |
7d08dfe823472da842fe5fceb126f0cf7e252a7f6e5d4b951efc5139c2cde1ad
|