Skip to content

chore(deps): upgrade pillow to 13.0.0 and remove unused pins - #15005

Open
XrossFox wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
XrossFox:update-pillow
Open

XrossFox wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
XrossFox:update-pillow

Conversation

@XrossFox

Copy link
Copy Markdown
Contributor

Description

  • Upgrade pillow to 13.0.0 (and drop obsolete python_version >= "3.10" markers) across 12 samples (appengine/flexible/scipy, dataflow/*, genai/* , people-and-planet-ai/image-classification, vision/snippets/*).
  • Remove unused pillow pins from 6 generative_ai/* samples (evaluation, extensions, model_garden, model_tuning, prompts, reasoning_engine).
  • Bump apache-beam[gcp] to 2.78.0 (lifting the pillow<13 cap) in the 4 Beam samples, updating companion Dockerfile SDK tags, re-locking dataflow/flex-templates/pipeline_with_dependencies/requirements.txt, and syncing google-cloud-storage==3.17.2 in its requirements-test.txt.
  • Update noxfile_config.py in appengine/flexible/scipy and vision/snippets/* to test Python 3.12/3.14, and align tensorflow-landsat{,-prime} to 3.13 to match their Dockerfiles.
  • Replace deprecated im.getdata() with im.get_flattened_data() in vision/snippets/face_detection/faces_test.py.

Note: Local verification uncovered unrelated pre-existing dependency/wheel failures in several older samples; a separate follow-up task has been opened to address them.

Fixes b/590880484

Checklist

Testing

  • I have tested this change on a live environment and verified it works as intended.

Compliance & Style


Post-Approval Actions

  • Please merge this PR for me once it is approved

- Upgrade `pillow` to `13.0.0` (and drop obsolete `python_version >= "3.10"`
  markers) across 12 samples (`appengine/flexible/scipy`, `dataflow/*`,
  `genai/*` , `people-and-planet-ai/image-classification`, `vision/snippets/*`).
- Remove unused `pillow` pins from 6 `generative_ai/*` samples (`evaluation`,
  `extensions`, `model_garden`, `model_tuning`, `prompts`, `reasoning_engine`).
- Bump `apache-beam[gcp]` to `2.78.0` (lifting the `pillow<13` cap) in the 4
  Beam samples, updating companion `Dockerfile` SDK tags, re-locking
  `dataflow/flex-templates/pipeline_with_dependencies/requirements.txt`, and
  syncing `google-cloud-storage==3.17.2` in its `requirements-test.txt`.
- Update `noxfile_config.py` in `appengine/flexible/scipy` and
  `vision/snippets/*` to test Python `3.12`/`3.14`, and align
  `tensorflow-landsat{,-prime}` to `3.13` to match their Dockerfiles.
- Replace deprecated `im.getdata()` with `im.get_flattened_data()` in
  `vision/snippets/face_detection/faces_test.py`.

Note: Local verification uncovered unrelated pre-existing dependency/wheel
failures in several older samples; a separate follow-up task has been opened
to address them.
@XrossFox
XrossFox requested review from a team as code owners November 27, 2026 21:17
@product-auto-label product-auto-label Bot added samples Issues that are directly related to samples. api: appengine Issues related to the App Engine Admin API API. api: people-and-planet-ai api: vision Issues related to the Cloud Vision API. labels Nov 27, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates various dependencies across multiple samples, notably upgrading Pillow to version 13.0.0 and Apache Beam to version 2.78.0, along with corresponding test configuration adjustments. However, in vision/snippets/face_detection/faces_test.py, the calls to im.getdata() were incorrectly changed to im.get_flattened_data(). Since get_flattened_data() is not a valid PIL Image method, this will cause runtime AttributeErrors. It is recommended to revert these changes back to im.getdata().

# Make sure there isn't already a green box
im = Image.open(in_file)
pixels = im.getdata()
pixels = im.get_flattened_data()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The method get_flattened_data() does not exist on PIL Image objects and will raise an AttributeError at runtime. Additionally, im.getdata() is not deprecated in Pillow 13.0.0. Please revert this change to use im.getdata().

Suggested change
pixels = im.get_flattened_data()
pixels = im.getdata()

# Make sure there now is some green drawn
im = Image.open(out_file)
pixels = im.getdata()
pixels = im.get_flattened_data()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The method get_flattened_data() does not exist on PIL Image objects and will raise an AttributeError at runtime. Please revert this change to use im.getdata().

Suggested change
pixels = im.get_flattened_data()
pixels = im.getdata()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: appengine Issues related to the App Engine Admin API API. api: people-and-planet-ai api: vision Issues related to the Cloud Vision API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant