Skip to content

3.4.0#332

Merged
peterrrock2 merged 303 commits intomainfrom
3.4.0
Apr 9, 2026
Merged

3.4.0#332
peterrrock2 merged 303 commits intomainfrom
3.4.0

Conversation

@peterrrock2
Copy link
Copy Markdown
Collaborator

@peterrrock2 peterrrock2 commented Feb 26, 2026

v3.4.0

Added

Changed

Fixed

prismika and others added 30 commits January 22, 2026 16:12
…the STVAnimation initialization, instead of supplying it to the call.
Bug fix: now considers unranked candidates as tied for last place, and thus able to be vetoed.
Various optimizations, most importantly relying on profile.df instead of duplicated Ballot objects
to conduct election. For deterministic tiebreak, approximately 50-60x faster than previous
implementation (testing on a 3-candidate election with 26k voters; was ~2.8s, now <0.05s). For
random tiebreak, only about 8-10x faster.
Now supports `tiebreak` = 'random', 'first_place', 'borda', and 'lex'.
`tiebreak` is no longer permitted to be `None`. The default value is 'first_place', and the backup
tiebreak is always 'lex', i.e., lexicographic/alphabetical.
Because PluralityVeto requires tiebreaking at the ballot level (rather than round level),
PluralityVeto does not report tiebreaks to ElectionState. However, a new attribute `tiebreak_order`
allows users to inspect the tiebreak order when using a non-random tiebreak method.
Refactored significantly for readability. Corrected existing documentation and added thorough
documentation and comments.
…in-elections

Tech debt/rename default constants in elections
BlockPlurality can be equally well defined as a Scoring rule and as a
Ranking rul, so we make a dispatch class that creates the appropriate
subclass.
Update docs and clean up some errors
This will be used to improve user's ability to zip large numbers of
profiles for modeling experiments
@peterrrock2 peterrrock2 marked this pull request as ready for review April 8, 2026 23:03
@peterrrock2 peterrrock2 requested a review from Copilot April 8, 2026 23:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR bumps VoteKit to v3.4.0 and modernizes the project’s packaging/tooling while adding and exposing new election methods and improving documentation/public import paths.

Changes:

  • Introduces new ranking elections (e.g., SimultaneousVeto, Schulze) and a unified BlockPlurality that dispatches by profile type.
  • Renames the election seat parameter from m to n_seats across election APIs with deprecation handling.
  • Migrates dev tooling from Poetry/Black/Mypy to uv/go-task/Ruff/Ty, updates docs, and patches __module__ for Sphinx-friendly public import paths.

Reviewed changes

