v0.1.4 - Command Class Convenience Wrapper (2025-12-02)¶
What Changed?¶
This release introduces the Command class, a convenient wrapper around device queries that improves code readability and discoverability. Developers can now use intuitive alias methods like cmd.status() instead of constructing command strings manually. The feature maintains full backward compatibility with existing APIs and works with both real and mock device implementations.
What's New¶
Main Feature: Command Class¶
What it does:
The Command class provides convenient alias methods for common OSECHI detector queries. Instead of manually constructing command strings and calling device.query(), developers can now use self-documenting method names like help(), status(), threshold(), and thresholds().
How to use it:
- Import the
Commandclass from kazunoko - Create an instance with a device (PortDevice or mock)
- Call convenience methods to query the device
- Access response fields dynamically
Code example:
from kazunoko import connect, Command
with connect() as device:
cmd = Command(device)
# Get device status
resp = cmd.status()
print(resp.status) # "ok"
print(resp.version) # "1.9.8"
print(resp.poll_count) # 100
# Set single threshold
resp = cmd.threshold(1, 300)
# Batch set thresholds
responses = cmd.thresholds({1: 300, 2: 400, 3: 500})
for resp in responses:
print(resp.status) # "ok"
Installation¶
This release is available on the main branch. No new dependencies were added.
Quick Start¶
# Update to latest main
git checkout v0.1.4
# Install/update dependencies
task env:setup
# Verify Command class works
python -c "from kazunoko import Command; print('✓ Command imported successfully')"
What's Different from the Last Version?¶
✅ Added¶
- Command class (
src/kazunoko/command.py) with 4 convenience methods: help()— Query available commands from devicestatus()— Get device status and metadatathreshold(channel, value)— Set single channel thresholdthresholds(channels_dict)— Batch set multiple channel thresholds- Public API export —
Commandimportable fromkazunokopackage - Complete specification — Feature spec, plan, research, data model, and quickstart in
specs/001-command-class/ - Type-safe design — Full DeviceProtocol support for both PortDevice and MockDevice
🔧 Changed¶
- Updated
src/kazunoko/__init__.pyto export Command class
🐛 Fixed¶
- None (no bug fixes in this release)
Is It Safe to Upgrade?¶
Backward Compatible: ✅ Yes
- No breaking changes to existing APIs
- No new dependencies added
- Existing device.query() usage continues to work unchanged
- New Command class is optional — users can adopt at their own pace
Tests Passed¶
- ✅
uvx ruff check src/kazunoko/command.py— Code style validation - ✅
uvx mypy --ignore-missing-imports src/kazunoko/— Type safety verification - ✅
from kazunoko import Command— Import verification - ✅ Pre-commit hooks — Conventional commit validation
Release Details¶
- Date: 2025-12-02
- Version: v0.1.4
- Version Type: MINOR (new feature, backward compatible)
- Files Changed: 12
- New:
src/kazunoko/command.py(158 lines) - Modified:
src/kazunoko/__init__.py - Added: Full feature specification in
specs/001-command-class/ - Commits:
ae143c8- feat(command): add Command class with convenience methods811ff0a- docs(tasks): mark all tasks as completed
Next Steps¶
Future development will focus on: 1. Testing — Comprehensive unit test suite for Command class (separate feature spec) 2. MockDevice Enhancement — Support SET_THRESHOLD responses in mock device 3. Additional Methods — More convenience methods based on user feedback 4. Documentation — Usage guide and integration examples in README