chore: update to python 3.14#1160
Conversation
|
The following are automatically added/executed:
Available user actions:
Supported labels{'/hold', '/verified', '/lgtm', '/cherry-pick', '/wip', '/build-push-pr-image'} |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughBumps Python references from 3.13 → 3.14 across configs and Dockerfile (also Fedora 42 → 43). Multiple files replace tuple multi-except syntax Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tox.ini (1)
7-21:⚠️ Potential issue | 🟠 MajorPin the
pytesttox env to Python 3.14 as well.Line 7 is pinned, but Lines 16-21 still allow interpreter drift. That can validate tests on a non-3.14 runtime and miss compatibility issues.
🔧 Proposed fix
[testenv:pytest] +basepython = python3.14 deps = uv commands = uv run pytest --collect-only uv run pytest --setup-plan🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tox.ini` around lines 7 - 21, The [testenv:pytest] tox environment is not pinned to Python 3.14, allowing interpreter drift; add a basepython = python3.14 setting inside the [testenv:pytest] block (the section headed "[testenv:pytest]") so pytest runs use the same Python version as the global basepython and avoid validating tests on a different runtime.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Dockerfile`:
- Around line 6-17: The dnf install line includes a non-existent package
python3.14-pip which breaks the build; edit the RUN dnf install command to
remove "python3.14-pip" and instead install pip after Python is present (e.g.,
use python3.14 -m ensurepip or python3.14 -m pip to bootstrap/upgrade pip in a
later RUN), and optionally set ENV UV_PYTHON to "3.14" instead of "python3.14"
(see ENV UV_PYTHON) to follow the recommended version format; keep the BIN_DIR
and PATH ENV entries as-is.
---
Outside diff comments:
In `@tox.ini`:
- Around line 7-21: The [testenv:pytest] tox environment is not pinned to Python
3.14, allowing interpreter drift; add a basepython = python3.14 setting inside
the [testenv:pytest] block (the section headed "[testenv:pytest]") so pytest
runs use the same Python version as the global basepython and avoid validating
tests on a different runtime.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
.pre-commit-config.yamlDockerfilepyproject.tomltox.ini
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/conftest.py`:
- Line 834: The except clause "except ValueError, TypeError:" is invalid in
Python 3; replace it with a parenthesized multi-except form "except (ValueError,
TypeError):" in the try/except block containing that clause (locate the exact
"except ValueError, TypeError" token and update it to use parentheses so the
module imports under Python 3).
In `@tests/model_registry/model_catalog/search/utils.py`:
- Line 407: The except clause using Python 2 comma syntax ("except ValueError,
TypeError:") is invalid in Python 3; locate that except statement in
tests/model_registry/model_catalog/search/utils.py and change it to either a
tuple-style multi-exception handler using parentheses (i.e., catch both
ValueError and TypeError in one except) or split into two separate except blocks
handling ValueError and TypeError individually, ensuring proper colon and
indentation.
In `@tests/model_serving/model_server/kserve/inference_graph/conftest.py`:
- Line 131: Replace the invalid Python2-style except clauses written as "except
AttributeError, KeyError:" with the Python3 tuple form "except (AttributeError,
KeyError):" for each occurrence (the three except clauses currently using that
syntax), ensuring the except statements around those blocks (e.g., in the test
conftest exception handlers) use the tuple form so both exceptions are caught
correctly.
In `@tests/model_serving/model_server/maas_billing/utils.py`:
- Line 102: Replace the invalid Python 2-style comma-separated exception
handlers with a tuple for Python 3: change occurrences of "except
JSONDecodeError, ValueError:" to "except (JSONDecodeError, ValueError):" (both
the instance around the JSON parsing at the location referencing JSONDecodeError
and the similar handler near line 403). Ensure the exception names
(JSONDecodeError and ValueError) remain imported/available in the module so the
new tuple-form except works.
In `@utilities/infra.py`:
- Line 990: The except line currently uses Python 2-style comma-separated
exceptions; update the exception handler handling ResourceNotFoundError and
NotFoundError by replacing the comma form with a tuple form (i.e., use a
parenthesized tuple of exceptions) so the except statement is valid in Python 3;
locate the handler that references ResourceNotFoundError and NotFoundError and
change its except clause accordingly.
In `@utilities/logger.py`:
- Line 17: The __new__ method's return annotation references RedactedString
before the class is fully defined; change the annotation to a forward reference
by quoting it (use "RedactedString") or use typing.Self (import Self from typing
or typing_extensions as appropriate) and update the import; specifically edit
def __new__(cls, *, value: object) -> RedactedString to either ->
"RedactedString" or -> Self and add the corresponding import so the annotation
resolves at runtime/type-check time.
In `@utilities/plugins/openai_plugin.py`:
- Line 107: Replace the invalid Python2-style exception clause `except
requests.exceptions.RequestException, json.JSONDecodeError:` with the Python3
multi-exception tuple form `except (requests.exceptions.RequestException,
json.JSONDecodeError):` in both places where that clause appears (the two
handlers shown in the diff); ensure you update both occurrences so they
correctly catch either RequestException or JSONDecodeError using the tuple
syntax and maintain the existing exception handling body.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
📒 Files selected for processing (7)
tests/conftest.pytests/model_registry/model_catalog/search/utils.pytests/model_serving/model_server/kserve/inference_graph/conftest.pytests/model_serving/model_server/maas_billing/utils.pyutilities/infra.pyutilities/logger.pyutilities/plugins/openai_plugin.py
There was a problem hiding this comment.
🧹 Nitpick comments (2)
Dockerfile (2)
11-12: Pre-existing issue:$HOME_DIRis undefined.While not introduced by this PR, note that
HOME_DIRis referenced here and at line 27 (WORKDIR $HOME_DIR), but onlyHOMEis defined in the ARG declarations (line 4). This could cause unexpected behavior. Consider addressing this in a follow-up.📝 Suggested fix (outside PR scope)
-ENV BIN_DIR="$HOME_DIR/.local/bin" +ENV BIN_DIR="$HOME/.local/bin"And at line 27:
-WORKDIR $HOME_DIR +WORKDIR $HOME🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Dockerfile` around lines 11 - 12, The Dockerfile references an undefined variable HOME_DIR in ENV BIN_DIR and WORKDIR; update the Dockerfile to either define ARG/ENV HOME_DIR (e.g., set HOME_DIR to the same value as the existing ARG/ENV HOME) or replace HOME_DIR with the already-defined HOME variable so ENV BIN_DIR="$HOME/.local/bin" and WORKDIR use $HOME; modify the lines that set ENV BIN_DIR, ENV PATH and WORKDIR to consistently use the defined symbol (HOME or newly added HOME_DIR) to eliminate the undefined variable.
6-6: Consider using version-only format forUV_PYTHON.The current
UV_PYTHON=python3.14works correctly. However, per uv documentation, the version-only format (UV_PYTHON=3.14) is the recommended approach. This is a minor nit and both formats are valid.📝 Optional: Use recommended version format
-ENV UV_PYTHON=python3.14 +ENV UV_PYTHON=3.14🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Dockerfile` at line 6, Update the ENV setting for UV_PYTHON to use the version-only format recommended by uv documentation: change the value of the ENV variable UV_PYTHON from "python3.14" to "3.14" (i.e., modify the ENV UV_PYTHON declaration to use "3.14" while keeping the ENV key name UV_PYTHON intact).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@Dockerfile`:
- Around line 11-12: The Dockerfile references an undefined variable HOME_DIR in
ENV BIN_DIR and WORKDIR; update the Dockerfile to either define ARG/ENV HOME_DIR
(e.g., set HOME_DIR to the same value as the existing ARG/ENV HOME) or replace
HOME_DIR with the already-defined HOME variable so ENV
BIN_DIR="$HOME/.local/bin" and WORKDIR use $HOME; modify the lines that set ENV
BIN_DIR, ENV PATH and WORKDIR to consistently use the defined symbol (HOME or
newly added HOME_DIR) to eliminate the undefined variable.
- Line 6: Update the ENV setting for UV_PYTHON to use the version-only format
recommended by uv documentation: change the value of the ENV variable UV_PYTHON
from "python3.14" to "3.14" (i.e., modify the ENV UV_PYTHON declaration to use
"3.14" while keeping the ENV key name UV_PYTHON intact).
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
📒 Files selected for processing (1)
Dockerfile
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
♻️ Duplicate comments (7)
tests/model_serving/model_server/maas_billing/utils.py (1)
102-102:⚠️ Potential issue | 🔴 CriticalFix invalid multi-exception syntax in Python 3.
Line 102 and Line 403 use
except A, B:, which is aSyntaxErrorin Python 3 and will break module import.Proposed fix
- except JSONDecodeError, ValueError: + except (JSONDecodeError, ValueError): body = {} @@ - except TypeError, ValueError: + except (TypeError, ValueError): if fail_if_missing:#!/bin/bash rg -nP '^\s*except\s+[^\(\n][^:\n]*,\s*[^:\n]+:' tests/model_serving/model_server/maas_billing/utils.py python3 -m py_compile tests/model_serving/model_server/maas_billing/utils.pyAlso applies to: 403-403
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/model_serving/model_server/maas_billing/utils.py` at line 102, Replace the invalid Python2-style multi-exception syntax used in the except clauses with the Python3 tuple form; specifically change occurrences like "except JSONDecodeError, ValueError:" to "except (JSONDecodeError, ValueError):" (or use two separate except blocks) in utils.py where the handlers for JSONDecodeError and ValueError appear (also fix the similar clause around the other occurrence near line 403), ensuring imports for JSONDecodeError are correct and the exception handling logic remains the same.utilities/plugins/openai_plugin.py (1)
107-107:⚠️ Potential issue | 🔴 CriticalUse valid Python 3
excepttuple syntax in both handlers.Line 107 and Line 140 currently use invalid Python 2-style exception syntax.
Proposed fix
- except requests.exceptions.RequestException, json.JSONDecodeError: + except (requests.exceptions.RequestException, json.JSONDecodeError): LOGGER.error("Streaming request error") raise @@ - except requests.exceptions.RequestException, json.JSONDecodeError: + except (requests.exceptions.RequestException, json.JSONDecodeError): LOGGER.exception("Request error")#!/bin/bash rg -nP '^\s*except\s+[^\(\n][^:\n]*,\s*[^:\n]+:' utilities/plugins/openai_plugin.py python3 -m py_compile utilities/plugins/openai_plugin.pyAlso applies to: 140-140
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@utilities/plugins/openai_plugin.py` at line 107, Replace the Python‑2 style exception separators with a tuple in the except handlers: change occurrences of "except requests.exceptions.RequestException, json.JSONDecodeError:" to "except (requests.exceptions.RequestException, json.JSONDecodeError):" (and likewise for the other handler) so the code uses valid Python 3 except tuple syntax; ensure json is imported and update both exception lines in utilities/plugins/openai_plugin.py where that pattern appears.utilities/logger.py (1)
17-17:⚠️ Potential issue | 🔴 CriticalAvoid unresolved self-reference in return annotation.
Line 17 now uses
-> RedactedString, which is flagged as undefined (F821) and can break lint checks. Keep it as a forward reference string (or useSelf).Proposed fix
- def __new__(cls, *, value: object) -> RedactedString: # noqa: PYI034 + def __new__(cls, *, value: object) -> "RedactedString": # noqa: PYI034 return super().__new__(cls, value)#!/bin/bash rg -n 'def __new__\(cls, \*, value: object\) -> RedactedString' utilities/logger.py rg -n 'from __future__ import annotations' utilities/logger.py🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@utilities/logger.py` at line 17, The return annotation on the __new__ method references RedactedString directly which is unresolved; update the annotation to a forward-reference string or use a supported typing alias (e.g., change the signature in the __new__ method to use "RedactedString" as a quoted forward reference or import from __future__ import annotations or use typing.Self) so lint F821 is resolved; modify the def __new__(cls, *, value: object) -> ... in utilities/logger.py (method __new__ and the RedactedString type) accordingly and ensure imports are adjusted if you opt to add from __future__ import annotations or typing.Self.utilities/infra.py (1)
990-990:⚠️ Potential issue | 🔴 CriticalFix Python 3 exception clause syntax.
Line 990 uses Python 2-style comma exception syntax and will raise
SyntaxErrorin Python 3.Proposed fix
- except ResourceNotFoundError, NotFoundError: + except (ResourceNotFoundError, NotFoundError): LOGGER.info(f"Pod {pod.name} is deleted")#!/bin/bash rg -nP '^\s*except\s+[^\(\n][^:\n]*,\s*[^:\n]+:' utilities/infra.py python3 -m py_compile utilities/infra.py🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@utilities/infra.py` at line 990, Replace the Python 2-style exception clause "except ResourceNotFoundError, NotFoundError:" with a valid Python 3 form; locate the except handling around ResourceNotFoundError and NotFoundError (the single-line clause in utilities/infra.py) and change it to either a tuple-based except (except (ResourceNotFoundError, NotFoundError):) or split into two except blocks (except ResourceNotFoundError: and except NotFoundError:) so the syntax is Python 3 compatible and the original error handling logic in that try/except region remains intact.tests/conftest.py (1)
834-834:⚠️ Potential issue | 🔴 CriticalUse tuple-form multi-exception catch.
Line 834 uses invalid Python 3 syntax and must be parenthesized.
Proposed fix
- except ValueError, TypeError: + except (ValueError, TypeError): LOGGER.debug(f"Skipping non-integer allocatable for {key} on {node.name}: {val!r}") continue#!/bin/bash rg -nP '^\s*except\s+[^\(\n][^:\n]*,\s*[^:\n]+:' tests/conftest.py python3 -m py_compile tests/conftest.py🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/conftest.py` at line 834, Replace the invalid Python2-style except clause "except ValueError, TypeError:" with the tuple-form multi-exception catch by changing it to "except (ValueError, TypeError):" so the except block in tests/conftest.py correctly catches both exceptions under Python 3; ensure the indentation and any exception handling inside that block remain unchanged.tests/model_serving/model_server/kserve/inference_graph/conftest.py (1)
131-131:⚠️ Potential issue | 🔴 CriticalRestore Python 3-compatible exception handlers.
Line 131, Line 137, and Line 259 use comma-separated exceptions, which are invalid in Python 3.
Proposed fix
- except AttributeError, KeyError: + except (AttributeError, KeyError): name = "dog-breed-pipeline" @@ - except AttributeError, KeyError: + except (AttributeError, KeyError): pass @@ - except AttributeError, KeyError: + except (AttributeError, KeyError): name = "sa-" + token_hex(4)#!/bin/bash rg -nP '^\s*except\s+[^\(\n][^:\n]*,\s*[^:\n]+:' tests/model_serving/model_server/kserve/inference_graph/conftest.py python3 -m py_compile tests/model_serving/model_server/kserve/inference_graph/conftest.pyAlso applies to: 137-137, 259-259
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/model_serving/model_server/kserve/inference_graph/conftest.py` at line 131, The except clauses use Python 2-style comma-separated exceptions (e.g. "except AttributeError, KeyError:") which is invalid in Python 3; update each such handler (the ones catching AttributeError and KeyError around the conftest exception blocks referenced) to use a tuple form "except (AttributeError, KeyError):" so both exceptions are caught properly, and repeat the same fix for the other occurrences noted (the similar handlers at the other two locations) then run a quick python3 -m py_compile to verify syntax.tests/model_registry/model_catalog/search/utils.py (1)
407-407:⚠️ Potential issue | 🔴 CriticalFix Python 3 multi-exception syntax.
Line 407 uses comma-separated exceptions, which is invalid syntax in Python 3.
Proposed fix
- except ValueError, TypeError: + except (ValueError, TypeError): return False, f"{key_name}: conversion error"#!/bin/bash rg -nP '^\s*except\s+[^\(\n][^:\n]*,\s*[^:\n]+:' tests/model_registry/model_catalog/search/utils.py python3 -m py_compile tests/model_registry/model_catalog/search/utils.py🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/model_registry/model_catalog/search/utils.py` at line 407, Replace the invalid Python 3 multi-exception syntax "except ValueError, TypeError:" with the tuple form "except (ValueError, TypeError):" (or split into separate except blocks) wherever that exact line appears (look for the "except ValueError, TypeError:" token), update any associated error handling if splitting exceptions, and re-run python3 -m py_compile to verify the file compiles.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@tests/conftest.py`:
- Line 834: Replace the invalid Python2-style except clause "except ValueError,
TypeError:" with the tuple-form multi-exception catch by changing it to "except
(ValueError, TypeError):" so the except block in tests/conftest.py correctly
catches both exceptions under Python 3; ensure the indentation and any exception
handling inside that block remain unchanged.
In `@tests/model_registry/model_catalog/search/utils.py`:
- Line 407: Replace the invalid Python 3 multi-exception syntax "except
ValueError, TypeError:" with the tuple form "except (ValueError, TypeError):"
(or split into separate except blocks) wherever that exact line appears (look
for the "except ValueError, TypeError:" token), update any associated error
handling if splitting exceptions, and re-run python3 -m py_compile to verify the
file compiles.
In `@tests/model_serving/model_server/kserve/inference_graph/conftest.py`:
- Line 131: The except clauses use Python 2-style comma-separated exceptions
(e.g. "except AttributeError, KeyError:") which is invalid in Python 3; update
each such handler (the ones catching AttributeError and KeyError around the
conftest exception blocks referenced) to use a tuple form "except
(AttributeError, KeyError):" so both exceptions are caught properly, and repeat
the same fix for the other occurrences noted (the similar handlers at the other
two locations) then run a quick python3 -m py_compile to verify syntax.
In `@tests/model_serving/model_server/maas_billing/utils.py`:
- Line 102: Replace the invalid Python2-style multi-exception syntax used in the
except clauses with the Python3 tuple form; specifically change occurrences like
"except JSONDecodeError, ValueError:" to "except (JSONDecodeError, ValueError):"
(or use two separate except blocks) in utils.py where the handlers for
JSONDecodeError and ValueError appear (also fix the similar clause around the
other occurrence near line 403), ensuring imports for JSONDecodeError are
correct and the exception handling logic remains the same.
In `@utilities/infra.py`:
- Line 990: Replace the Python 2-style exception clause "except
ResourceNotFoundError, NotFoundError:" with a valid Python 3 form; locate the
except handling around ResourceNotFoundError and NotFoundError (the single-line
clause in utilities/infra.py) and change it to either a tuple-based except
(except (ResourceNotFoundError, NotFoundError):) or split into two except blocks
(except ResourceNotFoundError: and except NotFoundError:) so the syntax is
Python 3 compatible and the original error handling logic in that try/except
region remains intact.
In `@utilities/logger.py`:
- Line 17: The return annotation on the __new__ method references RedactedString
directly which is unresolved; update the annotation to a forward-reference
string or use a supported typing alias (e.g., change the signature in the
__new__ method to use "RedactedString" as a quoted forward reference or import
from __future__ import annotations or use typing.Self) so lint F821 is resolved;
modify the def __new__(cls, *, value: object) -> ... in utilities/logger.py
(method __new__ and the RedactedString type) accordingly and ensure imports are
adjusted if you opt to add from __future__ import annotations or typing.Self.
In `@utilities/plugins/openai_plugin.py`:
- Line 107: Replace the Python‑2 style exception separators with a tuple in the
except handlers: change occurrences of "except
requests.exceptions.RequestException, json.JSONDecodeError:" to "except
(requests.exceptions.RequestException, json.JSONDecodeError):" (and likewise for
the other handler) so the code uses valid Python 3 except tuple syntax; ensure
json is imported and update both exception lines in
utilities/plugins/openai_plugin.py where that pattern appears.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
📒 Files selected for processing (7)
tests/conftest.pytests/model_registry/model_catalog/search/utils.pytests/model_serving/model_server/kserve/inference_graph/conftest.pytests/model_serving/model_server/maas_billing/utils.pyutilities/infra.pyutilities/logger.pyutilities/plugins/openai_plugin.py
|
/build-push-pr-image |
|
Status of building tag pr-1160: success. |
|
/hold cancel |
|
Status of building tag latest: success. |
Pull Request
Summary
Related Issues
How it has been tested
Additional Requirements
Summary by CodeRabbit