Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies = [
"ollama>=0.5.1",
"requests>=2.32.3",
"mistletoe>=1.4.0",
"pillow>=12.0.0", # Needed for Intrinsics (HF and OpenAI Backends).
"pillow>=12.2.0,!=12.3.0", # Needed for Intrinsics (HF and OpenAI Backends). 12.3.0 removed PIL._typing._Ink, breaking docling (issue#1640).
"math_verify", # Needed for Majority Voting Sampling Strategies.
"nltk>=3.9,!=3.10.1", # Needed for sentence tokenization in granite citation parsing.
"rouge_score", # Needed for Majority Voting Sampling Strategies.
Expand Down
41 changes: 41 additions & 0 deletions test/package/test_pillow_constraint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright IBM Corp. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

"""Tests that the core `pillow` dependency specifier excludes the broken 12.3.0 release.

Pillow 12.3.0 removed `_Ink` from `PIL._typing`, which breaks `from PIL import
ImageText` and cascades through `docling_core` into `RichDocument` (issue #1640).
These tests assert the specifier in `pyproject.toml` cannot resolve 12.3.0 while
still admitting the known-good releases.
"""

from __future__ import annotations

import tomllib
from pathlib import Path

from packaging.requirements import Requirement

PYPROJECT = Path(__file__).resolve().parents[2] / "pyproject.toml"


def _pillow_specifier():
"""Return the `SpecifierSet` for the core `pillow` dependency in pyproject.toml."""
with PYPROJECT.open("rb") as f:
pyproject = tomllib.load(f)
for dep in pyproject["project"]["dependencies"]:
req = Requirement(dep)
if req.name == "pillow":
return req.specifier
raise AssertionError("pillow not found in core dependencies")


def test_pillow_specifier_excludes_broken_1230():
"""The pillow specifier must not admit the broken 12.3.0 release (issue #1640)."""
assert "12.3.0" not in _pillow_specifier()


def test_pillow_specifier_allows_working_versions():
"""The pillow specifier still admits the known-good 12.2.0 release."""
spec = _pillow_specifier()
assert "12.2.0" in spec
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading