v0.1.56 - Public API for Threshold Parsing (2025-12-15)¶
What Changed?¶
This release moves the threshold parsing utility to the public API, making it reusable in standalone scripts. Users no longer need to duplicate threshold parsing logic in their applications. The change maintains full backward compatibility with all existing features.
What's New¶
Public API: parse_thresholds() Function¶
What it does:
Provides a reusable threshold string parser that converts human-readable threshold specifications (e.g., "1:300;2:300;3:300") into a Python dictionary. This was previously an internal CLI-only utility.
How to use it:
Import parse_thresholds from kazunoko and use it in your scripts to parse threshold configurations before passing them to the Command API.
Code example:
from kazunoko import parse_thresholds, Command, connect
# Parse threshold string
thresholds = parse_thresholds("1:300;2:300;3:300")
# Returns: {1: 300, 2: 300, 3: 300}
# Use with Command API in your script
with connect() as device:
cmd = Command(device)
cmd.thresholds(thresholds)
Installation¶
Quick Start¶
# Get the release
git checkout vX.Y.Z
# Setup
task env:setup
# Run CLI
uv run kazunoko --help
What's Different from the Last Version?¶
✅ Added¶
- Public API function
parse_thresholds()inparser.pymodule for parsing threshold configuration strings - Export of
parse_thresholdsin__all__for public API availability
🔧 Changed¶
- Moved threshold parsing logic from CLI-internal
_parse_thresholds()to publicparse_thresholds()function - CLI commands (
measure,threshold) now use the public API version for consistency
🐛 Fixed¶
- None (refactoring release)
Is It Safe to Upgrade?¶
Backward Compatible: Yes
- No breaking changes. All existing CLI commands work identically.
- New
parse_thresholds()is purely additive and optional to use. - Existing code using CLI commands continues to work without modification.
Tests Passed¶
- ✅ Builds without errors
- ✅ Type checking passes (mypy)
- ✅ Linting passes (ruff)
- ✅ CLI commands (measure, threshold) work correctly with new API
Release Details¶
- Date: 2025-12-15
- Version: v0.1.56
- Files Changed: 3 (parser.py, init.py, cli.py)
- Commits: 66f8fed (refactor: move parse_thresholds to public API in parser module)
Next Steps¶
- Consider adding similar utility functions for other CLI-specific parsing logic
- Expand public API documentation with more standalone script examples
- Gather feedback on ease of use for threshold configuration in scripts