Skip to content

v0.1.55 - MockDevice Cleanup & Package Structure (2025-12-14)

What Changed?

This release removes the legacy queue_data() method and data_queue attribute from MockDevice, simplifying the codebase by eliminating unused code. The package data directory structure is reorganized into src/kazunoko/data/responses/ and src/kazunoko/data/events/, following Python packaging best practices.


What's New

Improvement: Code Cleanup & Package Reorganization

What changed:

  • Removed legacy queue_data() method from MockDevice (27 lines eliminated)
  • Consolidated package data files into structured directories: src/kazunoko/data/responses/ and src/kazunoko/data/events/
  • Updated package build configuration to include data files from new locations

Why:

  • queue_data() was not used in tests or documentation since v0.1.2
  • MockGenerator provides a more flexible and modern alternative
  • Organizing data files within src/ follows Python packaging standards (PEP 517)
  • Enables better discoverability and maintainability of package data

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?

🗑️ Removed

  • MockDevice.queue_data() method - Use MockGenerator instead
  • MockDevice.data_queue attribute - Legacy queue implementation
  • refs/ directory at project root - Data moved to src/kazunoko/data/

🔧 Changed

  • Package data directory structure: refs/src/kazunoko/data/responses/ and src/kazunoko/data/events/
  • pyproject.toml build configuration: Updated [tool.uv_build] include paths
  • MockDevice initialization: Path resolution now points to new data directory

Is It Safe to Upgrade?

Backward Compatible: Partial ⚠️

Breaking Changes:

  • MockDevice.queue_data() is no longer available
  • If you were using queue_data(), switch to MockGenerator for more flexible event simulation

Safe for:

  • Using MockDevice() with MockGenerator
  • Using MockDevice with Command class
  • All existing CLI functionality remains unchanged
  • All device response files are still available in new locations

Migration:

If you were using queue_data():

# Old (no longer works)
device = MockDevice()
device.queue_data(85, 90, 88)

# New approach - use MockGenerator
from kazunoko import MockGenerator
gen = MockGenerator.from_random(count=100, seed=42)
device = MockDevice(generator=gen)

Tests Passed

  • ✅ Builds without errors
  • ✅ MockDevice loads commands from new data directory
  • ✅ All 40+ device commands load correctly
  • ✅ GET_VERSION response still returns "1.17.1"
  • ✅ MockGenerator integration works correctly
  • ✅ Package data files are included in wheel distribution

Release Details

  • Date: 2025-12-14
  • Version: v0.1.55
  • Files Changed: 2 (src/kazunoko/mock.py, pyproject.toml)
  • Commits: cce10c4 (refactor: remove legacy queue_data method and data_queue from MockDevice), 12a6772 (refactor: move device response data to src/kazunoko/data/ package directory)

Benefits

  • Cleaner Codebase: Removed 27 lines of unused code
  • Better Package Structure: Data files follow Python packaging standards (PEP 517)
  • Improved Maintainability: Device response files are now co-located with code
  • Consistent Pattern: All mock data uses MockGenerator for flexible event simulation
  • Proper Distribution: Package data correctly included in wheel via [tool.uv_build]

Next Steps

  • Consider implementing state management for stateful commands (SET_THRESHOLD, SET_POLL_COUNT)
  • Expand src/kazunoko/data/responses/ with additional device command responses
  • Add more comprehensive examples using MockGenerator in documentation