gemini-code-assist[bot] commented on code in PR #38852:
URL: https://github.com/apache/beam/pull/38852#discussion_r3382353878


##########
sdks/python/container/Dockerfile:
##########
@@ -101,7 +101,8 @@ RUN  \
     if [ "${py_version}" = "3.10" ] || [ "${py_version}" = "3.11" ]; then \
         pip uninstall upgrade_ensurepip -y; \
     fi; \
-    python3 -m ensurepip;
+    python3 -m ensurepip && \
+    python3 -c "import ensurepip; assert list(map(int, 
ensurepip._PIP_VERSION.split('.'))) >= [26, 1], f'Bundled pip version 
{ensurepip._PIP_VERSION} is older than 26.1';"

Review Comment:
   ![critical](https://www.gstatic.com/codereviewagent/critical.svg)
   
   Using `ensurepip._PIP_VERSION` checks the version of `pip` bundled with the 
Python standard library's `ensurepip` module, rather than the upgraded version 
of `pip` installed in the environment. Since Python 3.10 and 3.11 bundle older 
versions of `pip` (e.g., 23.x), this assertion will always fail and break the 
Docker build.
   
   To verify the actual installed version of `pip`, you should import `pip` and 
check `pip.__version__` instead.
   
   ```
       python3 -m ensurepip && \
       python3 -c "import pip; assert list(map(int, 
pip.__version__.split('.')[:2])) >= [26, 1], f'Installed pip version 
{pip.__version__} is older than 26.1';"
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to