Skip to content

Commit 528c0c8

Browse files
authored
workflow(ruff): add ruff code checks workflow (#2438)
fix pylint workflow
2 parents 49ce86f + 60aa035 commit 528c0c8

File tree

4 files changed

+24
-23
lines changed

4 files changed

+24
-23
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Pylint
1+
name: Python Code Quality Checks
22

33
on:
44
push:
@@ -14,18 +14,16 @@ concurrency:
1414
jobs:
1515
build:
1616
runs-on: ubuntu-latest
17-
strategy:
18-
matrix:
19-
python-version: ["3.10", "3.11"]
2017
steps:
2118
- uses: actions/checkout@v3
22-
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v3
24-
with:
25-
python-version: ${{ matrix.python-version }}
19+
- name: Install uv
20+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
2621
- name: Install dependencies and setup environment
27-
run: make setup
22+
run: |
23+
uv -V
24+
make setup
2825
- name: Check Python code style
2926
run: make fmt-check
30-
- name: Check Python code type
31-
run: make mypy
27+
# TODO: Add mypy check
28+
# - name: Check Python code type
29+
# run: make mypy

Makefile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,21 @@ $(VENV)/bin/activate: $(VENV)/.venv-timestamp
1616

1717
$(VENV)/.venv-timestamp: uv.lock
1818
# Create new virtual environment if setup.py has changed
19-
#python3 -m venv $(VENV)
20-
uv venv --python 3.10 $(VENV)
19+
uv venv --python 3.11 $(VENV)
2120
uv pip install --prefix $(VENV) ruff
21+
uv pip install --prefix $(VENV) mypy
2222
touch $(VENV)/.venv-timestamp
2323

2424
testenv: $(VENV)/.testenv
2525

2626
$(VENV)/.testenv: $(VENV)/bin/activate
27-
# $(VENV_BIN)/pip install -e ".[framework]"
28-
# the openai optional dependency is include framework and rag dependencies
29-
$(VENV_BIN)/pip install -e ".[openai]"
27+
uv sync --all-packages \
28+
--extra "base" \
29+
--extra "proxy_openai" \
30+
--extra "rag" \
31+
--extra "storage_chromadb" \
32+
--extra "dbgpts" \
33+
--link-mode=copy
3034
touch $(VENV)/.testenv
3135

3236

@@ -75,7 +79,8 @@ test-doc: $(VENV)/.testenv ## Run doctests
7579
.PHONY: mypy
7680
mypy: $(VENV)/.testenv ## Run mypy checks
7781
# https://github.com/python/mypy
78-
$(VENV_BIN)/mypy --config-file .mypy.ini dbgpt/rag/ dbgpt/datasource/ dbgpt/client/ dbgpt/agent/ dbgpt/vis/ dbgpt/experimental/
82+
$(VENV_BIN)/mypy --config-file .mypy.ini --ignore-missing-imports packages/dbgpt-core/
83+
# $(VENV_BIN)/mypy --config-file .mypy.ini dbgpt/rag/ dbgpt/datasource/ dbgpt/client/ dbgpt/agent/ dbgpt/vis/ dbgpt/experimental/
7984
# rag depends on core and storage, so we not need to check it again.
8085
# $(VENV_BIN)/mypy --config-file .mypy.ini dbgpt/storage/
8186
# $(VENV_BIN)/mypy --config-file .mypy.ini dbgpt/core/

packages/dbgpt-ext/src/dbgpt_ext/storage/vector_store/milvus_store.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -641,13 +641,11 @@ def convert_metadata_filters(self, filters: MetadataFilters) -> str:
641641
return metadata_filter_expr
642642

643643
def truncate(self):
644-
"""Truncate milvus collection.
645-
"""
644+
"""Truncate milvus collection."""
646645
logger.info(f"begin truncate milvus collection:{self.collection_name}")
647646
from pymilvus import utility
647+
648648
if utility.has_collection(self.collection_name):
649649
utility.drop_collection(self.collection_name)
650650

651-
logger.info(
652-
f"truncate milvus collection {self.collection_name} success"
653-
)
651+
logger.info(f"truncate milvus collection {self.collection_name} success")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ line-ending = "auto"
6969
# Enable: eror check, import order
7070
select = ["E", "F", "I"]
7171

72-
[tool.ruff.isort]
72+
[tool.ruff.lint.isort]
7373
# Specify the local modules (first-party)
7474
known-first-party = ["dbgpt", "dbgpt_acc_auto", "dbgpt_client", "dbgpt_ext", "dbgpt_serve", "dbgpt_app"]

0 commit comments

Comments
 (0)