This guide provides comprehensive documentation for developers who want to contribute to DB-GPT or build applications using its framework. It covers environment setup, project structure, testing practices, and the contribution workflow. This guide assumes familiarity with Python development and modern development tools.
For deployment configuration, see Deployment and Configuration. For usage examples and scripts, see Example Usage and Scripts.
DB-GPT uses a monorepo architecture managed by uv, a fast Python package manager. The project is organized into seven independent packages that can be installed selectively based on use case. All packages use Hatchling as the build backend and follow PEP 517/PEP 660 standards for building and editable installs.
Before contributing to DB-GPT, ensure you have the following installed:
| Tool | Version | Purpose |
|---|---|---|
| Python | ≥ 3.10 | Required runtime |
| uv | Latest | Package and dependency management |
| Git | Latest | Version control |
| Make | Latest | Build automation (optional) |
Additional requirements for specific features:
Sources: pyproject.toml13 packages/dbgpt-core/pyproject.toml13
Package Dependency Relationships
The monorepo consists of seven packages with the following dependency chain:
dbgpt-core, provides storage implementationsdbgpt-ext, provides service layerdbgpt-serve, dbgpt-client, dbgpt-acc-autodbgpt-core, standalone client SDKEach package has its own pyproject.toml defining dependencies, optional extras, and build configuration.
Sources: pyproject.toml31-40 packages/dbgpt-core/pyproject.toml1-27 packages/dbgpt-ext/pyproject.toml12-15 packages/dbgpt-serve/pyproject.toml12-14 packages/dbgpt-app/pyproject.toml12-20
Standard Development Cycle
uvmainruffSources: pyproject.toml44-60 .gitignore1-193
DB-GPT uses uv instead of traditional pip for significantly faster dependency resolution and installation. The workspace is defined in the root pyproject.toml with workspace members:
The single uv.lock file at workspace root locks all dependencies across packages, ensuring reproducible builds.
Sources: pyproject.toml31-40 uv.lock1-3
Each package defines optional extras for selective feature installation:
| Package | Extra | Purpose |
|---|---|---|
| dbgpt-core | client, cli, agent, simple_framework, framework, hf, code | Core features |
| dbgpt-ext | rag, graph_rag, datasource_*, storage_* | Storage backends |
| dbgpt-app | cache, observability, base, dbgpts | Application features |
| dbgpt-acc-auto | auto, cpu, cuda118, cuda121, cuda124, vllm, mlx | Hardware acceleration |
Install with extras: uv sync --extra rag --extra storage_milvus
Sources: packages/dbgpt-core/pyproject.toml34-166 packages/dbgpt-ext/pyproject.toml27-88 packages/dbgpt-accelerator/dbgpt-acc-auto/pyproject.toml26-103
All packages maintain synchronized versions. The version is defined in multiple locations:
version = "0.7.5"version = "0.7.5"When releasing, all versions must be updated across:
pyproject.tomlpyproject.toml_version.pySources: pyproject.toml3 packages/dbgpt-core/src/dbgpt/_version.py1 packages/dbgpt-ext/src/dbgpt_ext/_version.py1 packages/dbgpt-app/src/dbgpt_app/_version.py1
DB-GPT uses Hatchling as the PEP 517 build backend:
Each package specifies:
Build a package: uv build packages/dbgpt-core
Sources: packages/dbgpt-core/pyproject.toml167-203
DB-GPT uses pytest with custom configuration:
Test organization:
Run tests: pytest packages/dbgpt-core/tests
Sources: pyproject.toml63-66
Ruff is used for linting and formatting:
Commands:
ruff check .ruff format .ruff check --fix .Sources: pyproject.toml68-86
Important Directories
| Path | Purpose |
|---|---|
packages/dbgpt-core/src/dbgpt/ | Core framework code |
packages/dbgpt-ext/src/dbgpt_ext/ | Storage implementations |
packages/dbgpt-app/src/dbgpt_app/ | Application layer |
packages/dbgpt-serve/src/dbgpt_serve/ | Service components |
packages/*/tests/ | Test files (excluded from builds) |
examples/ | Usage examples |
docker/ | Docker build files |
web/ | Next.js web interface |
.venv/ | Virtual environment (gitignored) |
logs/ | Log files (gitignored) |
.plugin_env | Plugin configuration (gitignored) |
Sources: .gitignore1-193 packages/dbgpt-core/pyproject.toml194-203
Sources: pyproject.toml42-60
The .gitignore file excludes:
build/, dist/, *.egg-info/__pycache__/, *.pyc.venv/, venv/, ENV/.vscode/, .idea/.env*, .plugin_envlogs/, .vectordb/, pilot/data/.pytest_cache/, .coveragedbgpt/util/extensions/web/.next/, web/node_modules/Sources: .gitignore1-193
Follow these conventions for branch names:
feature/add-milvus-support)bugfix/fix-memory-leak)docs/update-api-docs)refactor/storage-interface)test/add-rag-tests)For detailed information on specific development topics, see:
Sources: pyproject.toml1-86 packages/dbgpt-core/pyproject.toml1-205 packages/dbgpt-ext/pyproject.toml1-106 packages/dbgpt-app/pyproject.toml1-65 packages/dbgpt-serve/pyproject.toml1-44 packages/dbgpt-client/pyproject.toml1-47 packages/dbgpt-accelerator/dbgpt-acc-auto/pyproject.toml1-197 packages/dbgpt-accelerator/dbgpt-acc-flash-attn/pyproject.toml1-33 uv.lock1-20 .gitignore1-193
Refresh this wiki