Merged
Conversation
Collaborator
Neclow
commented
Jul 4, 2025
- rust: add more docstrings with examples for common public functions
- python: fix warnings from deepsource and linters
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR cleans up Python version utilities and test suites, replaces bare assert statements with proper exceptions, and enriches Rust modules with standardized doc comments and examples.
- Refactored
update_version.pyimports and error handling for version bumping utilities. - Consolidated and updated Python tests to reduce duplication and satisfy linters.
- Standardized Rust doc comments to use
# Examplesand added a CSC conversion method.
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| resources/update_version.py | Reordered imports, replaced asserts with ValueError, improved version‐tag handling |
| py-phylo2vec/tests/test_stats.py | Removed dead commented assertion |
| py-phylo2vec/tests/test_reorder.py | Adjusted imports to fix linter warnings |
| py-phylo2vec/tests/test_io.py | Factored out common test logic, updated exception checks |
| phylo2vec/phylo2vec/utils/vector.py | Replaced assert with ValueError in get_common_ancestor |
| phylo2vec/phylo2vec/stats/nodewise.py | Removed redundant dtype casts in precision |
| phylo2vec/phylo2vec/opt/_gradme_losses.py | Replaced assert with ValueError for matrix shape check |
| phylo2vec/phylo2vec/opt/_beagle_losses.py | Minor formatting cleanup |
| phylo2vec/phylo2vec/opt/_base.py | Added explicit mode validation and reordered imports |
| phylo2vec/phylo2vec/io/_validation.py | Replaced assert with ValueError in check_path |
| phylo2vec/phylo2vec/init.py | Removed unused sys import |
| phylo2vec/src/vector/ops.rs | Standardized doc comment headings (# Examples) |
| phylo2vec/src/vector/graph.rs | Standardized doc comment headings, added CSC doc example |
| phylo2vec/src/vector/convert.rs | Standardized doc comment headings, added new conversion methods |
| phylo2vec/src/vector/base.rs | Punctuation fixes in sample_vector docs |
| phylo2vec/src/tree_vec/mod.rs | Added module‐level doc comment |
| phylo2vec/src/newick/*.rs | Standardized doc comment headings across multiple functions |
| phylo2vec/src/matrix/*.rs | Standardized doc comment headings and added matrix examples |
Comments suppressed due to low confidence (2)
resources/update_version.py:78
- The docstring says an empty string is returned on git failures, but the code returns the input version or "0". Update the docstring to accurately describe the actual return values.
try:
py-phylo2vec/tests/test_stats.py:194
- [nitpick] There's a leftover commented-out assertion. Removing dead code improves readability and avoids confusion.
assert np.array_equal(func(inc).toarray(), d)
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.