v0.1.25 - Enhanced Output Formatting (2025-12-07)¶
What Changed?¶
This release adds comprehensive output formatting support with new formats (SSV, TSV, LTSV) and refactors the internal formatter architecture for better maintainability. Default output now uses JSONL for structured logging, and the use_flat option defaults to True for compact output.
What's New¶
Main Feature: Extended Output Formatting¶
What it does: ResponseFormatter now supports 7 output formats: table, JSONL, JSON, CSV, SSV (space-separated values), TSV (tab-separated values), and LTSV (labeled tab-separated values). The LTSV format is particularly useful for structured logging with key=value pairs.
How to use it:
from kazunoko import Command, ResponseFormatter, connect
with connect() as device:
cmd = Command(device)
resp = cmd.status()
fmt = ResponseFormatter(resp)
fmt.display("ltsv") # Labeled tab-separated values
fmt.display("tsv") # Tab-separated values
fmt.display("ssv") # Space-separated values
Code example:
# All formatter methods work with the new formats
csv_output = fmt.to_csv() # "value1,value2,value3"
tsv_output = fmt.to_tsv() # "value1\tvalue2\tvalue3"
ssv_output = fmt.to_ssv() # "value1 value2 value3"
ltsv_output = fmt.to_ltsv() # "key1=value1\tkey2=value2\tkey3=value3"
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¶
to_ssv()- Space-separated values formatterto_tsv()- Tab-separated values formatterto_ltsv()- Labeled tab-separated values formatter (key=value pairs)- Support for ssv, tsv, ltsv formats in
display()method - Internal
_format_sv(delimiter)helper for consistent value formatting - Internal
_format_dict()helper for centralized data extraction
🔧 Changed¶
ResponseFormatter.display()default format:"table"→"jsonl"Options.format()default value:"table"→"jsonl"Options.use_flat()default value:False→True- Refactored CSV, TSV, SSV formatters to use
_format_sv()base method - Consolidated internal helper methods (
_format_dict()and_format_sv()) - Updated option documentation to reflect all supported formats
🗑️ Removed¶
to_csv_with_header()- Simplified API (users can construct headers separately)to_ssv_with_header()- Simplified APIto_tsv_with_header()- Simplified API
Is It Safe to Upgrade?¶
Backward Compatible: Mostly (with minor API changes)
- New default format is JSONL instead of table (better for logging/automation)
- New default for use_flat is True (more compact output)
- Removed
*_with_header()methods - users can construct headers manually if needed - All existing format options (table, csv, json, jsonl) still work unchanged
- CLI and library APIs remain fully functional with new defaults
Tests Passed¶
- ✅ Builds without errors
- ✅ Pre-commit hooks (ruff, mypy, commitizen)
- ✅ All existing formatter methods work correctly
Release Details¶
- Date: 2025-12-07
- Version: v0.1.25
- Files Changed: 2 (formatter.py, options.py)
- Commits: 9 commits
- feat: add SSV, TSV, and LTSV formatting methods to ResponseFormatter
- refactor: remove _with_header methods from SSV and TSV formatters
- refactor: extract _to_sv helper method for separator-based formatting
- refactor: rename internal methods to _format_sv and _format_dict
- refactor: consolidate internal methods _format_dict and _format_sv
- docs: update Options.format docstring to include ssv, tsv, ltsv formats
- refactor: change default values for format and use_flat options
- refactor: change ResponseFormatter.display default format to jsonl
- (plus docs:release task)
Next Steps¶
- Consider adding binary output formats (Protocol Buffers, MessagePack)
- Explore streaming output for large datasets
- Add format validation/error handling enhancements