colorthief is unmaintained and will break with Pillow 14
維護者通常 1 天內回覆
@anshuman83-40 已經在處理了。
開始於 2026年10月29日。
評估
研究方向
Start with zimscraperlib.image.probing.get_colors and tests/image/test_image.py::test_colors_*; the issue identifies the deprecated Image.Image.getdata() call in the pinned colorthief dependency. Compare the proposed vendoring, maintained replacement, and Pillow-only approaches, then check the existing color tests against representative images. Done means the Pillow 14 blocker is resolved and the expected color behavior is confirmed.
由索引模型根據 Issue 內容生成。
描述
zimscraperlib.image.probing.get_colors relies on colorthief (pinned to 0.2.1), which calls Image.Image.getdata(). Pillow 13 deprecates this method and will remove it in Pillow 14 (2027-10-15):
colorthief.py:65: DeprecationWarning: Image.Image.getdata is deprecated and will be removed in Pillow 14 (2027-10-15). Use get_flattened_data instead.
pixels = image.getdata()
This is currently the only warning raised by our test suite (tests/image/test_image.py::test_colors_*).
Our pillow<14.0 upper bound protects us for now, but it means we will be stuck on Pillow 13 until this is solved.
colorthief is unmaintained
- last release (0.2.1) is from February 2017, last commit from 2019
- a fengsp/color-thief-py#36 issue about this exact deprecation got no answer from the maintainer
- an upstream fix and release is hence very unlikely
Options
- Vendor colorthief into zimscraperlib (BSD-licensed, ~420 lines including docstrings, pure Python, only depends on Pillow), replacing
getdata()byget_flattened_data().- pros: no new dependency, exact same colors as today (no change for scrapers), we can type it properly and drop the many
pyright: ignoreinget_colors - cons: we own the maintenance of the code (but the MMCQ algorithm is stable, only Pillow API evolutions are expected to matter)
- pros: no new dependency, exact same colors as today (no change for scrapers), we can type it properly and drop the many
- Switch to
modern_colorthief, a Rust re-implementation created precisely because of this deprecation (MIT, actively maintained, last release 0.3.0 in June 2026).- pros: maintained, fast, no Python dependency
- cons: single maintainer and low adoption (supply-chain risk), compiled wheels needed for all platforms our scrapers run on (amd64/arm64, glibc/musl), results are slightly different from colorthief (see their DIFFERENCES.md) so our expected colors in tests (and scrapers output) would change slightly; to be assessed on our test images
- Reimplement with Pillow only (
Image.quantize(..., method=Quantize.MEDIANCUT)+getcolors()).- pros: no dependency, very little code
- cons: different algorithm, so different colors; colorthief also ignores white and transparent pixels, which we would need to replicate
Other packages considered and discarded: fast-colorthief (needs numpy, no release since 2023, no wheels for recent Python), Pylette (way too heavy: OpenCV, scikit-learn, ...), extcolors and haishoku (unmaintained since 2019/2020).
Proposal
Option 1 seems the most conservative one: it removes an unmaintained dependency without changing any output nor adding a new third-party dependency. Option 2 is worth considering if we prefer not to own this code.
- 主要語言
- Python
- 星號
- 33
- 分支
- 34
- 平均合併
- 1 天 8 小時
- 30 天內合併 PR
- 24
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
openzim/python-scraperlib 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 85/100
openzim/python-scraperlib#414 ·
維護者通常 1 天內回覆
-
HtmlRewriter: title is cut at the first `&` (entity or bare ampersand)可能已有人在做 @rajanpanth 於 12 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 77/100
openzim/python-scraperlib#401 · 3 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
[next major] Remove deprecated 'convert' parameter for optimize_image function inside optimization.py可能已有人在做 @Sriram-Nambiar 於 40 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 68/100
openzim/python-scraperlib#292 · 1 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
compute_tags keeps empty tags可能已有人在做 @ahmershahdev 於 1 天前認領。 未關閉
難度 1/5 1 小時以內 新手友好度 32/100
openzim/python-scraperlib#412 · 1 則留言 ·
維護者通常 1 天內回覆
-
Release 5.7.0可能已有人在做 @benoit74 於 4 天前認領。 未關閉
openzim/python-scraperlib#411 · 已指派 1 人 ·
維護者通常 1 天內回覆
查看 openzim/python-scraperlib 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 74/100
vllm-project/vllm#69791 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
BCStudentSoftwareDevTeam/cas#481 ·
維護者通常 7 天內回覆
-
難度 1/5 1 小時以內 新手友好度 68/100
維護者通常 1 天內回覆