Skip to content

fix: Usearch binary metrics - #81

Merged
Pringled merged 3 commits into
mainfrom
fix/usearch-binary-metrics
Sep 25, 2026
Merged

Pringled merged 3 commits into
mainfrom
fix/usearch-binary-metrics

Conversation

@Pringled

Copy link
Copy Markdown
Member

This PR fixes the hamming and tanimoto metrics in the usearch backend. Every input raised a dimension mismatch, because usearch counts binary dimensions in bits while the backend passed the array width. They now take uint8 vectors bit-packed with np.packbits, and other dtypes get a clear error.

Also added a trusted publishing release workflow.

usearch counts the dimensions of binary metrics in bits and expects the
vectors bit-packed into uint8, but the backend passed the array width as
the number of dimensions, so every input raised a dimension mismatch.
Binary metrics now take np.packbits vectors, reject other dtypes with a
clear error, and report their width in bytes so insert accepts them.
@Pringled
Pringled requested a review from stephantul September 25, 2026 09:22

@stephantul stephantul left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lekker broodje hamming

@codecov

codecov Bot commented Sep 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
tests/test_vicinity.py 100.00% <100.00%> (ø)
vicinity/backends/usearch.py 97.43% <100.00%> (+0.51%) ⬆️
vicinity/version.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Pringled
Pringled merged commit 575e276 into main Sep 25, 2026
5 checks passed
@Pringled
Pringled deleted the fix/usearch-binary-metrics branch September 25, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants