Skip to content

v0.6.2 - Consolidated Options Module for Example Scripts (2025-12-26)

What Changed?

This patch release consolidates all example scripts to use the Options module consistently for parameter definitions. This reduces code duplication, improves maintainability, and ensures all scripts follow the same patterns as the main CLI.


What's New

Enhancement: Unified Options Usage Across Example Scripts

What it does: Consolidates all parameter definitions in example scripts to use the centralized Options and MockOptions classes from the kazunoko.options module. This ensures consistency, reduces boilerplate, and makes option changes propagate automatically to all scripts.

How it helps: - DRY Principle: No more duplicated option definitions - Consistency: All scripts follow the same pattern as the main CLI - Maintainability: Option changes in Options module automatically apply to all scripts - Consistency: Unified help text and parameter handling across the codebase

Code example:

Before:

verbose: bool = typer.Option(
    False,
    "--verbose",
    "-v",
    help="Verbose output with detailed logging",
)
log_level: Literal["debug", "info", "success", "warning", "error"] = typer.Option(
    "error",
    "--log-level",
    help="Logging level: debug, info, success, warning, or error (default: error)",
)

After:

from kazunoko.options import Options

verbose: bool = Options.verbose()
log_level: Literal["debug", "info", "success", "warning", "error"] = Options.log_level()


Installation

Quick Start

# Get the release
git checkout v0.6.2

# Setup
task env:setup

# Run example with consolidated options
uv run examples/fit_thresholds.py ./measurements --verbose --log-level info

What's Different from the Last Version?

🔧 Changed

  • fit_thresholds.py: log_level and verbose now use Options module
  • monitor.py: Added --log-level parameter (was hardcoded to "info")
  • create_run_summary.py: verbose now uses Options module
  • plot_thresholds.py: verbose now uses Options module

✅ Improved

  • Reduced code duplication across example scripts
  • Consistent option definitions across all tools
  • Automatic option validation from centralized source
  • Easier to update options globally (single point of change)
  • Better IDE autocomplete and help text consistency

Is It Safe to Upgrade?

Backward Compatible: Yes ✅

This is a patch release with no breaking changes. All existing command-line usage continues to work identically. The only difference is that option definitions now reference the centralized Options module instead of being duplicated inline.

What's different

  • Code organization: Options now imported from kazunoko.options
  • No API changes: All command-line interfaces remain identical
  • No new features: This is a refactoring release

Tests Passed

  • ✅ Builds without errors
  • ✅ All linting checks pass (ruff check)
  • ✅ Type checking passes (mypy with known existing issues)
  • ✅ All example scripts work with consolidated options
  • ✅ Pre-commit hooks pass for all commits

Release Details

  • Date: 2025-12-26
  • Version: v0.6.2
  • Type: Patch (refactoring)
  • Files Changed: 4 (examples/)
  • Commits: 4 commits (4 consolidation commits + 1 version bump)
  • 1eedc93: refactor: consolidate log_level and verbose options to Options module in fit_thresholds.py
  • 2bea123: refactor: add log_level option to monitor.py using Options module
  • 4637c3d: refactor: consolidate verbose option to Options module in create_run_summary.py
  • 5bf7a92: refactor: consolidate verbose option to Options module in plot_thresholds.py
  • 5e6f4c1: bump: version 0.6.1 → 0.6.2

Key Points

Options Module Consolidation

All example scripts now use the Options module consistently:

Script Before After
fit_thresholds.py Inline log_level, verbose ✅ Uses Options.log_level(), Options.verbose()
monitor.py Hardcoded log_level="info" ✅ Parameterized with Options.log_level()
create_run_summary.py Inline verbose ✅ Uses Options.verbose()
plot_thresholds.py Inline verbose ✅ Uses Options.verbose()
get_events.py ✅ Already using Options ✅ Unchanged
get_thresholds.py ✅ Already using Options ✅ Unchanged
get_runs.py ✅ Already using Options ✅ Unchanged

Example Script Consistency

Before this release, example scripts had inconsistent option definitions: - Some used inline typer.Option() definitions - Others used the centralized Options module - Some hardcoded default values

After this release: - ✅ All scripts use the Options module - ✅ Consistent help text across all tools - ✅ Single point of change for option definitions - ✅ Easier to add new options globally


Migration Notes

No migration needed - this is a fully backward-compatible refactoring release. All existing scripts continue to work identically.

The internal implementation has changed, but the command-line interface and behavior are exactly the same.


Next Steps

Future improvements planned:

  • Consider adding more shared options to the Options module
  • Explore options for shared logging configuration
  • Consider format option consolidation for scripts with output formatting
  • Add mock device option to more example scripts where applicable