Skip to main content

A Swiss Army Knife for computational social choice research

Project description

VoteKit

VoteKit is a Swiss army knife for computational social choice research.

Helpful links: Source Repository | Documentation | Issues | MGGG.org

PyPI badge Test badge

Installation

Votekit can be installed through any standard package management tool:

pip install votekit

or

poetry add votekit

Example

A simple example of how to use VoteKit to load, clean, and run an election using real data taken from the 2013 Minneapolis Mayoral election. For a more comprehensive walkthrough, see the documentation.

from votekit import load_csv, remove_noncands
from votekit.elections import STV

minneapolis_profile = load_csv("mn_2013_cast_vote_record.csv")

# clean downloaded file to remove edited aspects of the cast vote record
minneapolis_profile = remove_noncands(minneapolis_profile, ["undervote", "overvote", "UWI"])

minn_election = STV(profile = minneapolis_profile, m = 1)
minn_election.run_election()
                   Candidate     Status  Round
                BETSY HODGES    Elected     35
                 MARK ANDREW Eliminated     34
                 DON SAMUELS Eliminated     33
                  CAM WINTON Eliminated     32
          JACKIE CHERRYHOMES Eliminated     31
                    BOB FINE Eliminated     30
                   DAN COHEN Eliminated     29
          STEPHANIE WOODRUFF Eliminated     28
             MARK V ANDERSON Eliminated     27
                   DOUG MANN Eliminated     26
                  OLE SAVIOR Eliminated     25
               JAMES EVERETT Eliminated     24
           ALICIA K. BENNETT Eliminated     23
  ABDUL M RAHAMAN "THE ROCK" Eliminated     22
        CAPTAIN JACK SPARROW Eliminated     21
           CHRISTOPHER CLARK Eliminated     20
                   TONY LANE Eliminated     19
                JAYMIE KELLY Eliminated     18
                  MIKE GOULD Eliminated     17
             KURTIS W. HANNA Eliminated     16
 CHRISTOPHER ROBIN ZIMMERMAN Eliminated     15
         JEFFREY ALAN WAGNER Eliminated     14
                 NEAL BAXTER Eliminated     13
            TROY BENJEGERDES Eliminated     12
            GREGG A. IVERSON Eliminated     11
            MERRILL ANDERSON Eliminated     10
                  JOSHUA REA Eliminated      9
                   BILL KAHN Eliminated      8
         JOHN LESLIE HARTWIG Eliminated      7
      EDMUND BERNARD BRUYERE Eliminated      6
JAMES "JIMMY" L. STROUD, JR. Eliminated      5
            RAHN V. WORKCUFF Eliminated      4
       BOB "AGAIN" CARNEY JR Eliminated      3
                  CYD GORMAN Eliminated      2
         JOHN CHARLES WILSON Eliminated      1

Development

This project is in active development in the mggg/VoteKit GitHub repository, where bug reports and feature requests, as well as contributions, are welcome.

VoteKit project requires poetry, and Python >= 3.9. (This version chosen somewhat arbitrarily.)

To get up and running, run poetry install from within the project directory to install all dependencies. This will create a .venv directory that will contain dependencies. You can interact with this virtualenv by running your commands prefixed with poetry run, or use poetry shell to activate the virtualenv.

Once you've run poetry install, if you run poetry run pre-commit install it will install code linting hooks that will run on every commit. This helps ensure code quality.

To run tests run poetry run pytest or ./run_tests.sh (the latter will generate a coverage report).

To release, run poetry publish --build.

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

votekit-3.0.0.tar.gz (170.0 kB view details)

Uploaded Source

Built Distribution

votekit-3.0.0-py3-none-any.whl (187.2 kB view details)

Uploaded Python 3

File details

Details for the file votekit-3.0.0.tar.gz.

File metadata

  • Download URL: votekit-3.0.0.tar.gz
  • Upload date:
  • Size: 170.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for votekit-3.0.0.tar.gz
Algorithm Hash digest
SHA256 eb8600787625b6cb00e5fc97c59f34f71c7be93873709201187d14886c789ef1
MD5 d182738fa8491e84faf0dece2a40c476
BLAKE2b-256 715c0f1f2d9b7b1a60411934ec01ea34f07d2f873d8752ec5b30f10d184737b0

See more details on using hashes here.

File details

Details for the file votekit-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: votekit-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 187.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for votekit-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01a954ed6ee3c7cbfd1ed247d752152f6ad8c82a1e8525948c7e2b7479871b75
MD5 7902030d9dfe5d8e18506e932cc930e6
BLAKE2b-256 90428c03f9cbc4e8a614b606ff01cc5bdb6c26dc3afa3d9e893a4eb7db543e57

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page