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.pyto 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.NamedTemporaryFilefor automatic cleanup of temporary files inimage_renderer.py. - Retry Logic: Added a 3-attempt retry mechanism for background downloads in
background_manager.pyto improve reliability.
Changed
- Art Generation Pipeline: Refactored Pygame initialization to a helper function (
initialize_pygame) inmain.pyfor better control. - Background Management: Enhanced
prepare_background_surfacewith a context manager for PIL image handling inbackground_manager.py. - Error Handling: Improved exception handling with specific error messages and fallbacks across all modules.
- Style Application: Updated
apply_style_to_paletteinstyles.pyto include bounds checking for color values. - Input Workflow: Enhanced
main.pyinput 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 protocolerror 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.pycleanup. - Input Errors: Fixed invalid input handling in
main.pyto 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_artinart_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