workflow(pylint): fix pylint workflow

This commit is contained in:
yyhhyyyyyy 2025-03-11 17:15:40 +08:00
parent 49ce86f2ce
commit 37660eec41
4 changed files with 23 additions and 22 deletions

View File

@ -14,18 +14,16 @@ concurrency:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install dependencies and setup environment
run: make setup
run: |
uv -V
make setup
- name: Check Python code style
run: make fmt-check
- name: Check Python code type
run: make mypy
# TODO: Add mypy check
# - name: Check Python code type
# run: make mypy

View File

@ -16,17 +16,21 @@ $(VENV)/bin/activate: $(VENV)/.venv-timestamp
$(VENV)/.venv-timestamp: uv.lock
# Create new virtual environment if setup.py has changed
#python3 -m venv $(VENV)
uv venv --python 3.10 $(VENV)
uv venv --python 3.11 $(VENV)
uv pip install --prefix $(VENV) ruff
uv pip install --prefix $(VENV) mypy
touch $(VENV)/.venv-timestamp
testenv: $(VENV)/.testenv
$(VENV)/.testenv: $(VENV)/bin/activate
# $(VENV_BIN)/pip install -e ".[framework]"
# the openai optional dependency is include framework and rag dependencies
$(VENV_BIN)/pip install -e ".[openai]"
uv sync --all-packages \
--extra "base" \
--extra "proxy_openai" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "dbgpts" \
--link-mode=copy
touch $(VENV)/.testenv
@ -75,7 +79,8 @@ test-doc: $(VENV)/.testenv ## Run doctests
.PHONY: mypy
mypy: $(VENV)/.testenv ## Run mypy checks
# https://github.com/python/mypy
$(VENV_BIN)/mypy --config-file .mypy.ini dbgpt/rag/ dbgpt/datasource/ dbgpt/client/ dbgpt/agent/ dbgpt/vis/ dbgpt/experimental/
$(VENV_BIN)/mypy --config-file .mypy.ini --ignore-missing-imports packages/dbgpt-core/
# $(VENV_BIN)/mypy --config-file .mypy.ini dbgpt/rag/ dbgpt/datasource/ dbgpt/client/ dbgpt/agent/ dbgpt/vis/ dbgpt/experimental/
# rag depends on core and storage, so we not need to check it again.
# $(VENV_BIN)/mypy --config-file .mypy.ini dbgpt/storage/
# $(VENV_BIN)/mypy --config-file .mypy.ini dbgpt/core/

View File

@ -641,13 +641,11 @@ class MilvusStore(VectorStoreBase):
return metadata_filter_expr
def truncate(self):
"""Truncate milvus collection.
"""
"""Truncate milvus collection."""
logger.info(f"begin truncate milvus collection:{self.collection_name}")
from pymilvus import utility
if utility.has_collection(self.collection_name):
utility.drop_collection(self.collection_name)
logger.info(
f"truncate milvus collection {self.collection_name} success"
)
logger.info(f"truncate milvus collection {self.collection_name} success")

View File

@ -69,6 +69,6 @@ line-ending = "auto"
# Enable: eror check, import order
select = ["E", "F", "I"]
[tool.ruff.isort]
[tool.ruff.lint.isort]
# Specify the local modules (first-party)
known-first-party = ["dbgpt", "dbgpt_acc_auto", "dbgpt_client", "dbgpt_ext", "dbgpt_serve", "dbgpt_app"]