feat: remove unused address_to_bytes helper#218
Merged
Conversation
The function was unused inside the library and silently returned only 4 bytes when packing a 6-byte MAC address, making the output incorrect for any caller that relied on its name. The maintainer confirmed in #53 that it can be dropped. BREAKING CHANGE: address_to_bytes is no longer exported from bluetooth_data_tools. Callers must compute the bytes themselves (for example via int.to_bytes(6, "big") on mac_to_int(address)). Closes #53 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #218 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 6
Lines 255 248 -7
Branches 38 37 -1
=========================================
- Hits 255 248 -7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
|
not marking as breaking as its likely dead in the wild and a major version bump would be worse |
bdraco
approved these changes
May 14, 2026
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.
What
Remove the unused
address_to_byteshelper from the public API and drop its test.Why
Issue #53 flagged that the function was unused inside the library and that its
test verified a buggy behavior:
Struct(">L")packs only 4 bytes, so a 6-octetMAC address gets silently truncated. Maintainer (@bdraco) confirmed on the
issue: "I can't seem to find any usage of it. I think we can drop it."
A grep across the local bluetooth-devices workspace (bleak-esphome,
thermopro-ble, habluetooth, dbus-fast, pySwitchbot) found no callers either —
only the bundled copy of this library itself.
How
address_to_bytesand theL_PACK = Struct(">L")constant fromsrc/bluetooth_data_tools/utils.py.__all__entry fromsrc/bluetooth_data_tools/__init__.py.test_address_to_bytesfromtests/test_utils.py.This is a breaking change to the public API. Anyone still relying on the
old (buggy) 4-byte output should compute the bytes themselves, e.g.
mac_to_int(addr).to_bytes(6, "big"). The commit is markedfeat!:sosemantic-release will pick it up as a major bump.
Testing
pytest tests/ --ignore=tests/benchmarks→ 63 passed locally.Closes #53
🤖 Generated with Claude Code
Quality Report
Changes: 3 files changed, 20 deletions(-)
Code scan: clean
Tests: failed ([Errno 13] Permission denied: 'pytest')
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline