Allow Pillow version customization in ESPHome Dashboard configuration - #390
Conversation
- Add PillowVersion config field to io-package.json - Add Pillow version selector in admin UI - Add translations for Pillow version configuration - Implement PyPI API integration to fetch available Pillow versions - Update main.js to use configurable Pillow version - All linter checks pass Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
|
@SimonFischer04 so what do you think about Copilot's solution ? ;) |
There was a problem hiding this comment.
Pull request overview
This PR adds the ability to customize the Pillow version used by ESPHome Dashboard, implementing a similar pattern to the existing ESPHome version selector. Users can now select from available Pillow versions via a dropdown populated from PyPI's JSON API, with fallback to hardcoded versions if PyPI is unavailable.
Changes:
- Added
PillowVersionconfiguration option with "Always last available" as default - Implemented PyPI API integration to fetch and filter stable Pillow versions (top 20)
- Added version resolution logic that uses hardcoded 11.3.0 for "Always last available" or user-specified version
- Added admin UI dropdown with autocomplete for version selection
- Added translation keys (
lblPillowVersion,hlpPillowVersion) across all locales
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| main.js | Added Pillow version resolution logic (lines 277-291) and getPillowVersion message handler with PyPI API integration (lines 1834-1912) |
| io-package.json | Added PillowVersion to native config with default "Always last available" |
| admin/jsonConfig.json5 | Added autocompleteSendTo dropdown component for Pillow version selection |
| admin/i18n/*/translations.json | Added lblPillowVersion and hlpPillowVersion translation keys (some use English placeholders) |
| README.md | Added changelog entry documenting the new Pillow version customization feature |
Cant test right now, but Looka Not too bad. Just a few comments. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Add pillowVersions array to cache PyPI versions at startup - Fetch Pillow versions from PyPI once during initialization with proper error handling - Cache versions in _ESPHomeDashboard.pillowVersionCache state - Update getPillowVersion handler to use cached versions instead of fetching on every request - Remove unused jsonData from both ESPHomeDashboardVersion and PillowVersion config - Add PillowVersion to dashboard integration test - Add clear logging when using fallback or cached versions Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
- Create fetchAndCachePillowVersions() helper method - Simplify espHomeDashboard() by using the new helper - Add version_fetch_tests.js integration test to verify: - Versions are fetched from PyPI - Versions are cached in state - Only stable versions (no alpha/beta/rc) - Versions are sorted newest first - Integrate version fetch test into test suite Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
Some changes made based on the review, what about now ? |
LGTM |
Addressing PR Feedback
Based on feedback from @SimonFischer04 and @DutchmanNL, implementing the following changes:
Changes Made
Version Caching (commit 8ca4137)
pillowVersionsarray to cache available versions from PyPIespHomeDashboard()_ESPHomeDashboard.pillowVersionCachestate for persistencegetPillowVersionmessage handler (no more repeated API calls)Error Handling & Logging
Configuration Cleanup
jsonDataparameter from both ESPHome and Pillow version selectorsRefactoring (this commit)
fetchAndCachePillowVersions()methodversion_fetch_tests.js) that verifies:Testing
PillowVersion: "Always last available"to dashboard integration testOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.