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: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }} - name: Install uv
uses: actions/setup-python@v3 run: curl -LsSf https://astral.sh/uv/install.sh | sh
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies and setup environment - name: Install dependencies and setup environment
run: make setup run: |
uv -V
make setup
- name: Check Python code style - name: Check Python code style
run: make fmt-check run: make fmt-check
- name: Check Python code type # TODO: Add mypy check
run: make mypy # - 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 $(VENV)/.venv-timestamp: uv.lock
# Create new virtual environment if setup.py has changed # Create new virtual environment if setup.py has changed
#python3 -m venv $(VENV) uv venv --python 3.11 $(VENV)
uv venv --python 3.10 $(VENV)
uv pip install --prefix $(VENV) ruff uv pip install --prefix $(VENV) ruff
uv pip install --prefix $(VENV) mypy
touch $(VENV)/.venv-timestamp touch $(VENV)/.venv-timestamp
testenv: $(VENV)/.testenv testenv: $(VENV)/.testenv
$(VENV)/.testenv: $(VENV)/bin/activate $(VENV)/.testenv: $(VENV)/bin/activate
# $(VENV_BIN)/pip install -e ".[framework]" uv sync --all-packages \
# the openai optional dependency is include framework and rag dependencies --extra "base" \
$(VENV_BIN)/pip install -e ".[openai]" --extra "proxy_openai" \
--extra "rag" \
--extra "storage_chromadb" \
--extra "dbgpts" \
--link-mode=copy
touch $(VENV)/.testenv touch $(VENV)/.testenv
@ -75,7 +79,8 @@ test-doc: $(VENV)/.testenv ## Run doctests
.PHONY: mypy .PHONY: mypy
mypy: $(VENV)/.testenv ## Run mypy checks mypy: $(VENV)/.testenv ## Run mypy checks
# https://github.com/python/mypy # 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. # 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/storage/
# $(VENV_BIN)/mypy --config-file .mypy.ini dbgpt/core/ # $(VENV_BIN)/mypy --config-file .mypy.ini dbgpt/core/

View File

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

View File

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