MCP 服务 2026-10-09 16:46 UTC
dbt-mcp
由提交人 DevonFulcher 提交,主要更新类型为:常规更新与维护。提交说明:Declare every third-party package imported directly (#930)。对项目做了常规维护与小幅调整。
Commit提交信息原文
Declare every third-party package imported directly (#930) ## What Declares as a direct dependency every third-party package that the code imports directly but that is only installed because another package happens to depend on it. - 4 entries in `dependencies`: `pydantic`, `pydantic-core`, `anyio`, `pyarrow` - 1 entry in the `dev` group: `cryptography` - `uv.lock` only gains metadata lines (details below) - A short "Dependencies" section in `CLAUDE.md` so the rule is followed from here on ## Why The rule: **never rely on a package transitively.** If code imports it, `pyproject.toml` declares it. Otherwise a change to what another dependency requires (a dropped dependency, a tightened upper bound, a lower floor than we need) silently removes or downgrades a package we import, and the first sign is an `ImportError` at runtime. This is the same class of problem as the pydantic 2.14 startup failure (#921, fixed in #923). `pydantic` is imported by 24 modules under `src` but was only installed through `pydantic-settings`, so users running `uvx dbt-mcp` resolved whatever pydantic release was newest, while CI tested the locked version. Declaring a package does not pin it or cap it. The lower bound on each new entry is the version `uv.lock` already resolves, so no resolution changes. ## Packages and where each is imported `dependencies`: | Package | Example import site | | --- | --- | | `pydantic` | `src/dbt_mcp/config/settings.py` (and 23 more under `src`) | | `pydantic-core` | `src/dbt_mcp/config/settings.py`, `src/dbt_mcp/proxy/tools.py` | | `anyio` | `src/dbt_mcp/proxy/tools.py` | | `pyarrow` | `src/dbt_mcp/semantic_layer/client.py` | `dev` group: | Package | Import site | | --- | --- | | `cryptography` | `tests/unit/oauth/test_token.py` | ## How the list was found Two independent checks, run ad hoc without adding anything to the project: 1. `deptry` over `src`, `tests`, `scripts` and `evals`. Its transitive-dependency findings (`DEP003`) cover `pydantic`, `pydantic-core`, `anyio` and `pyarrow`. 2. A script that parses every import in those directories and maps each module file to the distribution that owns it, using the installed package file lists. It also covers namespace packages that `deptry` cannot see. It reports `cryptography` as well, and no other package imported but undeclared in any group. After this change `deptry` reports no transitive findings. The only remaining findings are for `openai` in `src/client/`, a dev-only chat client that is not part of the shipped package, where `openai` is already declared in the `dev` group. ## Evidence the lock does not change `uv lock` followed by `uv lock --check` passes. The `uv.lock` diff is 10 added lines and 0 removed lines: for each of the 5 packages, one entry in the root package's `dependencies` or `dev` list and one `specifier` line in `requires-dist` or `requires-dev`. No `version`, `source`, `sdist` or `wheels` line is touched. ## How it was verified - Built the wheel and installed it into a clean environment with freshly resolved, unlocked dependencies, which is how `uvx dbt-mcp` users get theirs. It resolved newer versions than the lock (pydantic 2.13.5, anyio 4.15.1, pyarrow 25.0.1), `dbt_mcp.main`, `dbt_mcp.proxy.tools` and `dbt_mcp.semantic_layer.client` imported, and `dbt-mcp` started and registered its tools. The five new requirements appear in the wheel metadata. - 1,037 unit tests and the pre-commit checks pass locally. ## Not in this PR - `adbc-driver-flightsql` and `adbc-driver-manager` are not imported on `main` today. Open PR [#922](https://github.com/dbt-labs/dbt-mcp/pull/922) imports them, so that change should declare them. - `openai` stays in the `dev` group, because only `src/client/` and `evals/` import it. ## Policy in `CLAUDE.md` Adds a `Dependencies` section: declare every third-party package you import directly (`dependencies` for `src/dbt_mcp` and `src/remote_mcp`, the `dev` group for tests, evals and scripts), never rely on a transitive one, declare a new import's package in the same change with the `uv.lock` version as the lower bound, and check with `deptry`. 🤖 Generated with AI assistance --------- Co-authored-by: AI Assistant <noreply@ai>