Registry / data / glicko2

glicko2

JSON →
library2.1.0pypypi✓ verified 85d ago

A Python implementation of the Glicko-2 rating system, used for ranking players in games like chess or esports. Current version 2.1.0, requires Python >=3.7. Maintained, release cadence irregular.

pip install glicko2
INSTALL
IMPORT
SIG · GLICKO2
G
glicko2
datapythonv2.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Player
from glicko2 import Player
import glicko2
Direct import of module does not give attributes; use explicit class import.

Create two players, simulate a match, and print updated ratings.

from glicko2 import Player # Initialize with default rating (1500), rating deviation (200), volatility (0.06) p1 = Player() p2 = Player() # Simulate a match: p1 wins p1.update_player([p2], [1.0]) p2.update_player([p1], [0.0]) print(p1.rating, p1.rd, p1.vol) print(p2.rating, p2.rd, p2.vol)
Debug
Known issues
gotchaThe Player.update_player() method modifies the player in place; it does not return a new Player object.
fix
Call update_player and then access the updated attributes on the same object.
affects: all
gotchaIf you pass an empty list of opponents to update_player, the player's rating will drift toward the mean, which can cause unexpected rating changes.
fix
Only call update_player with non-empty opponent lists and corresponding scores.
affects: all
deprecatedThe function glicko2.glicko2() is deprecated in favor of the Player class interface. Direct function usage may be removed in future versions.
fix
Use the Player class and its update_player method instead.
affects: >=2.0.0
Errors
Common errors & fixes
AttributeError: module 'glicko2' has no attribute 'Player'
Common mistake: importing the module instead of the class.
fix
Use 'from glicko2 import Player' instead of 'import glicko2'.
TypeError: update_player() missing 1 required positional argument: 'scores'
Calling update_player with only opponent list, missing scores list.
fix
Provide both opponent list and scores list, e.g., update_player([opponent], [1.0]) for a win.
ValueError: The ratings list must contain at least 1 opponent
Passing an empty list to update_player.
fix
Ensure opponents list is non-empty before calling update_player.
Upgrade
Version history
2.1.0latest on PyPI · released Jan 18, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
6
Amazon
1
OpenAI (training)
1
Resources
glicko2 — pip install glicko2 · libregistry