This is an automated email from the ASF dual-hosted git repository.
jin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-ai.git
The following commit(s) were added to refs/heads/main by this push:
new 6ea1102 refactor: use uv in client & ml modules & adapter the CI
(#257)
6ea1102 is described below
commit 6ea1102f85a856e7659e2ca2748bb2439d09d926
Author: HLOVI <[email protected]>
AuthorDate: Wed Jun 11 17:45:34 2025 +0800
refactor: use uv in client & ml modules & adapter the CI (#257)
Co-authored-by: imbajin <[email protected]>
---
.github/workflows/codeql.yml | 6 +--
.github/workflows/hugegraph-python-client.yml | 11 ++---
.github/workflows/pylint.yml | 12 ++---
hugegraph-llm/pyproject.toml | 4 +-
hugegraph-ml/README.md | 7 ++-
hugegraph-ml/pyproject.toml | 57 +++++++++++++++++++++-
hugegraph-ml/requirements.txt | 12 -----
hugegraph-ml/setup.py | 46 -----------------
hugegraph-python-client/README.md | 16 +++---
.../pyproject.toml | 32 +++++++++++-
hugegraph-python-client/requirements.txt | 5 --
hugegraph-python-client/setup.py | 47 ------------------
12 files changed, 110 insertions(+), 145 deletions(-)
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index 174922f..a6421fc 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -32,7 +32,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@v2
+ uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a
config file.
@@ -46,7 +46,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java,
or Swift).
# If this step fails, then you should remove it and run the build manually
(see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@v2
+ uses: github/codeql-action/autobuild@v3
# âšī¸ Command-line programs to run using the OS shell.
# đ See
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -59,6 +59,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v2
+ uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
diff --git a/.github/workflows/hugegraph-python-client.yml
b/.github/workflows/hugegraph-python-client.yml
index 6f2467a..927a6b3 100644
--- a/.github/workflows/hugegraph-python-client.yml
+++ b/.github/workflows/hugegraph-python-client.yml
@@ -39,22 +39,17 @@ jobs:
uses: actions/cache@v4
with:
path: |
- .venv
~/.cache/uv
- ~/.cache/pip
- # TODO: switch to pyproject.toml after uv adoption
- key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{
hashFiles('hugegraph-python-client/requirements.txt') }}
+ key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{
hashFiles('**/pyproject.toml') }}
restore-keys: |
- ${{ runner.os }}-venv-${{ matrix.python-version }}-
- ${{ runner.os }}-venv-
+ ${{ runner.os }}-uv-${{ matrix.python-version }}-
# TODO: use pyproject.toml later
- name: Install dependencies
- if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
uv venv && source .venv/bin/activate
uv pip install pytest
- uv pip install -r ./hugegraph-python-client/requirements.txt #
TODO: use uv pip install ./hugegraph-python-client later
+ uv pip install ./hugegraph-python-client
- name: Test example
run: |
diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml
index 5b98daf..7cf4fcf 100644
--- a/.github/workflows/pylint.yml
+++ b/.github/workflows/pylint.yml
@@ -33,23 +33,19 @@ jobs:
uses: actions/cache@v4
with:
path: |
- .venv
~/.cache/uv
~/.cache/pip
- key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{
hashFiles('**/requirements.txt', '**/pyproject.toml') }}
+ key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{
hashFiles('**/pyproject.toml') }}
restore-keys: |
- ${{ runner.os }}-venv-${{ matrix.python-version }}-
- ${{ runner.os }}-venv-
+ ${{ runner.os }}-uv-${{ matrix.python-version }}-
- name: Install dependencies
- if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
uv venv && source .venv/bin/activate
uv pip install pylint pytest
- # TODO: use pyproject.toml later (unify all modules)
- uv pip install -r ./hugegraph-python-client/requirements.txt
+ uv pip install ./hugegraph-python-client
uv pip install ./hugegraph-llm
- uv pip install -r ./hugegraph-ml/requirements.txt
+ uv pip install ./hugegraph-ml
- name: Check DGL version
run: |
diff --git a/hugegraph-llm/pyproject.toml b/hugegraph-llm/pyproject.toml
index 55e427a..8d2a83c 100644
--- a/hugegraph-llm/pyproject.toml
+++ b/hugegraph-llm/pyproject.toml
@@ -55,7 +55,7 @@ dependencies = [
"rich~=13.9.4",
"apscheduler~=3.10.4",
"litellm~=1.61.13",
- "hugegraph-python"
+ "hugegraph-python-client"
]
[project.urls]
homepage = "https://hugegraph.apache.org/"
@@ -88,4 +88,4 @@ include = [
allow-direct-references = true
[tool.uv.sources]
-hugegraph-python = { path = "../hugegraph-python-client/", editable = true }
+hugegraph-python-client = { path = "../hugegraph-python-client/", editable =
true }
diff --git a/hugegraph-ml/README.md b/hugegraph-ml/README.md
index 1465db9..d1c46e4 100644
--- a/hugegraph-ml/README.md
+++ b/hugegraph-ml/README.md
@@ -52,10 +52,9 @@ The implemented algorithm models can be found in the
[models](./src/hugegraph_ml
3. Install [hugegraph-python-client](../hugegraph-python-client) and
[hugegraph-ml](../hugegraph-ml)
```bash
- cd ./incubator-hugegraph-ai # better to use virtualenv (source
venv/bin/activate)
- pip install ./hugegraph-python-client
- cd ./hugegraph-ml/
- pip install -e .
+ uv venv && source .venv/bin/activate # create and activate virtual
environment
+ cd ./hugegraph-ml/ # navigate to the hugegraph-ml directory
+ uv pip install . # install dependencies using uv
```
4. Enter the project directory
diff --git a/hugegraph-ml/pyproject.toml b/hugegraph-ml/pyproject.toml
index f0a7ae5..a92cfae 100644
--- a/hugegraph-ml/pyproject.toml
+++ b/hugegraph-ml/pyproject.toml
@@ -17,5 +17,58 @@
[build-system]
-requires = ["setuptools>=64", "wheel"]
-build-backend = "setuptools.build_meta"
+requires = ["hatchling"]
+build-backend = "hatchling.build"
+
+[project]
+name = "hugegraph-ml"
+version = "1.5.0"
+description = "Machine learning extensions for Apache HugeGraph."
+authors = [
+ { name = "Apache HugeGraph Contributors", email =
"[email protected]" },
+]
+readme = "README.md"
+license = "Apache-2.0"
+requires-python = ">=3.9"
+
+dependencies = [
+ "dgl~=2.1.0",
+ "ogb~=1.3.6",
+ "pandas~=2.2.3",
+ "catboost~=1.2.3",
+ "category_encoders~=2.6.3",
+ "numpy~=1.24.4",
+ "torch==2.2.0",
+ "tqdm~=4.66.5",
+ "packaging~=24.1",
+ "torchdata~=0.7.0",
+ "PyYAML~=6.0.2",
+ "pydantic~=2.9.2",
+ "hugegraph-python-client"
+]
+
+[project.urls]
+homepage = "https://hugegraph.apache.org/"
+repository = "https://github.com/apache/incubator-hugegraph-ai"
+
+# If you want to modify the network configuration file of the project, then
you can modify this part
+[[tool.uv.index]]
+url = "https://pypi.tuna.tsinghua.edu.cn/simple"
+default = true
+
+[tool.hatch.build.targets.wheel]
+packages = ["src/hugegraph_ml"]
+
+[tool.hatch.build.targets.sdist]
+include = [
+ "src/hugegraph_ml",
+ "README.md",
+ "LICENSE",
+ "NOTICE",
+]
+
+[tool.hatch.metadata]
+allow-direct-references = true
+
+[tool.uv.sources]
+hugegraph-python-client = { path = "../hugegraph-python-client/", editable =
true }
diff --git a/hugegraph-ml/requirements.txt b/hugegraph-ml/requirements.txt
deleted file mode 100644
index 1a2aa69..0000000
--- a/hugegraph-ml/requirements.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-dgl~=2.1.0
-ogb~=1.3.6
-pandas~=2.2.3
-catboost~=1.2.3
-category_encoders~=2.6.3
-numpy~=1.24.4
-torch==2.2.0
-tqdm~=4.66.5
-packaging~=24.1
-torchdata~=0.7.0
-PyYAML~=6.0.2
-pydantic~=2.9.2
diff --git a/hugegraph-ml/setup.py b/hugegraph-ml/setup.py
deleted file mode 100644
index b81bb81..0000000
--- a/hugegraph-ml/setup.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# 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.
-
-import setuptools
-from pkg_resources import parse_requirements
-
-with open("README.md", "r", encoding="utf-8") as fh:
- long_description = fh.read()
-
-with open("requirements.txt", encoding="utf-8") as fp:
- install_requires = [str(requirement) for requirement in
parse_requirements(fp)]
-
-setuptools.setup(
- name="hugegraph-ml",
- version="1.5.0",
- author="Apache HugeGraph Contributors",
- author_email="[email protected]",
- install_requires=install_requires,
- include_package_data=True,
- description="Machine learning extensions for Apache HugeGraph.",
- long_description=long_description,
- long_description_content_type="text/markdown",
- url="https://github.com/apache/incubator-hugegraph-ai",
- packages=setuptools.find_packages(where="src", exclude=["tests"]),
- package_dir={"": "src"},
- classifiers=[
- "Programming Language :: Python :: 3",
- "License :: OSI Approved :: Apache Software License",
- "Operating System :: OS Independent",
- ],
- python_requires=">=3.9",
-)
diff --git a/hugegraph-python-client/README.md
b/hugegraph-python-client/README.md
index d282016..36a26f2 100644
--- a/hugegraph-python-client/README.md
+++ b/hugegraph-python-client/README.md
@@ -1,17 +1,19 @@
# hugegraph-python-client
-The `hugegraph-python-client` is a Python client(SDK( for HugeGraph.
+The `hugegraph-python-client` is a Python client/SDK for HugeGraph Database.
It is used to define graph structures, perform CRUD operations on graph data,
manage schemas, and execute Gremlin queries. Both the `hugegraph-llm` and
`hugegraph-ml` modules depend on this foundational library.
## Installation
-### Install released package(Stable)
+### Install the released package (Stable)
-To install the `hugegraph-python-client`, you can use pip/poetry/source
building:
+To install the `hugegraph-python-client`, you can use uv/pip or source code
building:
```bash
-pip install hugegraph-python # Note: may not the latest version, recommend to
install from source
+# uv is optional, you can use pip directly
+uv pip install hugegraph-python # Note: may not the latest version, recommend
to install from source
+# WIP: we will use 'hugegraph-python-client' as the package name soon
```
### Install from Source (Latest Code)
@@ -23,10 +25,10 @@ git clone
https://github.com/apache/incubator-hugegraph-ai.git
cd incubator-hugegraph-ai/hugegraph-python-client
# Normal install
-pip install .
+uv pip install .
# (Optional) install the devel version
-pip install -e .
+uv pip install -e .
```
## Usage
@@ -168,7 +170,7 @@ res = g.exec("g.V().limit(5)")
print(res)
```
-Other info are under đ§ (Welcome to add more docs for it, users could refer
[java-client-doc]([url](https://hugegraph.apache.org/docs/clients/hugegraph-client/))
for similar usage)
+Other info is under đ§ (Welcome to add more docs for it, users could refer
[java-client-doc]([url](https://hugegraph.apache.org/docs/clients/hugegraph-client/))
for similar usage)
## Contributing
diff --git a/hugegraph-ml/pyproject.toml
b/hugegraph-python-client/pyproject.toml
similarity index 51%
copy from hugegraph-ml/pyproject.toml
copy to hugegraph-python-client/pyproject.toml
index f0a7ae5..27bceae 100644
--- a/hugegraph-ml/pyproject.toml
+++ b/hugegraph-python-client/pyproject.toml
@@ -15,7 +15,37 @@
# specific language governing permissions and limitations
# under the License.
+[project]
+name = "hugegraph-python-client"
+version = "1.5.0"
+description = "A Python SDK for Apache HugeGraph Database."
+authors = [
+ { name = "Apache HugeGraph Contributors", email =
"[email protected]" },
+]
+readme = "README.md"
+license = "Apache-2.0"
+requires-python = ">=3.9"
+
+dependencies = [
+ "decorator~=5.1.1",
+ "requests~=2.32.0",
+ "setuptools~=70.0.0",
+ "urllib3~=2.2.2",
+ "rich~=13.9.4",
+]
+
+[project.urls]
+"Homepage" = "https://github.com/apache/incubator-hugegraph-ai"
+"Repository" = "https://github.com/apache/incubator-hugegraph-ai"
+"Bug Tracker" = "https://github.com/apache/incubator-hugegraph-ai/issues"
[build-system]
-requires = ["setuptools>=64", "wheel"]
+requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
+
+[tool.setuptools.packages.find]
+where = ["src"]
+exclude = ["tests"]
+
+[tool.setuptools]
+package-dir = {"" = "src"}
diff --git a/hugegraph-python-client/requirements.txt
b/hugegraph-python-client/requirements.txt
deleted file mode 100644
index be3a3e2..0000000
--- a/hugegraph-python-client/requirements.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-decorator~=5.1.1
-requests~=2.32.0
-setuptools~=70.0.0
-urllib3~=2.2.2
-rich~=13.9.4
diff --git a/hugegraph-python-client/setup.py b/hugegraph-python-client/setup.py
deleted file mode 100644
index 65ddab5..0000000
--- a/hugegraph-python-client/setup.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# 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.
-
-import setuptools
-from pkg_resources import parse_requirements
-
-# TODO: replace it by poetry/uv configs (e.g. pyproject.toml)
-
-with open("README.md", "r", encoding="utf-8") as fh:
- long_description = fh.read()
-
-with open("requirements.txt", encoding="utf-8") as fp:
- install_requires = [str(requirement) for requirement in
parse_requirements(fp)]
-
-setuptools.setup(
- name="hugegraph-python",
- version="1.5.0",
- author="Apache HugeGraph Contributors",
- author_email="[email protected]",
- install_requires=install_requires,
- description="A Python SDK for Apache HugeGraph",
- long_description=long_description,
- long_description_content_type="text/markdown",
- url="https://github.com/apache/incubator-hugegraph-ai",
- packages=setuptools.find_packages(where="src", exclude=["tests"]),
- package_dir={"": "src"},
- classifiers=[
- "Programming Language :: Python :: 3",
- "License :: OSI Approved :: Apache Software License",
- "Operating System :: OS Independent",
- ],
- python_requires=">=3.9",
-)