V2#1
Merged
Merged
Conversation
## Bug Fixes - Fixed grid row calculation using wrong spacing variable (was hex_horizontal_spacing, now hex_vertical_spacing) - Fixed closest_palette_color returning None when all colors avoided (added fallback logic) - Fixed progress bar overshoot (update by actual chunk size, not hardcoded value) - Removed ineffective cache (was using only avg_rgb as key but patterns are position-dependent) ## New Features - Comprehensive test suite with 68 tests (tests/test_regression.py, tests/test_geometry.py) - Algorithm documentation (docs/ALGORITHM.md) with detailed mathematical descriptions - Clean v2/ architecture with modular components: - config.py: All constants and configuration values - color.py: ColorPalette class for palette generation and color selection - geometry.py: HexagonGrid and HexagonMask classes - layers.py: LayerRenderer for multi-layer hexagon patterns - processor.py: Main HexagonProcessor orchestration - hexify.py: CLI entry point for v2 ## Code Quality - Added type hints to hexagon_processor.py and hexify.py - Added Google-style docstrings to all classes and functions - Added input validation for palette colors, process count, chunk size - Created py.typed marker file for PEP 561 compliance - Updated .gitignore with Python-specific entries ## Testing - Test fixtures for gradient, color blocks, and fire images - Reference outputs for regression testing - Both pixel-perfect and tolerance-based comparison tests - Palette consistency and output dimension tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ints - Add v2/exceptions.py with domain-specific exception hierarchy: - HexifyError (base), InvalidImageError, PaletteError, GridError - Subclasses for specific conditions with helpful attributes - Add input validation in processor.process_image(): - Validates array type, dimensions (3D), and channels (3) - Raises InvalidImageError with descriptive messages - Add logging throughout all v2 modules: - Module-level loggers for processor, color, geometry, layers - Info-level logging for processing milestones - Debug-level logging for detailed progress - Improve type hints with specific types: - Use Optional, List, Tuple from typing module - Add return type annotations for complex methods - Move inline imports to module level in color.py - Update __init__.py to export exceptions and bump to v2.1.0 - Add 18 new tests for exception handling (86 total tests) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
## New Features ### Style Augmentation (v2/styles.py) - BorderStyle: none, solid, double, glow - FillStyle: solid, radial_gradient, linear_gradient - Functions: add_hexagon_border, apply_radial_gradient, apply_linear_gradient, add_noise_texture, apply_alpha_channel, apply_vignette - 7 style presets: classic, outlined, glowing, textured, neon, vintage, double_border - RGBA output with transparent backgrounds ### Modern CLI (v2/cli.py, v2/__main__.py) - Full-featured argparse CLI: python -m v2 - Batch processing with recursive directory scan and glob patterns - Config file support (YAML/JSON) - Built-in presets: default, fast, detailed, minimal - All options: --colors, --jobs, --layers, --zones, --border-width, etc. ### Configuration System (v2/settings.py, v2/presets.py) - HexifySettings dataclass with full validation - ColorSpace enum: RGB, LAB, HSV - HexOrientation enum: FLAT_TOP, POINTY_TOP - QuantizationMethod enum: KMEANS, MINIBATCH_KMEANS - YAML/JSON serialization support - Processing presets with get_preset/create_custom_preset ### DevOps Infrastructure - pyproject.toml with modern Python packaging - .pre-commit-config.yaml (ruff, mypy hooks) - .github/workflows/ci.yml for Python 3.9-3.12 - ruff.toml for linting configuration - Makefile (install, test, lint, format, clean targets) ### Performance Enhancements - MiniBatchKMeans option for faster palette extraction - Vectorized zone calculations in layer rendering ## Files Added - v2/styles.py (14KB) - Style augmentation module - v2/cli.py (22KB) - Modern CLI - v2/settings.py (10.5KB) - Configuration system - v2/presets.py (5.2KB) - Processing presets - v2/__main__.py - Module entry point - tests/test_styles.py - 39 style tests - tests/test_cli.py - CLI tests - v2/tests/test_benchmark.py - Performance benchmarks - examples/ directory with YAML configs ## Test Results - 173 tests passing (3 skipped for optional PyYAML) - Full backward compatibility maintained - All regression tests pass Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The base_zone_angle was incorrectly calculated as 360/num_zones/2 = 15 degrees instead of 360/num_zones = 30 degrees (matching the original implementation). This caused the angular zones in even layers to be offset by 15 degrees, resulting in askew/distorted hexagon patterns. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.