Merged
Conversation
I changed my mind about downloading an using a local uv every time. I don't think that we need that level of dependency control in this project
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates VoteKit’s development tooling from Poetry/mypy to uv/ty (with Taskfile-driven workflows), updates CI/pre-commit accordingly, and applies a broad set of code/test updates to match the new typing expectations and updated APIs (e.g., RankBallot/RankProfile usage).
Changes:
- Replace Poetry-based workflows with
uv+go-task(Taskfile.yml) and switch type-checking from mypy to ty. - Refactor imports/typing across
src/and update tests to useRankBallot/RankProfileand explicit casts where needed. - Improve docs contributor content by generating the Sphinx contributing page from
CONTRIBUTING.md.
Reviewed changes
Copilot reviewed 214 out of 217 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_pref_interval.py | Formatting-only updates for ty/linters. |
| tests/test_e2e.py | Update ballot/profile types to RankBallot/RankProfile and remove ignores. |
| tests/test_animations.py | Update ballot/profile types; adjust typing casts; tweak failure behavior. |
| tests/representation_scores/test_winner_sets_r_representation_score.py | Switch to RankProfile/RankBallot and formatting updates. |
| tests/representation_scores/test_r_representation_score.py | Switch to RankProfile/RankBallot and formatting updates. |
| tests/pref_profile/utils/test_pp_tail.py | Import ordering + formatting updates. |
| tests/pref_profile/utils/test_pp_scores_dict.py | Add casts for ty and reorder imports. |
| tests/pref_profile/utils/test_pp_ranking_dict.py | Add casts for ty and reorder imports. |
| tests/pref_profile/utils/test_pp_head.py | Import ordering + formatting updates. |
| tests/pref_profile/utils/test_pp_ballot_dict.py | Import ordering update. |
| tests/pref_profile/utils/test_convert_row_to_score_ballot.py | Adjust candidates arg type (tuple) + formatting. |
| tests/pref_profile/utils/test_convert_row_to_rank_ballot.py | Import ordering + formatting of match strings. |
| tests/pref_profile/utils/test_convert_rank_profile_to_score_profile_via_score_vector.py | Import formatting changes. |
| tests/pref_profile/test_pp_factory.py | Import ordering and ProfileError import cleanup. |
| tests/pref_profile/score_profile/test_score_pp_str.py | Remove extra blank line. |
| tests/pref_profile/score_profile/test_score_pp_pickle.py | Use URLError import directly. |
| tests/pref_profile/score_profile/test_score_pp_from_df.py | Import ordering + formatting of constructor calls. |
| tests/pref_profile/score_profile/test_score_pp_errors.py | Import ordering + formatting. |
| tests/pref_profile/score_profile/test_score_pp_df.py | Import ordering. |
| tests/pref_profile/rank_profile/test_rank_pp_str.py | Remove extra blank line. |
| tests/pref_profile/rank_profile/test_rank_pp_pickle.py | Use URLError import directly. |
| tests/pref_profile/rank_profile/test_rank_pp_from_df.py | Import ordering + formatting of error asserts. |
| tests/pref_profile/rank_profile/test_rank_pp_errors.py | Import ordering + formatting. |
| tests/pref_profile/rank_profile/test_rank_pp_df.py | Import ordering. |
| tests/pref_profile/rank_profile/test_rank_pp.py | Import ordering + formatting. |
| tests/pref_profile/cleaned_profile/test_cleaned_score_pp.py | Strengthen parent type assertions + formatting. |
| tests/pref_profile/cleaned_profile/test_cleaned_rank_pp.py | Strengthen parent type assertions + formatting. |
| tests/plots/bar_plot/test_validate_inputs.py | Formatting of pytest.raises blocks. |
| tests/plots/bar_plot/test_set_defaults.py | Import ordering. |
| tests/plots/bar_plot/test_normalize.py | Import ordering + formatting. |
| tests/plots/bar_plot/test_multi_bar_plot.py | Import ordering. |
| tests/plots/bar_plot/test_bar_plot.py | Import ordering. |
| tests/plots/bar_plot/profile_bar_plot/test_profile_wrappers.py | Switch to RankBallot/RankProfile and reorder imports. |
| tests/plots/bar_plot/profile_bar_plot/test_profile_bar_plot.py | Switch to RankBallot/RankProfile and reorder imports. |
| tests/plots/bar_plot/profile_bar_plot/test_multi_profile_wrappers.py | Switch to RankBallot/RankProfile and reorder imports. |
| tests/plots/bar_plot/profile_bar_plot/test_multi_profile_bar_plot.py | Switch to RankBallot/RankProfile and reorder imports. |
| tests/plots/MDS/test_MDS.py | Import ordering. |
| tests/metrics/test_ballot_distance.py | Import ordering + formatting. |
| tests/matrices/test_convert_dict_to_mat.py | Import ordering. |
| tests/matrices/heatmap/test_validate_heatmap_inputs.py | Import ordering + formatting. |
| tests/matrices/heatmap/test_heatmap_snapshots.py | Import ordering + consolidate matplotlib colormap imports. |
| tests/matrices/heatmap/test_heatmap.py | Switch to RankBallot/RankProfile. |
| tests/matrices/candidate/comentions/test_comentions_matrix.py | Switch to RankBallot/RankProfile + formatting. |
| tests/matrices/candidate/comentions/test_comentions_above.py | Use ScoreBallot for negative case + casts for ty. |
| tests/matrices/candidate/comentions/test_comentions.py | Switch to RankBallot. |
| tests/matrices/candidate/candidate_distance/test_candidate_distance_matrix.py | Switch to RankBallot/RankProfile. |
| tests/matrices/candidate/candidate_distance/test_candidate_distance.py | Use ScoreBallot for negative case + casts for ty. |
| tests/matrices/candidate/boost/test_boost_prob.py | Import ordering + formatting. |
| tests/matrices/candidate/boost/test_boost_matrix.py | Switch to RankBallot/RankProfile + formatting. |
| tests/graphs/pairwise_comparison/test_pwc_graph.py | Add casts for ty; formatting/import ordering. |
| tests/graphs/pairwise_comparison/test_pairwise_dict.py | Switch to RankProfile/ScoreProfile in negative cases + casts for ty. |
| tests/graphs/pairwise_comparison/test_dominating_tiers.py | Import ordering. |
| tests/graphs/ballot/test_graph.py | Switch to RankBallot/RankProfile; adjust kwarg passing for a reserved name. |
| tests/elections/test_transfers.py | Import ordering. |
| tests/elections/test_election_model.py | Import ordering + formatting in docstring/asserts. |
| tests/elections/election_types/score/test_rating.py | Import ordering + formatting. |
| tests/elections/election_types/score/test_limited.py | Import ordering + formatting. |
| tests/elections/election_types/score/test_general_rating.py | Use ScoreProfile instead of PreferenceProfile for score elections. |
| tests/elections/election_types/score/test_cumulative.py | Use ScoreProfile and formatting updates. |
| tests/elections/election_types/ranking/test_top_two.py | Switch to RankBallot/RankProfile; casts for ty in negative cases. |
| tests/elections/election_types/ranking/test_simultaneous_veto.py | Add casts for ty for invalid literals + formatting. |
| tests/elections/election_types/ranking/test_schulze.py | Import ordering + casts for ty in negative cases. |
| tests/elections/election_types/ranking/test_ranked_pairs.py | Import ordering + casts for ty in negative cases. |
| tests/elections/election_types/ranking/test_plurality_veto.py | Formatting in generator expressions and strings. |
| tests/elections/election_types/ranking/test_plurality.py | Switch to RankBallot/RankProfile; casts for ty in negative cases. |
| tests/elections/election_types/ranking/test_irv.py | Cast invalid quota literal for ty; casts for ty in negative cases. |
| tests/elections/election_types/ranking/test_fast_irv.py | Cast invalid quota literal for ty; casts for ty in negative cases. |
| tests/elections/election_types/ranking/test_dominating_sets.py | Switch to RankBallot/RankProfile; casts for ty in negative cases. |
| tests/elections/election_types/ranking/test_borda.py | Switch to RankBallot/RankProfile; casts for ty in negative cases. |
| tests/elections/election_types/ranking/test_albany_stv.py | Cast CSV-loaded profile for ty; formatting. |
| tests/elections/election_types/ranking/test_alaska.py | Cast invalid quota literal for ty; casts for ty in negative cases. |
| tests/elections/election_types/approval/test_bloc_plurality.py | Cast for ty in negative type case; import ordering. |
| tests/elections/election_types/approval/test_approval.py | Cast for ty in negative type case; import ordering. |
| tests/cvr_loaders/test_load_scottish.py | Import ordering + formatting. |
| tests/conftest.py | Import ordering + formatting; minor refactors in helper asserts. |
| tests/cleaning/score_profiles/test_remove_cand_score_profile.py | Expect warning on grouping cleaned profiles. |
| tests/cleaning/score_profiles/test_clean_score_profile_errors.py | Cast for ty in negative type case. |
| tests/cleaning/score_profiles/test_clean_score_profile.py | Import ordering + formatting. |
| tests/cleaning/rank_profiles/test_remove_repeat_cands_ranked_profile.py | Switch to RankBallot/RankProfile; expect warning on grouping. |
| tests/cleaning/rank_profiles/test_remove_cand_ranked_profile.py | Switch to RankBallot/RankProfile; expect warning on grouping. |
| tests/cleaning/rank_profiles/test_remove_and_condense_ranked_profile.py | Switch to RankBallot/RankProfile; expect warning on grouping. |
| tests/cleaning/rank_profiles/test_condense_ranked_profile.py | Switch to RankBallot/RankProfile. |
| tests/cleaning/rank_profiles/test_cleaning_series_ranked_profile.py | Expect warning on grouping cleaned profiles. |
| tests/cleaning/rank_profiles/test_clean_ranked_profile_errors.py | Cast for ty in negative type case. |
| tests/cleaning/rank_profiles/test_clean_ranked_profile.py | Switch to RankBallot/RankProfile; formatting. |
| tests/cleaning/rank_ballots/test_remove_repeated_candidates_from_rank_ballot.py | Cast for ty in negative type case; formatting. |
| tests/cleaning/rank_ballots/test_remove_cand_from_rank_ballot.py | Import ordering. |
| tests/cleaning/rank_ballots/test_condense_rank_ballot.py | Import ordering. |
| tests/ballot_generators/std_generators/test_spacial.py | Add casts for ty in negative cases; formatting. |
| tests/ballot_generators/std_generators/test_ic.py | Import ordering + formatting. |
| tests/ballot_generators/std_generators/test_iac.py | Formatting in dict comprehensions. |
| tests/ballot_generators/bloc_slate_generators/test_name_pl.py | Import ordering + remove type ignore. |
| tests/ballot_generators/bloc_slate_generators/test_name_bt.py | Import ordering + formatting. |
| tests/ballot/test_ScoreBallot.py | Import ordering + formatting. |
| tests/ballot/test_RankBallot.py | Import ordering + formatting. |
| tests/ballot/test_Ballot.py | Import ordering + formatting. |
| src/votekit/representation_scores.py | Import ordering. |
| src/votekit/pref_profile/csv_utils/score_csv_utils.py | Import ordering + formatting of validations/parsing. |
| src/votekit/pref_profile/csv_utils/rank_csv_utils.py | Import ordering + formatting of validations/parsing. |
| src/votekit/pref_profile/csv_utils/csv_utils.py | Formatting of helper signature and error message concat. |
| src/votekit/pref_profile/csv_utils/init.py | Reorder exports for consistency. |
| src/votekit/pref_profile/cleaned_pref_profile.py | Adjust imports to avoid cycles; simplify set operations and errors. |
| src/votekit/pref_profile/init.py | Rework exports/import paths for new module layout and ty. |
| src/votekit/pref_interval.py | Import ordering + formatting. |
| src/votekit/plots/profiles/init.py | Reorder exports/imports. |
| src/votekit/plots/mds.py | Refactor MDS config (currently introduces invalid sklearn kwargs). |
| src/votekit/plots/init.py | Reorder exports/imports. |
| src/votekit/models.py | Adjust imports to avoid pref_profile package init overhead; formatting. |
| src/votekit/metrics/distances.py | Import ordering + small refactors; remove obsolete mypy ignore. |
| src/votekit/metrics/init.py | Reorder exports/imports. |
| src/votekit/matrices/heatmap.py | Import ordering + formatting; update type-checker comment. |
| src/votekit/matrices/candidate/comentions.py | Import ordering. |
| src/votekit/matrices/candidate/candidate_distance.py | Formatting of function signature and imports. |
| src/votekit/matrices/candidate/boost.py | Import ordering. |
| src/votekit/matrices/candidate/init.py | Reorder exports. |
| src/votekit/matrices/_utils.py | Import spacing + formatting; remove old type-ignore comment. |
| src/votekit/matrices/init.py | Reorder exports/imports. |
| src/votekit/graphs/pairwise_comparison_graph.py | Remove type-ignore imports; import ordering; minor formatting. |
| src/votekit/graphs/base_graph.py | Remove type-ignore import. |
| src/votekit/graphs/ballot_graph.py | Import ordering + formatting; add neighborhoods is None guard. |
| src/votekit/graphs/init.py | Reorder exports/imports. |
| src/votekit/elections/transfers.py | Import ordering + formatting. |
| src/votekit/elections/election_types/scores/rating.py | Import ordering + formatting; minor refactors. |
| src/votekit/elections/election_types/scores/init.py | Reorder exports. |
| src/votekit/elections/election_types/ranking/top_two.py | Fix imports to avoid package-level circulars; formatting. |
| src/votekit/elections/election_types/ranking/stv/utils.py | Import ordering + formatting. |
| src/votekit/elections/election_types/ranking/stv/init.py | Reorder exports. |
| src/votekit/elections/election_types/ranking/schulze.py | Import ordering + formatting. |
| src/votekit/elections/election_types/ranking/ranked_pairs.py | Import ordering + formatting. |
| src/votekit/elections/election_types/ranking/random_dictator.py | Import ordering + formatting. |
| src/votekit/elections/election_types/ranking/plurality_veto.py | Minor refactors; replace list-mult initialization; formatting. |
| src/votekit/elections/election_types/ranking/plurality.py | Import ordering + formatting. |
| src/votekit/elections/election_types/ranking/dominating_sets.py | Import ordering + formatting. |
| src/votekit/elections/election_types/ranking/condo_borda.py | Import ordering + formatting. |
| src/votekit/elections/election_types/ranking/borda.py | Import ordering + formatting. |
| src/votekit/elections/election_types/ranking/boosted_random_dictator.py | Import ordering + formatting. |
| src/votekit/elections/election_types/ranking/alaska.py | Fix imports to avoid package-level circulars; formatting. |
| src/votekit/elections/election_types/ranking/abstract_ranking.py | Import ordering + minor refactor. |
| src/votekit/elections/election_types/ranking/init.py | Reorder exports/imports. |
| src/votekit/elections/election_types/approval/approval.py | Import ordering + formatting. |
| src/votekit/elections/election_types/approval/init.py | Remove extra blank line. |
| src/votekit/elections/election_types/init.py | Reorder exports/imports. |
| src/votekit/elections/election_state.py | Combine dataclasses imports + formatting. |
| src/votekit/elections/init.py | Reorder exports/imports; move to absolute imports. |
| src/votekit/cvr_loaders/load_scottish.py | Import ordering + formatting. |
| src/votekit/cvr_loaders/load_ranking_csv.py | Import ordering + formatting; ensure object dtype for voter sets. |
| src/votekit/cvr_loaders/init.py | Remove extra blank line. |
| src/votekit/cleaning/score_profiles_cleaning.py | Import ordering + formatting; simplify DataFrame ops. |
| src/votekit/cleaning/score_ballots_cleaning.py | Import ordering. |
| src/votekit/cleaning/rank_profiles_cleaning.py | Import ordering + formatting; simplify comprehensions. |
| src/votekit/cleaning/rank_ballots_cleaning.py | Import ordering. |
| src/votekit/cleaning/init.py | Reorder exports/imports. |
| src/votekit/ballot_generator/std_generator/impartial_culture.py | Import ordering + formatting. |
| src/votekit/ballot_generator/std_generator/impartial_anon_culture.py | Import ordering + formatting. |
| src/votekit/ballot_generator/std_generator/init.py | Reorder exports/imports. |
| src/votekit/ballot_generator/bloc_slate_generator/slate_utils.py | Ensure Voter Set column uses object dtype; formatting. |
| src/votekit/ballot_generator/bloc_slate_generator/slate_plackett_luce.py | Import ordering; add runtime type-check for cohesion values. |
| src/votekit/ballot_generator/bloc_slate_generator/name_plackett_luce.py | Import ordering; ensure Voter Set column uses object dtype. |
| src/votekit/ballot_generator/bloc_slate_generator/cumulative.py | Formatting + minor refactors. |
| src/votekit/ballot_generator/bloc_slate_generator/config/validation.py | Formatting + stronger numeric checks/casts for DataFrame conversion. |
| src/votekit/ballot_generator/bloc_slate_generator/config/collections.py | Import ordering + ensure float conversion when storing series. |
| src/votekit/ballot_generator/bloc_slate_generator/cambridge.py | Import ordering + formatting. |
| src/votekit/ballot_generator/bloc_slate_generator/init.py | Reorder exports/imports. |
| src/votekit/ballot_generator/ballot_generator.py | Import ordering + formatting; simplify error raising. |
| src/votekit/ballot_generator/init.py | Reorder exports/imports. |
| src/votekit/ballot.py | Add overloads for Ballot.__new__; enforce ranking/scores exclusivity in subclasses. |
| src/votekit/init.py | Reorder exports/imports. |
| run_tests.sh | Remove Poetry-based test runner script. |
| poetry.toml | Remove Poetry virtualenv config. |
| docs/sync_contributing.py | New script to generate docs contributing page from CONTRIBUTING.md. |
| docs/index.rst | Update TOC entry to point at generated contributing page. |
| docs/conf.py | Auto-sync contributing page during docs build; adjust sys.path. |
| README.md | Update contributor instructions to uv + task workflow. |
| MANIFEST.in | Remove manifest include (packaging likely handled by hatch). |
| .pre-commit-config.yaml | Switch to local hooks that call Taskfile targets (uv-backed). |
| .gitignore | Ignore .task-tools and generated docs contributing page. |
| .github/workflows/test.yml | Switch CI tests to Taskfile; adjust snapshot artifact upload path. |
| .github/workflows/lint.yml | Switch CI lint/typecheck to Taskfile (black/isort/ruff/ty). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some major updates / standardization for dev tooling
Addresses #235
Also has fix for #339 since I had to change types up already.