Copilot reviewed 84 out of 303 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
src/votekit/elections/election_types/ranking/stv/init.py Re-export STV types and patch __module__ for Sphinx canonical paths
src/votekit/elections/election_types/ranking/simultaneous_veto.py Adds new SimultaneousVeto ranking election implementation
src/votekit/elections/election_types/ranking/schulze.py Adds new Schulze ranking election implementation
src/votekit/elections/election_types/ranking/ranked_pairs.py Renames mn_seats and updates initialization/logic accordingly
src/votekit/elections/election_types/ranking/random_dictator.py Renames mn_seats and adds deprecated kwarg handling
src/votekit/elections/election_types/ranking/plurality.py Renames mn_seats and updates docs/selection logic
src/votekit/elections/election_types/ranking/dominating_sets.py Minor formatting/import ordering cleanup
src/votekit/elections/election_types/ranking/condo_borda.py Renames mn_seats with deprecated kwarg handling
src/votekit/elections/election_types/ranking/borda.py Renames mn_seats with deprecated kwarg handling
src/votekit/elections/election_types/ranking/boosted_random_dictator.py Renames mn_seats and adds deprecated kwarg handling
src/votekit/elections/election_types/ranking/block_plurality.py Adds ranked-profile implementation for block plurality via Borda scoring
src/votekit/elections/election_types/ranking/alaska.py Tightens typing for quota/tiebreak and cleans imports/formatting
src/votekit/elections/election_types/ranking/abstract_ranking.py Adds n_seats to base ranking election and strengthens profile validation
src/votekit/elections/election_types/ranking/init.py Re-exports more elections and patches __module__ for Sphinx
src/votekit/elections/election_types/block_plurality.py Adds BlockPlurality dispatcher supporting RankProfile + ScoreProfile
src/votekit/elections/election_types/approval/approval.py Refactors approval/“bloc plurality” implementation and deprecation handling
src/votekit/elections/election_types/approval/init.py Restricts exports and patches __module__
src/votekit/elections/election_types/init.py Aggregates exports, adds new elections, patches __module__
src/votekit/elections/election_state.py Minor formatting cleanup
src/votekit/elections/_deprecation.py Adds helper for deprecated kwarg renames
src/votekit/elections/init.py Re-exports elections and patches __module__ for Sphinx
src/votekit/cvr_loaders/load_scottish.py Import ordering and minor formatting
src/votekit/cvr_loaders/load_ranking_csv.py Formatting + ensures Voter Set is object dtype when inserted
src/votekit/cvr_loaders/init.py Patches __module__ for canonical import paths
src/votekit/cleaning/score_profiles_cleaning.py Import ordering + formatting
src/votekit/cleaning/score_ballots_cleaning.py Import ordering
src/votekit/cleaning/rank_profiles_cleaning.py Import ordering + formatting
src/votekit/cleaning/rank_ballots_cleaning.py Import ordering
src/votekit/cleaning/init.py Reorders exports + patches __module__
src/votekit/ballot_generator/std_generator/spacial.py Docstring improvements + dataframe Voter Set dtype fix
src/votekit/ballot_generator/std_generator/impartial_culture.py Changes IC sampling approach, likely for performance
src/votekit/ballot_generator/std_generator/impartial_anon_culture.py Reworks IAC generation via stars-and-bars sampling
src/votekit/ballot_generator/std_generator/init.py Export ordering + patches __module__
src/votekit/ballot_generator/bloc_slate_generator/slate_utils.py Updates imports and ensures Voter Set dtype is object
src/votekit/ballot_generator/bloc_slate_generator/slate_plackett_luce.py Updates config import path + adds numeric validation
src/votekit/ballot_generator/bloc_slate_generator/slate_bradley_terry.py Updates config import path + formatting fixes
src/votekit/ballot_generator/bloc_slate_generator/name_plackett_luce.py Updates config import path + ensures Voter Set dtype is object
src/votekit/ballot_generator/bloc_slate_generator/name_bradley_terry.py Updates config import path + formatting fixes
src/votekit/ballot_generator/bloc_slate_generator/cumulative.py Updates config import path + formatting fixes
src/votekit/ballot_generator/bloc_slate_generator/config/validation.py Adds new bloc-slate config validation utilities
src/votekit/ballot_generator/bloc_slate_generator/config/collections.py Adds mutable collection wrappers for config objects
src/votekit/ballot_generator/bloc_slate_generator/config/init.py Exposes config utilities + patches __module__
src/votekit/ballot_generator/bloc_slate_generator/cambridge.py Updates config import path + formatting fixes
src/votekit/ballot_generator/bloc_slate_generator/init.py Re-exports + patches __module__
src/votekit/ballot_generator/ballot_generator.py Import ordering + formatting fixes
src/votekit/ballot_generator/init.py Re-exports + patches __module__
src/votekit/ballot.py Adds overloads + enforces mutual exclusivity of ranking vs scores
src/votekit/init.py Export ordering + patches __module__
scripts/draft_release.py Adds script to bump version and insert changelog header
run_tests.sh Removes Poetry-based test runner script
pyproject.toml Bumps version, migrates to uv dependency groups + hatch build backend
poetry.toml Removes Poetry virtualenv config
notebooks/Portland_D1_cleaned_votekit_pref_profile.csv Reorders candidate list output (data artifact)
notebooks/5_score_based.ipynb Updates examples to new parameter names and new output formatting
docs/user/tutorial/7_portland_case_study.rst Updates tutorial outputs and parameter renames
docs/user/tutorial/5_score_based.rst Updates tutorial for new score election parameter names
docs/user/tutorial/3_viz.rst Fixes doc link to a Sphinx ref target
docs/user/tutorial/1_intro.rst Updates displayed RankProfile output formatting
docs/sync_contributing.py Adds script to sync CONTRIBUTING.md into docs
docs/social_choice_docs/scr.rst Adds new sections + anchors for docs cross-references
docs/package_info/contributing.rst Removes old RST contributing page (replaced by generated MD)
docs/package_info/api.rst Switches docs to public re-exports and explicit autoclass/autofunction targets
docs/index.rst Updates contributing doc reference
docs/conf.py Runs contributing sync during Sphinx build and adjusts sys.path
Taskfile.yml Adds go-task workflow for formatting/linting/typecheck/tests/docs
README.md Updates contributor workflow to uv/go-task and new commands
MANIFEST.in Removes manifest rules (packaging strategy changed)
CONTRIBUTING.md Adds new contributor guide for uv/go-task/Ruff/Ty
CHANGELOG.md Adds a detailed Unreleased section for 3.4.0 changes
.pre-commit-config.yaml Switches hooks to local uv/go-task based commands
.github/workflows/test.yml Migrates CI tests from Poetry to go-task/uv
.github/workflows/lint.yml Migrates CI lint/typecheck from Poetry to go-task/uv
Comments suppressed due to low confidence (1)

src/votekit/elections/election_types/approval/approval.py:1

  • Approval currently has no __init__ enforcing approval constraints (e.g., per_candidate_limit=1 and no total budget), while the new initializer that sets per_candidate_limit=1 is attached to BlocPlurality. This makes Approval(...) behave like the base GeneralRating and breaks the intended API/export (approval/__init__.py exports only Approval). Move the initializer to Approval (or rename the class appropriately) so Approval actually implements approval voting, and keep BlocPlurality (if still needed) as the budget-limited variant with the correct semantics.
from typing import Optional

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/votekit/elections/election_types/ranking/abstract_ranking.py Outdated
Comment thread src/votekit/elections/election_types/ranking/simultaneous_veto.py
Comment thread src/votekit/elections/election_types/ranking/simultaneous_veto.py Outdated
Comment thread src/votekit/elections/election_types/ranking/schulze.py Outdated
Comment thread src/votekit/ballot_generator/std_generator/impartial_anon_culture.py Outdated
Comment thread .github/workflows/lint.yml
Comment thread scripts/draft_release.py
Comment thread docs/user/tutorial/7_portland_case_study.rst Outdated
Comment thread docs/user/tutorial/7_portland_case_study.rst Outdated
Comment thread src/votekit/elections/election_types/ranking/simultaneous_veto.py
@peterrrock2 peterrrock2 merged commit 189e61a into main Apr 9, 2026
4 checks passed
@peterrrock2 peterrrock2 deleted the 3.4.0 branch April 9, 2026 01:36
@peterrrock2 peterrrock2 restored the 3.4.0 branch April 9, 2026 12:54
@peterrrock2 peterrrock2 deleted the 3.4.0 branch April 10, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment