Skip to content

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:

  1. Create a measurement configuration
  2. Initialize the Measure instance
  3. 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 Measure class for unified measurement session management
  • New MeasureConfig dataclass for measurement configuration
  • New MeasureMetadata dataclass for metadata collection
  • Automatic metadata merging into each detected event
  • Export of Measure, MeasureConfig, MeasureMetadata from main module

🔧 Changed

  • Refactored cli.measure() command to use Measure class
  • Simplified measurement workflow in CLI layer

🏗️ Architecture

  • Single Responsibility: Measure class 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 measure CLI 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:

  1. TUI Monitor Implementation - Use Measure for real-time event display with statistics
  2. Monitor Class - Extend Measure with buffering and statistical calculations
  3. Unit Tests - Add test coverage for Measure class
  4. Documentation - Expand API documentation with usage examples