v0.1.37 - Fix Read Command Event Count Bug and Refactor for Clarity (2025-12-13)¶
What Changed?¶
This release fixes a critical bug in the read command where --count parameter was not properly limiting the number of events read. The command has been redesigned to make event count a required positional argument for clarity. The event reading logic has been completely refactored following SOLID principles (SRP, YAGNI) and now uses a cleaner architecture with explicit for-loops instead of while-True patterns.
What's New¶
Main Feature: Redesigned read Command¶
What it does:
The read command now requires you to specify the number of events to read as a positional argument. This makes the intent explicit and prevents accidental infinite reads. The command reads exactly N events from the detector, waiting up to --event-timeout seconds per event.
How to use it:
# Read 1 event
kazunoko read 1
# Read 10 events
kazunoko read 10
# Read 5 events with 3-second timeout per event
kazunoko read 5 --event-timeout 3.0
# Read 10 events in CSV format
kazunoko read 10 --format csv > events.csv
Code example (Python API):
from kazunoko import connect, Command
with connect() as device:
cmd = Command(device)
event = cmd.read() # Returns one event
# CLI orchestrates multiple reads
Installation¶
Quick Start¶
# Get the release
git checkout v0.1.37
# Setup
uv sync
# Run CLI
uv run kazunoko --help
What's Different from the Last Version?¶
✅ Added¶
- Event-focused terminology throughout CLI and internal code
🔧 Changed¶
readcommand signature:--count N→read N(required positional argument)- Event reading architecture: Replaced
while Trueloops with explicitforloops _poll_cycle()removed; replaced with focused_read_one_event()function- Internal naming:
count→event_count,poll_count→event_index,cycle_start_time→event_start_time
🐛 Fixed¶
- Critical:
--countparameter not properly limiting events inreadcommand - Event count now strictly enforced (reads exactly N events, then exits)
- Removed infinite loop patterns in favor of explicit control flow
Is It Safe to Upgrade?¶
Backward Compatible: No (CLI breaking change)
- The
readcommand signature has changed:kazunoko read --count 10→kazunoko read 10 - This is a breaking change for scripts using the old syntax
- The Python API (
Command.read()) is unchanged
Tests Passed¶
- ✅ Builds without errors
- ✅
kazunoko read 1reads exactly 1 event - ✅
kazunoko read 10reads exactly 10 events - ✅ Event timeout respected (waits up to
--event-timeoutper event)
Release Details¶
- Date: 2025-12-13
- Version: v0.1.37
- Files Changed: 1 (src/kazunoko/cli.py)
- Commits: 6 commits
d59bb7crefactor: standardize naming and terminology to event-focused7c3fde3refactor: rename poll_count to event_index for claritya43c395refactor: rename count parameter to event_count for consistency7912cd9refactor: make event count a required argument in read command70ae469refactor: simplify event reading logic with SRP and YAGNI8c056e1fix: replace infinite while loop with for loop in _read_events
Next Steps¶
- Documentation update needed for users migrating from v0.1.36
- Consider adding migration guide in CLI help text
- Monitor feedback on the new required argument pattern