Skip to content

Commit 53a8255

Browse files
feat: add ruff format & init mypy config & add pre-commit (#313)
Co-authored-by: imbajin <jin@apache.org>
1 parent 1c2b578 commit 53a8255

244 files changed

Lines changed: 1524 additions & 2573 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ body:
1515
Issue 标题请保持原有模板分类(例如:`[Bug]`), 长段描述之间可以增加`空行`或使用`序号`标记,保持排版清晰。
1616
3. Please submit an issue in the corresponding module, lack of valid information / long time (>14 days) unanswered issues may be closed (will be reopened when updated).
1717
请在对应的模块提交 issue, 缺乏有效信息 / 长时间 (> 14 天) 没有回复的 issue 可能会被 **关闭**(更新时会再开启)。
18-
18+
1919
- type: dropdown
2020
attributes:
2121
label: Bug Type (问题类型)
@@ -26,7 +26,7 @@ body:
2626
- data inconsistency (数据不一致)
2727
- exception / error (异常报错)
2828
- others (please comment below)
29-
29+
3030
- type: checkboxes
3131
attributes:
3232
label: Before submit
@@ -45,16 +45,16 @@ body:
4545
- Data Size: xx vertices, xx edges <!-- (like 1000W 点,9000W 边) -->>
4646
validations:
4747
required: true
48-
48+
4949
- type: textarea
5050
attributes:
5151
label: Expected & Actual behavior (期望与实际表现)
5252
description: |
5353
we can refer [How to create a minimal reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example), if possible, please provide screenshots or GIF.
5454
可以参考 [如何提供最简的可复现用例](https://stackoverflow.com/help/minimal-reproducible-example),请提供清晰的截图,动图录屏更佳。
5555
placeholder: |
56-
type the main problem here
57-
56+
type the main problem here
57+
5858
```java
5959
// Detailed exception / error info (尽可能详细的日志 + 完整异常栈)
6060

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ body:
2323
description: >
2424
Please describe the function you want in as much detail as possible. (请简要描述新功能 /
2525
需求的使用场景或上下文, 最好能给个具体的例子说明)
26-
placeholder: type the feature description here
26+
placeholder: type the feature description here
2727
validations:
2828
required: true
2929

@@ -50,4 +50,3 @@ body:
5050
- type: markdown
5151
attributes:
5252
value: "Thanks for completing our form, and we will reply you as soon as possible."
53-

.github/ISSUE_TEMPLATE/question_ask.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ body:
2727
- configs (配置项 / 文档相关)
2828
- exception / error (异常报错)
2929
- others (please comment below)
30-
30+
3131
- type: checkboxes
3232
attributes:
3333
label: Before submit
@@ -54,8 +54,8 @@ body:
5454
For issues related to graph usage/configuration, please refer to [REST-API documentation](https://hugegraph.apache.org/docs/clients/restful-api/), and [Server configuration documentation](https://hugegraph.apache.org/docs/config/config-option/) (if possible, please provide screenshots or GIF).
5555
图使用 / 配置相关问题,请优先参考 [REST-API 文档](https://hugegraph.apache.org/docs/clients/restful-api/), 以及 [Server 配置文档](https://hugegraph.apache.org/docs/config/config-option/) (请提供清晰的截图,动图录屏更佳)
5656
placeholder: |
57-
type the main problem here
58-
57+
type the main problem here
58+
5959
```java
6060
// Exception / Error info (尽可能详细的日志 + 完整异常栈)
6161
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
# TODO: replace by ruff & mypy soon
2-
name: "Pylint"
1+
name: "Ruff Code Quality"
32

43
on:
54
push:
65
branches:
7-
- 'main'
8-
- 'master'
9-
- 'release-*'
6+
- "main"
7+
- "release-*"
108
pull_request:
119

1210
jobs:
1311
build:
1412
runs-on: ubuntu-latest
1513
strategy:
1614
matrix:
17-
python-version: ["3.10", "3.11"]
15+
python-version: ["3.10", "3.11", "3.12"]
1816

1917
steps:
2018
- uses: actions/checkout@v4
@@ -48,6 +46,10 @@ jobs:
4846
run: |
4947
uv run python -c "import dgl; print(dgl.__version__)"
5048
51-
- name: Analysing the code with pylint
49+
- name: Check code formatting with Ruff
5250
run: |
53-
uv run bash ./style/code_format_and_analysis.sh -p
51+
uv run ruff format --check .
52+
53+
- name: Lint code with Ruff
54+
run: |
55+
uv run ruff check .

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ venv.bak/
185185
# Rope project settings
186186
.ropeproject
187187

188-
.pre-commit-config.yaml
189-
190188
# mkdocs documentation
191189
/site
192190

.pre-commit-config.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
repos:
19+
- repo: https://github.com/pre-commit/pre-commit-hooks
20+
rev: v4.6.0
21+
hooks:
22+
- id: trailing-whitespace
23+
- id: end-of-file-fixer
24+
- id: check-yaml
25+
- id: check-added-large-files
26+
args: ["--maxkb=1000"]
27+
- id: check-merge-conflict
28+
- id: check-case-conflict
29+
- id: check-docstring-first
30+
- id: debug-statements
31+
32+
- repo: https://github.com/astral-sh/ruff-pre-commit
33+
rev: v0.13.1
34+
hooks:
35+
- id: ruff-format
36+
types_or: [python, pyi]
37+
- id: ruff
38+
types_or: [python, pyi]
39+
args: [--fix]

DISCLAIMER

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Apache HugeGraph (incubating) is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator PMC.
22

3-
Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications,
3+
Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications,
44
and decision making process have stabilized in a manner consistent with other successful ASF projects.
55

6-
While incubation status is not necessarily a reflection of the completeness or stability of the code,
6+
While incubation status is not necessarily a reflection of the completeness or stability of the code,
77
it does indicate that the project has yet to be fully endorsed by the ASF.

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,19 @@ uv add numpy # Add to base dependencies
178178
uv add --group dev pytest-mock # Add to dev group
179179
```
180180

181-
**Key Points:**
181+
### Code Quality (ruff + pre-commit)
182+
183+
- Ruff is used for linting and formatting:
184+
- \`ruff format .\`
185+
- \`ruff check .\`
186+
- Enable Git hooks via pre-commit:
187+
- \`pre-commit install\`
188+
- \`pre-commit run --all-files\`
189+
- Config: [.pre-commit-config.yaml](.pre-commit-config.yaml). CI enforces these checks.
190+
**Key Points:**
191+
- Config: [.pre-commit-config.yaml](.pre-commit-config.yaml). CI enforces these checks.
182192

193+
**Key Points:**
183194
- Use [GitHub Desktop](https://desktop.github.com/) for easier PR management
184195
- Check existing issues before reporting bugs
185196

docker/docker-compose-network.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ services:
4848
interval: 30s
4949
timeout: 10s
5050
retries: 3
51-
start_period: 60s
51+
start_period: 60s

hugegraph-llm/AGENTS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ This file provides guidance to AI coding tools and developers when working with
44

55
## Project Overview
66

7-
HugeGraph-LLM is a comprehensive toolkit that bridges graph databases and large language models,
8-
part of the Apache HugeGraph AI ecosystem. It enables seamless integration between HugeGraph and LLMs for building
9-
intelligent applications with three main capabilities: Knowledge Graph Construction, Graph-Enhanced RAG,
7+
HugeGraph-LLM is a comprehensive toolkit that bridges graph databases and large language models,
8+
part of the Apache HugeGraph AI ecosystem. It enables seamless integration between HugeGraph and LLMs for building
9+
intelligent applications with three main capabilities: Knowledge Graph Construction, Graph-Enhanced RAG,
1010
and Text2Gremlin query generation.
1111

1212
## Tech Stack

0 commit comments

Comments
 (0)