Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions .github/workflows/pylint.yml → .github/workflows/code-checks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pylint
name: Python Code Quality Checks

on:
push:
Expand All @@ -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
17 changes: 11 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,13 +641,11 @@ def convert_metadata_filters(self, filters: MetadataFilters) -> str:
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")
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]