colorthief is unmaintained and will break with Pillow 14

Aberta
#365 2 comentários 0 reações 1 responsável Ver no GitHub

Mantenedores costumam responder em até 1 dia

@anshuman83-40 já está trabalhando nisso.

Desde 29/10/2026.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
48/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
python
Domínio
backend, databases

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

  1. Vendor colorthief into zimscraperlib (BSD-licensed, ~420 lines including docstrings, pure Python, only depends on Pillow), replacing getdata() by get_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: ignore in get_colors
    • cons: we own the maintenance of the code (but the MMCQ algorithm is stable, only Pillow API evolutions are expected to matter)
  2. 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
  3. 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.

Linguagem predominante
Python
Estrelas
33
Forks
34
Merge médio
1d 8h
PRs com merge (30d)
24

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de openzim/python-scraperlib

Todas as issues de openzim/python-scraperlib

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.