rcv
is a Python library for tabulating ballots from ranked-choice elections.
The package is distributed under the BSD 3-Clause License.
from rcv import FractionalSTV, PreferenceSchedule
schedule = PreferenceSchedule.from_ballots([
("A", "B", "C"),
("A", "C", "B"),
("A", "C", "B"),
])
stv = FractionalSTV(schedule, seats=2)
winners = stv.elect()
assert winners == {"A", "C"}