v0.1.48 - Measurement Session Management (2025-12-14)¶
What Changed?¶
This release introduces the Measure class, a unified interface for managing measurement sessions with automatic metadata handling. The class streamlines threshold configuration, device metadata collection, and event reading with automatic metadata merging. This enables both CLI and TUI layers to share the same measurement logic, improving code maintainability and reducing duplication.
What's New¶
Main Feature: Measure Class for Session Management¶
What it does:
The Measure class provides a clean abstraction for measurement operations:
- Configures detection thresholds on multiple channels
- Collects device metadata (MAC address, firmware version, library version)
- Sets device RTC time for accurate event timestamps
- Reads events with automatic metadata merging into each response
How to use it:
- Create a measurement configuration
- Initialize the Measure instance
- Read events with metadata automatically included
Code example:
from kazunoko import connect, Measure, MeasureConfig
# Create measurement configuration
config = MeasureConfig(
thresholds={1: 300, 2: 300, 3: 300},
poll_count=25000,
)
# Connect and measure
with connect() as device:
measure = Measure(device, config)
metadata = measure.initialize() # Set thresholds, collect metadata
# Each event has metadata automatically merged
event = measure.read_event()
print(event.threshold1) # 300
print(event.mac_address) # Device MAC
print(event.kurikintons) # Firmware version
Installation¶
Quick Start¶
# Get the release
git checkout v0.1.48
# Setup
uv sync
# Run CLI
uv run kazunoko --help
# Test the measure command
uv run kazunoko measure "1:300;2:300;3:300" 10
What's Different from the Last Version?¶
✅ Added¶
- New
Measureclass for unified measurement session management - New
MeasureConfigdataclass for measurement configuration - New
MeasureMetadatadataclass for metadata collection - Automatic metadata merging into each detected event
- Export of
Measure,MeasureConfig,MeasureMetadatafrom main module
🔧 Changed¶
- Refactored
cli.measure()command to useMeasureclass - Simplified measurement workflow in CLI layer
🏗️ Architecture¶
- Single Responsibility:
Measureclass manages only session initialization and event reading - Reusability: CLI and TUI layers can now share the same measurement logic
- Extensibility: Foundation for future Monitor class with statistics
Is It Safe to Upgrade?¶
Backward Compatible: Yes
- The
measureCLI command works exactly as before - All existing functionality is preserved
- No breaking changes to public APIs
- New classes are additive only
Tests Passed¶
- ✅ Builds without errors
- ✅ Linting passes (ruff, mypy compatible)
- ✅ Tested with real device
- ✅ Mock device compatibility verified
- ✅ Metadata merging works correctly
Release Details¶
- Date: 2025-12-14
- Version: v0.1.48
- Files Changed: 3 (
measure.py,__init__.py,cli.py) - Commits: c0c21fa (feat: add Measure class for measurement session management)
Next Steps¶
The Measure class foundation is now ready for:
- TUI Monitor Implementation - Use
Measurefor real-time event display with statistics - Monitor Class - Extend
Measurewith buffering and statistical calculations - Unit Tests - Add test coverage for
Measureclass - Documentation - Expand API documentation with usage examples