yuqi1129 commented on code in PR #14206: URL: https://github.com/apache/gravitino/pull/14206#discussion_r4545710528
########## clients/client-python/requirements-lance.txt: ########## @@ -16,9 +16,9 @@ # under the License. # Lance integration deps. `lance-ray` owns the compatible `lance-namespace` -# dependency, so do not pin `lance-namespace` here separately. +# dependency, so do not constrain `lance-namespace` here separately. # Installed via the `lance` extra (`pip install -e .[lance]`). -# The same pins are also included in requirements-dev.txt so that the default -# integration-test run works out of the box with `pip install -r requirements-dev.txt`. -ray==2.55.1 -lance-ray==0.4.2 +# The default integration-test environment remains pinned independently in +# requirements-dev.txt. +ray>=2.55.1,<=2.59.0 Review Comment: **[Important]** (same issue as the `requirements.txt` comment) Ray 2.59.1 and 2.60.0 are already excluded here. The SDK code does not import `ray` or `lance` at all (`grep -rn "ray\|lance" gravitino/` finds no imports), and `lance-ray` itself only needs `ray[data]>=2.41.0`. So this cap gives no protection. It only makes `[lance]` downgrade or conflict with Ray in a current Ray environment, which is the motivating Ray Data use case. ########## clients/client-python/requirements.txt: ########## @@ -17,5 +17,7 @@ # Runtime dependencies for the core metadata client. -dataclasses-json==0.6.7 -simplejson==3.20.1 +# Keep the reviewed pre-1.0 API line used by the DTO serializers. +dataclasses-json>=0.6.7,<0.7 +# Initial compatibility range is limited to reviewed releases. +simplejson>=3.20.1,<=4.2.0 Review Comment: **[Important]** The `<=X.Y.Z` upper bounds were already out of date when this head was pushed (2026-11-05). PyPI upload dates: - `pyarrow` 26.0.1 (2026-11-03, a patch release) is excluded by `pyarrow<=26.0.0`. - `ray` 2.59.1 and 2.60.0 (2026-11-04) are excluded by `ray<=2.59.0`. - `simplejson` 4.3.0 (2026-11-10) is excluded by this line. This line is in the core requirements. So a plain `pip install apache-gravitino` in an environment that already has simplejson 4.3 now downgrades it or fails to resolve. A published release cannot change its metadata, so every release will fall behind again within weeks. That is the problem #13556 wants to fix. The doc also says this bound "does not indicate a known incompatibility". It uses the same reason to leave `ossfs` without an upper bound, but it applies the opposite rule here. Suggestion: for libraries with no known incompatibility, use no upper bound, or only a major-version bound (`simplejson<5`, `pyarrow<27`). Keep the pinned dev environment, and add one CI case that installs the latest releases to catch real breaks. If only tested versions should be allowed, please at least use `<next minor` so patch releases are accepted, and write down who raises the bounds and when. ########## clients/client-python/scripts/run_core_compatibility_matrix.py: ########## @@ -0,0 +1,462 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +"""Verify installed core SDK artifacts in isolated Ray dependency environments.""" + +from __future__ import annotations + +import argparse +import hashlib +import json +import os +import shutil +import subprocess +import sys +import socket +import time +from contextlib import contextmanager, nullcontext +from dataclasses import dataclass +from email.parser import Parser +from pathlib import Path +from tempfile import mkdtemp +from urllib.parse import urlsplit +from urllib.request import ProxyHandler, build_opener +from zipfile import ZipFile + +CLIENT_ROOT = Path(__file__).resolve().parents[1] +CORE_TESTS = ( + "tests.unittests.test_gravitino_client", + "tests.unittests.test_metalake", + "tests.unittests.test_base_schema_catalog", + "tests.unittests.test_relational_catalog", + "tests.unittests.test_relational_table", + "tests.unittests.dto.semantic.test_semantic_wire_compatibility", + "tests.unittests.api.semantic.test_semantic_model_value_semantics", + "tests.unittests.api.semantic.test_semantic_model_supporting_types", + "tests.compatibility.test_core_metadata", +) +PROBE = """ +import importlib.metadata as metadata +import json +import sys +from pathlib import Path +import gravitino +names = json.loads(sys.argv[1]) +print(json.dumps({ + "python": list(sys.version_info[:2]), + "prefix": str(Path(sys.prefix).resolve()), + "sdk_path": str(Path(gravitino.__file__).resolve()), + "versions": {name: metadata.version(name) for name in names}, +})) +""" + + +@dataclass(frozen=True) +class CompatibilityCase: + """One declared consumer environment and its exact dependency assertions.""" + + name: str + python_minor: tuple[int, int] + simplejson: str + arrow: str | None = None + pandas: str | None = None + + def dependencies(self) -> dict[str, str]: + """Return only the versions whose compatibility this case claims.""" + dependencies = {"dataclasses-json": "0.6.7", "simplejson": self.simplejson} + if self.arrow is not None: + if self.pandas is None: + raise ValueError("Ray cases require an explicit pandas version") + dependencies.update( + { + "ray": "2.59.0", + "pyarrow": self.arrow, + "pandas": self.pandas, + } + ) + return dependencies + + def requirements(self) -> list[str]: + """Return normal pip requirements, with Ray's Data extra when needed.""" + return [ + f"{'ray[data]' if name == 'ray' else name}=={version}" + for name, version in self.dependencies().items() + ] + + +CASES = ( Review Comment: **[Important]** CI only checks the core dependencies. The new storage lower bounds (`fsspec`/`s3fs`/`gcsfs` 2023.12.1, `pyarrow` 17.0.0, `cachetools` 7.1.4, `readerwriterlock` 1.0.9, `adlfs` 2026.2.0, `ossfs` 2025.5.0) are only checked locally. If later GVFS code uses a newer fsspec API, CI stays green and users at the lower bounds break. The current code works at these bounds. I installed `.[storage]` with all of them in a Python 3.12 venv and ran `test_gvfs_with_local`, `test_gvfs_with_hook`, `test_gvfs_credential_cache`, `test_gvfs_lazy_loading`, `test_gvfs_merge_secrets`, `test_gvfs_user_defined_configs`, `test_gvfs_without_fileset`, `test_filesystem_cache`, `test_storage_handler` and `test_client_import_without_storage_dependencies`. All 71 tests passed. Could you add a `storage-min` case here (Python 3.10 plus all storage lower bounds) that runs these unit tests? It needs no backend, so the cost is small. ########## clients/client-python/scripts/reproduce_oss_multiflush.py: ########## @@ -0,0 +1,73 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +"""Reproduce the OSSFile append-position defect without cloud credentials. Review Comment: **[Question]** This script is not about dependency ranges, and it exits 1 by design. Does this ossfs defect affect GVFS OSS writes today? If yes, it is a real user-facing bug. It should have its own Gravitino issue (and an upstream ossfs report), not a repro script inside this PR. I suggest moving it out of this PR. ########## clients/client-python/tests/unittests/test_package_metadata.py: ########## @@ -23,16 +25,21 @@ from email.parser import Parser from pathlib import Path +from packaging.requirements import Requirement Review Comment: **[Nit]** `packaging` is not declared in `requirements-dev.txt`. It is only installed because another dev dependency pulls it in. Please pin it there explicitly. ########## clients/client-python/scripts/run_core_compatibility_matrix.py: ########## @@ -0,0 +1,462 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +"""Verify installed core SDK artifacts in isolated Ray dependency environments.""" + +from __future__ import annotations + +import argparse +import hashlib +import json +import os +import shutil +import subprocess +import sys +import socket +import time +from contextlib import contextmanager, nullcontext +from dataclasses import dataclass +from email.parser import Parser +from pathlib import Path +from tempfile import mkdtemp +from urllib.parse import urlsplit +from urllib.request import ProxyHandler, build_opener +from zipfile import ZipFile + +CLIENT_ROOT = Path(__file__).resolve().parents[1] +CORE_TESTS = ( + "tests.unittests.test_gravitino_client", + "tests.unittests.test_metalake", + "tests.unittests.test_base_schema_catalog", + "tests.unittests.test_relational_catalog", + "tests.unittests.test_relational_table", + "tests.unittests.dto.semantic.test_semantic_wire_compatibility", + "tests.unittests.api.semantic.test_semantic_model_value_semantics", + "tests.unittests.api.semantic.test_semantic_model_supporting_types", + "tests.compatibility.test_core_metadata", +) +PROBE = """ +import importlib.metadata as metadata +import json +import sys +from pathlib import Path +import gravitino +names = json.loads(sys.argv[1]) +print(json.dumps({ + "python": list(sys.version_info[:2]), + "prefix": str(Path(sys.prefix).resolve()), + "sdk_path": str(Path(gravitino.__file__).resolve()), + "versions": {name: metadata.version(name) for name in names}, +})) +""" + + +@dataclass(frozen=True) +class CompatibilityCase: + """One declared consumer environment and its exact dependency assertions.""" + + name: str + python_minor: tuple[int, int] + simplejson: str + arrow: str | None = None + pandas: str | None = None + + def dependencies(self) -> dict[str, str]: + """Return only the versions whose compatibility this case claims.""" + dependencies = {"dataclasses-json": "0.6.7", "simplejson": self.simplejson} + if self.arrow is not None: + if self.pandas is None: + raise ValueError("Ray cases require an explicit pandas version") + dependencies.update( + { + "ray": "2.59.0", + "pyarrow": self.arrow, + "pandas": self.pandas, + } + ) + return dependencies + + def requirements(self) -> list[str]: + """Return normal pip requirements, with Ray's Data extra when needed.""" + return [ + f"{'ray[data]' if name == 'ray' else name}=={version}" + for name, version in self.dependencies().items() + ] + + +CASES = ( + CompatibilityCase("core-min", (3, 10), "3.20.1"), + CompatibilityCase("ray-arrow17", (3, 12), "4.2.0", "17.0.0", "2.2.3"), + CompatibilityCase("ray-arrow23", (3, 12), "4.2.0", "23.0.1", "2.3.3"), + CompatibilityCase("ray-arrow26", (3, 12), "4.2.0", "26.0.0", "3.0.6"), +) + + +def clean_environment() -> dict[str, str]: + """Remove inherited source imports and version-check bypasses.""" + environment = os.environ.copy() + for name in ("PYTHONPATH", "PYTHONHOME", "GRAVITINO_VERSION_CHECK_DISABLED"): + environment.pop(name, None) + environment["PYTHONNOUSERSITE"] = "1" + no_proxy = environment.get("no_proxy", environment.get("NO_PROXY", "")) + environment["NO_PROXY"] = ",".join( + value for value in (no_proxy, "localhost", "127.0.0.1", "::1") if value + ) + environment["no_proxy"] = environment["NO_PROXY"] + return environment + + +def run_command( + command: list[str], working_dir: Path, log: Path, environment: dict[str, str] +) -> str: + """Run a command, preserve its output, and reject any nonzero result.""" + result = subprocess.run( Review Comment: **[Nit]** `subprocess.run` has no `timeout`. A hung `pip install` or unittest run will use the rest of the 90-minute job budget, and the PythonIT job already takes about 65 minutes. Please add a timeout and turn `TimeoutExpired` into a `RuntimeError`, so the case is recorded as failed in `results.json`. ########## clients/client-python/build.gradle.kts: ########## @@ -423,6 +423,51 @@ tasks { } } + register("coreCompatibilityTest") { + group = "verification" + description = "Verify installed core SDK artifacts in isolated Ray dependency environments." + dependsOn(distribution) + + fun interpreter(version: String, property: String): String { Review Comment: **[Nit]** This interpreter lookup and the server start/stop in the script repeat logic that already exists in `lanceRayMatrixTest` (the same Miniforge path lookup) and in `startGravitinoServer`/`stopGravitinoServer`. Could they share one helper? Also, the task needs `distribution/package` but only declares `dependsOn(distribution)` for the Python package. It relies on the workflow step order and the doc. ########## clients/client-python/requirements-lance.txt: ########## @@ -16,9 +16,9 @@ # under the License. # Lance integration deps. `lance-ray` owns the compatible `lance-namespace` -# dependency, so do not pin `lance-namespace` here separately. +# dependency, so do not constrain `lance-namespace` here separately. # Installed via the `lance` extra (`pip install -e .[lance]`). -# The same pins are also included in requirements-dev.txt so that the default -# integration-test run works out of the box with `pip install -r requirements-dev.txt`. -ray==2.55.1 -lance-ray==0.4.2 +# The default integration-test environment remains pinned independently in +# requirements-dev.txt. +ray>=2.55.1,<=2.59.0 +lance-ray>=0.3.0,<=0.5.0 Review Comment: **[Important]** This range does not match the other copy of the Lance compatibility claim: - `docs/lance-rest-integration.md:26` lists lance-ray `0.3.0 - 0.4.2`. - `scripts/run_lance_ray_matrix.py:60` has `DEFAULT_VERSIONS = ["0.4.2", "0.3.0"]` and installs `ray==2.55.1` by default. This line allows `0.5.0`, which needs `pylance>=9.0.0`, plus Ray up to 2.59. Please either add 0.5.0 (and Ray 2.59) to `lanceRayMatrixTest` and that doc, or keep the upper bound at 0.4.2. ########## docs/how-to-use-python-client.md: ########## @@ -51,6 +51,87 @@ To preserve the previous installation profile that included all GVFS backends, i the base Gravitino client alongside their Ray Data dependencies without installing these storage extras. +### Core client compatibility Review Comment: **[Nit]** These two new sections are inserted between the install text and the numbered link list ("1. Manage metalake ..."). The list now ends up under "Runtime dependency ranges", and main adds a 4th item to it. Please put the new sections after the list. Also, the matrix details (port 8090, `results.json`, how to run the task) are for developers. The user guide only needs the range table. The rest could go to a developer doc or the script docstring. -- 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]
