Copilot commented on code in PR #262: URL: https://github.com/apache/incubator-hugegraph-ai/pull/262#discussion_r2123678463
########## docker/Dockerfile.llm: ########## @@ -1,23 +1,19 @@ -# TODO: we could use 'uv' to replace the poetry + python image (Also use the slime image) # Stage 1: Build stage (Isolating the build env) FROM python:3.10.16-bookworm AS builder -WORKDIR /build/ +WORKDIR /home/work/ -# 1.1 Install poetry -RUN pip install --no-cache-dir poetry +RUN pip install --no-cache-dir uv Review Comment: [nitpick] Pin the `uv` package to a specific version for reproducible builds, e.g., `pip install uv==<version>`. ```suggestion RUN pip install --no-cache-dir uv==1.0.0 ``` ########## hugegraph-llm/src/hugegraph_llm/utils/anchor.py: ########## @@ -0,0 +1,25 @@ +# 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. + +from pathlib import Path + +def get_project_root() -> Path: + """Returns the Path object of the project root directory""" + current_path = Path(__file__).resolve() + for parent in current_path.parents: + if (parent / "pyproject.toml").exists() or (parent / ".git").exists(): + return parent + # Fallback to current hardcoded approach + return Path(__file__).resolve().parent.parent.parent.parent Review Comment: [nitpick] The hardcoded four-level parent fallback is brittle and may break if directory structure changes. Consider raising an exception or computing the fallback dynamically based on `current_path.parents` length. ```suggestion # Raise an exception if no valid project root is found raise RuntimeError("Unable to determine the project root. Ensure that 'pyproject.toml' or '.git' exists in one of the parent directories.") ``` -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
