openskill.py
raw JSON → 6.2.0 verified Fri May 01 auth: no python
Multiplayer rating system implementing the Weng-Lin models (Plackett-Luce, Bradley-Terry, Thurstone-Mosteller). Pure Python, no dependencies. Version 6.2.0 requires Python ~=3.10. Active development with regular releases.
pip install openskill Common errors
error ImportError: cannot import name 'rate' from 'openskill' ↓
cause Trying to import rate as a top-level function directly, but it's a module function.
fix
Use
import openskill then openskill.rate(...). error AttributeError: module 'openskill' has no attribute 'Rating' ↓
cause typo: 'Rating' not 'rating'.
fix
Use
openskill.Rating() (capital R). error ValueError: A team should have at least one player ↓
cause Passing an empty list as a team.
fix
Ensure each team has at least one Rating object.
error TypeError: __init__() got an unexpected keyword argument 'limit_sigma' ↓
cause Using a pre-6.0.0 version where limit_sigma wasn't a parameter.
fix
Upgrade to openskill>=6.0.0 or omit the parameter.
Warnings
breaking In v6.0.0, the `limit_sigma` parameter is no longer implicitly set; you must pass it explicitly if you want sigma to have a floor. ↓
fix Add `limit_sigma=True` to your rating or create Rating objects with `limit_sigma` parameter.
breaking v6.1.3 fixed a critical bug where players could gain infinite rating under certain conditions. Ensure you are on at least 6.1.3. ↓
fix Upgrade to openskill>=6.1.3.
deprecated Python 3.9 support dropped in v6.0.1. Use Python 3.10+. ↓
fix Use Python >=3.10.
gotcha The `rate` function expects a list of lists (teams) and returns updated teams. Mutating the input objects may lead to unexpected results. ↓
fix Treat tuples as immutable; do not modify original Rating objects after passing to rate.
gotcha Ranks are zero-indexed (lower rank = better). If you pass ranks incorrectly, win/loss direction may invert. ↓
fix Use ranks=[0,1] where team1 is better (lower rank) than team2.
Imports
- openskill wrong
from openskill import *correctimport openskill - rate
openskill.rate(t1, t2)
Quickstart
import openskill
# Define two teams with one player each
team1 = [openskill.Rating(mu=25, sigma=8.33)]
team2 = [openskill.Rating(mu=25, sigma=8.33)]
# Team1 wins (lower rank is better, ranks default to 0,1,...)
team1, team2 = openskill.rate([team1, team2], ranks=[0, 1])
print(team1[0])
print(team2[0])