v0.1.30 - Add Response Reception Timestamp (2025-12-08)¶
What Changed?¶
This release adds automatic reception timestamp tracking to all device responses. Every DeviceResponse object now includes a received_us field containing the Unix timestamp (seconds since epoch) when the response was received. This enables timing analysis and precise event correlation without relying on device-side timestamps alone.
What's New¶
Main Feature: Reception Timestamp Field¶
What it does:
The DeviceResponse model now includes an optional received_us field that is automatically populated whenever a response is received from either the real device or MockDevice. The timestamp is captured immediately upon reception, before parsing.
How to use it:
Simply access the received_us field from any response object:
Code example:
from kazunoko import connect
device = connect("/dev/ttyUSB0")
response = device.query("STATUS")
print(f"Response received at: {response.received_us}")
print(f"Response data: {response.status}")
device.close()
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¶
received_usfield toDeviceResponsemodel storing Unix timestamp of reception time- Automatic timestamp capture in
PortDevice.receive_response()for real device communication - Automatic timestamp capture in
MockDevice.receive_response()for testing scenarios
🔧 Changed¶
DeviceResponsemodel now includes optionalreceived_us: float | Nonefield- Updated docstrings for
receive_response()methods to document timestamp behavior
Is It Safe to Upgrade?¶
Backward Compatible: Yes
- The
received_usfield is optional (float | None), so existing code continues to work unchanged - Existing responses without explicit timestamp handling remain fully functional
- No breaking changes to any public API
Tests Passed¶
- ✅ Builds without errors
- ✅ MockDevice timestamp capture working correctly
- ✅ PortDevice timestamp integration verified
- ✅ Parser handles optional
received_usfield correctly - ✅ Ruff linting checks passed
Release Details¶
- Date: 2025-12-08
- Version: v0.1.30
- Files Changed: 3 (parser.py, device.py, mock.py)
- Changes: Added
received_ustimestamp field to DeviceResponse model and integrated with device communication layers
Next Steps¶
Future enhancements could include:
- Microsecond precision timestamps for high-speed event analysis
- Timestamp delta calculations for response timing analysis
- Integration with data logging and analysis tools