colorthief is unmaintained and will break with Pillow 14
Les mainteneurs répondent en général sous 1 jour
@anshuman83-40 y travaille déjà.
Depuis le 29/10/2026.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 48/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Python
- Étoiles
- 33
- Forks
- 34
- Merge moyen
- 1 j 8 h
- PR mergées (30 j)
- 24
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de openzim/python-scraperlib
-
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
openzim/python-scraperlib#414 ·
Les mainteneurs répondent en général sous 1 jour
-
HtmlRewriter: title is cut at the first `&` (entity or bare ampersand)Peut-être pris @rajanpanth l’a pris il y a 12 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
openzim/python-scraperlib#401 · 3 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
[next major] Remove deprecated 'convert' parameter for optimize_image function inside optimization.pyPeut-être pris @Sriram-Nambiar l’a pris il y a 40 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
openzim/python-scraperlib#292 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
compute_tags keeps empty tagsPeut-être pris @ahmershahdev l’a pris il y a 1 jour. Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 32/100
openzim/python-scraperlib#412 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Release 5.7.0Peut-être pris @benoit74 l’a pris il y a 4 jours. Ouverte
openzim/python-scraperlib#411 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de openzim/python-scraperlib
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
vllm-project/vllm#69791 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
BCStudentSoftwareDevTeam/cas#481 ·
Les mainteneurs répondent en général sous 7 jours
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour