[0.4.0] add support for Needleman-Wunsch with scores; update Python version support#23
Merged
andrew-titus merged 21 commits intomainfrom Apr 13, 2026
Merged
[0.4.0] add support for Needleman-Wunsch with scores; update Python version support#23andrew-titus merged 21 commits intomainfrom
andrew-titus merged 21 commits intomainfrom
Conversation
…ersion support Add needleman_wunsch_with_scores() function that accepts a custom pairwise scoring function (score_fn: Callable[[T, T], float]) instead of flat match/mismatch scores, enabling continuous similarity measures for applications like OCR text alignment. Also updates Python version support to 3.10-3.14 (dropping EOL 3.9, adding 3.14), adds CHANGELOG.md with full release history, and updates documentation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace black, flake8, isort, pylint, pydocstyle, and bandit with ruff (lint + format) and mypy. All Python lint/format configuration is now consolidated in pyproject.toml. Coverage config also moved from .coveragerc to pyproject.toml. Removed: setup.cfg, .pylintrc, .pydocstyle, .pydocstyle_test, mypy.ini, .coveragerc. CI lint matrix reduced from 5 jobs to 3 (fast-linters, mypy, cargo-clippy). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two tests had wrong expected alignments: - test_asymmetric_scores: expected alignment scored -3 but algorithm correctly finds alignment scoring 1 - test_scores_prefer_gaps_over_bad_match: expected a different tie-breaking path; updated to match diagonal > left > up priority Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- CHANGELOG: add Removed section for deleted legacy config files - README: replace stale black badge with ruff, add Development section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…pdate CHANGELOG - Rust edition 2024 not yet supported by Maturin; revert to 2021. - PyO3 0.28 handles extension-module automatically; remove from maturin config. - Update CHANGELOG to reflect actual Cargo changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PyO3 0.28 removed the GIL-dependent &PyModule in favor of &Bound<'_, PyModule> for #[pymodule] init functions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
abi3-py311 uses PyType_GetName which doesn't exist in Python 3.10, causing ImportError on the lowest supported version. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- lint.sh: replace --run-only-fast-linters with individual flags for each linter (copyright-check, ruff-check, ruff-format, cargo-fmt) - lib.rs: extract needleman_wunsch_core helper with closure-based scoring to eliminate duplication between NW and NW-with-score-matrix - CHANGELOG: document both refactors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
andrew-titus
commented
Apr 7, 2026
| /// A Python module implemented in Rust. | ||
| #[pymodule] | ||
| fn _sequence_align(_py: Python, m: &PyModule) -> PyResult<()> { | ||
| fn _sequence_align(m: &Bound<'_, PyModule>) -> PyResult<()> { |
Collaborator
Author
There was a problem hiding this comment.
Note for reviewer -- this was required from an API change in pyo3
Uses char-overlap scoring function for a realistic continuous-similarity benchmark. Runtime and memory thresholds calibrated on R5.4 instance. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AmieRamie
reviewed
Apr 9, 2026
AmieRamie
reviewed
Apr 9, 2026
AmieRamie
previously approved these changes
Apr 9, 2026
AmieRamie
left a comment
There was a problem hiding this comment.
Just had some NIT's, otherwise LGTM
libinliang866
left a comment
There was a problem hiding this comment.
Hi Drew — sorry for the late review. I just noticed the request in my personal email. I’ve left one small question regarding the default value of gap; otherwise, everything looks good to me. Hope you’re feeling better soon.
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.
Summary
needleman_wunsch_with_scores()supporting custom pairwise scoring functions (score_fn(a, b) -> float) for alignment with continuous similarity measures (e.g., spatial proximity, text edit distance, character overlap) instead of binary match/mismatch.BoundAPI migration) and stable ABI minimum from Python 3.7 to 3.10. Update Python version support to 3.10-3.14 (drop 3.9, add 3.14).--run-only-*flag inscripts/lint.sh.needleman_wunsch_corehelper parameterized by a scoring closure, eliminating code duplication between standard and score-matrix NW variants (zero runtime cost via monomorphization).needleman_wunsch_with_scoresand performance benchmarks (runtime + memory) using a char-overlap scoring function..pylintrc,.pydocstyle,.pydocstyle_test,.coveragerc,setup.cfg,mypy.ini); all configuration now inpyproject.toml. Add CHANGELOG.md with full version history.Test plan
pytest tests/unit -v)pytest tests/perf -v)./scripts/lint.sh)./scripts/lint.sh --run-only-ruff-check)🤖 Generated with Claude Code