Repository navigation
Conversation
…and fix sample bugs - Upgrade dependencies and Python runtime (3.13 / Apache Beam 2.77.0) to resolve Dependabot alerts. - Fix sample build and test issues discovered during verification (update Dockerfile/packaging, add .gcloudignore, and normalize bucket URI in conftest.py).
There was a problem hiding this comment.
Code Review
This pull request updates the Python version from 3.14 to 3.13 and upgrades the Apache Beam SDK to version 2.77.0 across the pipeline_with_dependencies flex template files, including the Dockerfile, pyproject.toml, and requirements files. It also introduces a .gcloudignore file and modifies conftest.py to strip the 'gs://' prefix from the GOOGLE_CLOUD_BUCKET environment variable. Regarding the feedback, it is recommended to use .removeprefix('gs://').rstrip('/') in conftest.py to make the bucket name parsing cleaner and more robust against trailing slashes.
| if bucket_name.startswith("gs://"): | ||
| bucket_name = bucket_name.replace("gs://", "", 1) |
There was a problem hiding this comment.
Using replace("gs://", "", 1) to strip the prefix is less robust and can be simplified. Since the project is using Python 3.13, you can use removeprefix("gs://") which is cleaner and more idiomatic. Additionally, if the environment variable contains a trailing slash (e.g., gs://my-bucket/), it can result in double slashes when constructing GCS paths (e.g., gs://my-bucket//template.json). It is safer to also strip any trailing slashes using .rstrip("/").
bucket_name = bucket_name.removeprefix("gs://").rstrip("/")
Description
Fixes b/573677639
Checklist
Testing
Compliance & Style
Post-Approval Actions