Skip to content

v0.1.32 - Configurable Serial Timeout (2025-12-13)

What Changed?

This release adds a configurable --timeout option to all CLI commands, allowing users to adjust the serial communication timeout for different hardware setups and connection speeds. The feature maintains full backward compatibility with a sensible default of 0.1 seconds.


What's New

Main Feature: Configurable Serial Timeout

What it does: Adds a --timeout (short form: -t) command-line option to all device communication commands. Users can now specify custom timeout values in seconds for serial communication, which is useful when working with slower connections or different hardware configurations.

How to use it: Simply add the --timeout flag with a value (in seconds) to any CLI command:

# Default timeout (0.1s)
kazunoko status

# Custom timeout for slower connections
kazunoko status --timeout 0.5
kazunoko query STATUS -t 1.0
kazunoko read --timeout 0.3 --count 10

Code example(if relevant):

from kazunoko import connect

# Using custom timeout in Python API
device = connect("/dev/ttyUSB0", timeout=0.5)
response = device.query("STATUS")
device.close()

Installation

Quick Start

# Get the release
git checkout v0.1.32

# Setup (if needed)
uv sync

# Try the new timeout option
uv run kazunoko status --timeout 0.5 -v
uv run kazunoko query STATUS --help

What's Different from the Last Version?

✅ Added

  • timeout() method to Options class for consistent timeout option handling
  • --timeout / -t flag to all CLI commands: query, read, status, threshold, version, reset
  • timeout parameter to connect() factory function in Python API
  • Documentation examples showing timeout usage in both CLI and Python API

🔧 Changed

  • connect() function signature now accepts optional timeout parameter
  • _get_device() helper function updated to pass timeout to connect()
  • Command docstrings updated with timeout usage examples

🐛 Fixed

  • Whitespace formatting in device.py (auto-fixed by ruff)

Is It Safe to Upgrade?

Backward Compatible: Yes ✅

  • All timeout parameters are optional with sensible defaults (0.1 seconds)
  • Existing scripts and code will continue to work without modification
  • No breaking changes to APIs or command interfaces
  • Users can opt-in to custom timeout values as needed

Tests Passed

  • ✅ Ruff linting checks pass
  • ✅ CLI help shows timeout option for all commands
  • ✅ Timeout option accepted by all device commands
  • ✅ Default timeout works (0.1s)
  • ✅ Custom timeout values accepted (tested with --timeout 0.5)
  • ✅ Mock device integration works with timeout option

Release Details

  • Date: 2025-12-13
  • Version: v0.1.32
  • Files Changed: 4
  • src/kazunoko/options.py - Added timeout() method
  • src/kazunoko/device.py - Added timeout parameter to connect()
  • src/kazunoko/cli.py - Integrated timeout option across all commands
  • src/kazunoko/formatter.py - Auto-fixed by linter
  • Commits: a12ee71 (feat: add timeout option to CLI commands)

Next Steps

  • Consider adding timeout retry logic for unreliable connections
  • Explore async support if needed for high-frequency data streams
  • Monitor user feedback for optimal default timeout values