Skip to content

PaintMyPoem 0.4.0

Latest

Choose a tag to compare

@kayvour kayvour released this 28 Aug 05:39
· 6 commits to main since this release
0dd4583

Release 0.4.0 - August 28, 2025

Overview

I'm announcing the release of PaintMyPoem v0.4.0, a significant update that enhances stability, adds robust error handling, and improves the overall artwork generation experience. Released on August 28, 2025, at 11:08 AM IST, this version addresses critical bugs, introduces better resource management, and prepares the codebase for future scalability.

What's New

Added

  • Logging System: Added file-based logging in main.py to track execution details and errors for easier debugging.
  • Type Hints: Implemented type annotations across all modules to improve code clarity and IDE support.
  • Input Validation: Added comprehensive checks for user inputs and function parameters to ensure robust operation.
  • Resource Cleanup: Introduced tempfile.NamedTemporaryFile for automatic cleanup of temporary files in image_renderer.py.
  • Retry Logic: Added a 3-attempt retry mechanism for background downloads in background_manager.py to improve reliability.

Changed

  • Art Generation Pipeline: Refactored Pygame initialization to a helper function (initialize_pygame) in main.py for better control.
  • Background Management: Enhanced prepare_background_surface with a context manager for PIL image handling in background_manager.py.
  • Error Handling: Improved exception handling with specific error messages and fallbacks across all modules.
  • Style Application: Updated apply_style_to_palette in styles.py to include bounds checking for color values.
  • Input Workflow: Enhanced main.py input validation for background selection with a retry loop.

Fixed

  • Pygame Context Manager Issue: Resolved the 'pygame.surface.Surface' object does not support the context manager protocol error by adjusting Pygame initialization and cleanup logic.
  • Resource Leaks: Fixed potential memory leaks from repeated Pygame initialization in art_generator.py.
  • Permission Issues: Added handling for directory permission errors in background_manager.py cleanup.
  • Input Errors: Fixed invalid input handling in main.py to ensure valid background choices.
  • Image Processing: Ensured robust surface validation and fallback in image_renderer.py.

Enhanced

  • Code Maintainability: Expanded docstrings with detailed parameter and return descriptions in all files.
  • Robustness: Improved stability with better error recovery and logging for debugging.
  • Flexibility: Added a configurable size parameter to draw_art in art_generator.py.

Installation

To upgrade to v0.4.0, ensure you have Python 3.13+ and run:

pip install --upgrade paintmypoem

##Known Issues
A Pygame warning about pkg_resources deprecation may appear due to Setuptools changes. This is being monitored, and a fix is planned for a future release. For now, you can suppress it with warnings.filterwarnings("ignore", category=UserWarning, module="pygame.pkgdata") or pin Setuptools to <81.0.0.

**Full Changelog**: https://github.com/kayvour/PaintMyPoem/compare/v0.2.0-alpha...v0.4.0