Conversation
- Updated import statements across multiple files to replace 'src.' with direct module paths for better clarity and maintainability. - Introduced a global lock in `metadata_processor.py` to ensure thread safety during pyexiv2 operations. - Enhanced metadata extraction logic to handle frozen builds and pytest environments more gracefully. - Improved error handling and logging for metadata extraction processes. - Added functionality to open logs and models folders directly from the UI. - Refactored stylesheet loading logic in `main.py` to handle different execution contexts more robustly. - Updated various UI components to ensure consistent import paths and improve code organization.
…-level reference in DialogManager
…adless/CI environments
There was a problem hiding this comment.
Pull Request Overview
This pull request refactors the import system to support PyInstaller packaging while adding comprehensive GitHub Actions workflows for building native desktop binaries. The changes ensure compatibility between source development and frozen distribution builds.
- Migrates all internal imports from
src.prefixed paths to package-relative imports - Adds GitHub Actions workflow for building Windows/macOS binaries with PyInstaller
- Improves rotation model detection with better error handling for missing models
- Enhances thread safety for pyexiv2 operations in multi-threaded contexts
Reviewed Changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/conftest.py | Adds pyexiv2 import guard and src directory to sys.path for test compatibility |
| src/ui/*.py | Updates imports from src. prefix to package-relative imports |
| src/core/*.py | Converts imports to package-relative format for PyInstaller compatibility |
| src/main.py | Enhanced stylesheet loading and logging for frozen builds |
| .github/workflows/release-build.yml | New CI workflow for building cross-platform desktop binaries |
| DEVELOPER_GUIDE.md | Documents packaging strategies and PyInstaller considerations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/core/metadata_processor.py
Outdated
|
|
||
| def process_chunk(chunk_paths: List[str]) -> List[Dict[str, Any]]: | ||
| chunk_results = [] | ||
| single_file_mode = len(chunk_paths) == 1 |
There was a problem hiding this comment.
The variable single_file_mode is assigned but never used in the function. Consider removing this unused variable.
| single_file_mode = len(chunk_paths) == 1 |
| - name: Generate app icons (platform-specific) | ||
| shell: bash | ||
| run: | | ||
| python - <<'PY' |
There was a problem hiding this comment.
[nitpick] The inline Python script for icon generation is quite long and complex. Consider extracting this to a separate script file (e.g., scripts/generate_icons.py) for better maintainability and readability.
| logger.error("No orientation model found; rotation detection disabled.") | ||
| self._state.failure_logged = True | ||
| return None |
There was a problem hiding this comment.
The indentation is inconsistent here. Line 242 should be at the same level as line 241 since both are part of the same conditional block.
This pull request introduces significant improvements to packaging, distribution, and model handling for native desktop builds, along with codebase-wide import refactoring for compatibility with PyInstaller and frozen bundles. It adds a comprehensive GitHub Actions workflow for building and releasing Windows and macOS binaries, improves resource and model bundling strategies, and enhances error handling for rotation model detection. Documentation is updated to reflect these changes and provide guidance for future development.
Packaging, Distribution, and CI Improvements
.github/workflows/release-build.yml) to build, package, and release Windows and macOS desktop binaries using PyInstaller, including matrix builds, artifact uploads, icon generation, and SHA256 checksums.DEVELOPER_GUIDE.md) with a new section on packaging and distribution, detailing import strategies, resource/model bundling, logging, PyInstaller flags, CI build targets, and macOS codesigning notes.Import Path Refactoring for PyInstaller Compatibility
src/core/caching/*,src/core/image_features/*,src/core/image_processing/*,src/core/metadata_processor.py) to use package-relative imports without thesrc.prefix, ensuring compatibility with both source and frozen PyInstaller builds. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]Rotation Model Detection and Error Handling
ModelNotFoundErrorif missing, allowing the UI to prompt users for model download. [1] [2] [3]ModelNotFoundErrorso the UI can handle missing models gracefully and abort remaining tasks as needed. [1] [2]Thread Safety for pyexiv2 Access
src/core/metadata_processor.pyto prevent crashes or corruption in multi-threaded and frozen contexts.