Repository navigation
ci(deps): deptry gate for unused, missing and misplaced dependencies - #109
Conversation
deptry runs in the typecheck job, which already installs the lock, so import names map to packages through installed metadata. Config in [tool.deptry]: the dev extra is a dev group, scripts/docs is excluded (its deps are requirements-docs.txt), langchain-community is ignored for DEP002 (declared only to cap what ragas resolves). Findings fixed: - beautifulsoup4: never imported; removed (drops soupsieve from the lock). - anthropic: its last direct import was removed long ago; still installed through langchain-anthropic, so only the declaration goes. - langchain-openai, langchain-core: imported by eval ragas but only arriving through ragas; declared >=1.0,<2. The lock is regenerated with its header command; no pinned version moves. Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #109 +/- ##
=======================================
Coverage 90.24% 90.24%
=======================================
Files 206 206
Lines 24289 24289
Branches 3906 3906
=======================================
Hits 21920 21920
Misses 1703 1703
Partials 666 666 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟢 Approval recommended
The dependency declarations, lockfile, CI gate, and documentation are consistent, with no blocking issues identified.
No open issues 🎉
What changed in this PR
Adds dependency hygiene checks to CI and aligns dokimi’s declared dependencies with its imports.
Changes:
- Runs deptry in the existing typecheck job with targeted exclusions.
- Removes unused dependency declarations, adds direct LangChain dependencies, and updates the lockfile.
- Documents the new gate and installation changes.
| File | Description |
|---|---|
dokimi/requirements.txt |
Aligns runtime dependencies with imports. |
dokimi/requirements.lock.txt |
Removes unused packages and updates dependency origins. |
dokimi/pyproject.toml |
Updates package dependencies and configures deptry. |
dokimi/CONTRIBUTING.md |
Documents the dependency gate. |
dokimi/changelog.d/20261018_120000_napetrov_ci-deptry.md |
Explains installation changes. |
.github/workflows/ci.yml |
Adds deptry to the typecheck job. |
Review effort: Balanced
antonwolfy
left a comment
There was a problem hiding this comment.
LGTM. The gate runs from the right directory, the config options exist in deptry 0.25.1, and the declarations, requirements.txt and the lock agree. Three nits on text this PR leaves stale, all outside the diff.
What I ran, on a Linux review host at 820801d:
make ci-local: 20 passed, 0 failed, 4 skipped.typecheck / deptryprintsSuccess! No dependency issues found.; pytest 5179 passed, 1 skipped;package-smokepasses.- A search for imports of
bs4andanthropicindokimi/,cli.py,scripts/andtests/: there are none, so both removals match the code.
Nits (outside this diff):
docs/quickstart.md:242still sayslangchain-openaicomes with ragas. This PR makes it a direct dependency (pyproject.toml,requirements.txt). Suggestion: say bothlangchain-openaiandlangchain-anthropicare direct dependencies.- The
ci_local.pydocstring (lines 21-24) saysstaticis the only job whose steps after the install all run underif: ${{ !cancelled() }}. The two deptry steps intypecheck(ci.yml:152-160) now use the same condition. Suggestion: nametypecheckas well. - The
TRACKED_DEPScomment indokimi/runner/manifest.py:22says "Direct dependencies" and listsanthropic. It is now installed only throughlangchain-anthropic. The manifest still records its version, which is fine; only the comment is off.
Checked, no issues
- Working directory: the job's
defaults.run.working-directory: dokimiputsdeptry .next topyproject.toml, after the lock install. - Config:
optional_dependencies_dev_groupsandper_rule_ignoresare real options; thedevextra exists; thelangchain-communityDEP002 ignore is needed because nothing imports it. - Bounds:
langchain-core>=1.0,<2andlangchain-openai>=1.0,<2hold with ragas 0.3.9 andlangchain-anthropic; the lock pins 1.6.7 for both, as before. - Renovate: the
pip install deptry==0.25.1line matches the repo's custom regex manager. - Changelog fragment: same format as the others in
changelog.d.
Summary
A deptry gate in the
typecheckjob, plus the fixes for what it found onmain. Each finding, its verdict and the action taken:pytest,pytest-*,diff-cover,ruff,mypy,types-*,scrivunused (13)devextra is toolingoptional_dependencies_dev_groups = ["dev"]mkdocs,mkdocs_gen_files,markdown_itinscripts/docs/requirements-docs.txtextend_exclude = ["scripts/docs"]langchain-communityunused<0.4.2)per_rule_ignoresDEP002, with the reasonbeautifulsoup4unusedbs4in this historysoupsievefrom the lock)anthropicunusedlangchain-anthropicstill pulls it inlangchain_openai,langchain_core(eval/ragas_eval.py)ragas>=1.0,<2No DEP001 (missing), DEP004 (dev dep imported by the package) or DEP005 (stdlib declared) on
main.tests/stays out of the scan (deptry's default exclude): test deps live inrequirements-test.txtand thedevextra.Why
typecheckand notstatic: deptry maps import names to packages (PyYAML→yaml,PyGithub→github) and tells transitive (DEP003) from missing (DEP001) through the installed environment.staticinstalls no lock, and the alternative there is a hand-keptpackage_module_name_mapthat goes stale with every new dependency.scripts/ci_local.pyreads the new step and the install line fromci.yml, somake devinstalls deptry andmake ci-localruns it with no change to the script.No pre-commit hook: pre-commit runs deptry in an isolated env without the lock, where every third-party import reads as DEP001. The
typecheckjob andmake ci-localcover it.requirements-test.txtrepeatshttpx,numpy,scipy,litellm,PyYAMLandjsonschema. All six are runtime: the package imports them and[project.dependencies]declares them. The repeats are harmless, so they stay.Evidence
main, CI's env: lock + deptry, dev group configured,scripts/docsexcluded):Scanning 221 files... Success! No dependency issues found., both in a fresh 3.13 venv with only the lock and deptry (what the CI step sees) and in themake devvenv.import pytest,import bs4andimport tenacitygivesDEP004 'pytest',DEP001 'bs4'andDEP003 'tenacity'.beautifulsoup4andsoupsievego, and the# vialines ofanthropic,langchain-coreandlangchain-openaichange.requirements-docs.lock.txthas neither package, so it is unchanged.make ci-local: 0 failed, 20 passed, 4 skipped (docker, test-latest, deploy, semgrep). That includestypecheck / deptry, the fullpytest, andpackage-smoke, whose fresh-resolve wheel install no longer pullsbeautifulsoup4and still pullsanthropic(throughlangchain-anthropic).zizmor --offline --min-severity medium .github/workflows: no findings.Merge Danger
Door: two-way. Reverting puts the two declarations back and drops one CI step. No persisted format, schema or score changes.
Blast Radius: install-set
pip install dokimino longer installsbeautifulsoup4/soupsieve. Code outside dokimi that importedbs4from the same env has to install it itself (changelog fragment says so).anthropicstays installed throughlangchain-anthropic(>=0.120,<2), but dokimi no longer sets the~=1.12floor itself.langchain-openaiandlangchain-coreare now direct, bounded<2. Today they resolve to the same pins as before. A future major of either now needs a range bump in its own Renovate PR, where before it would have arrived silently through ragas.mypycheck (the job name is unchanged, so branch protection is unaffected). A PR that adds an import without declaring it, or drops the last import of a dependency, now fails that check.requirements*.txtor the lock.ci.ymlhunks of ci: add a Windows smoke test job #89, ci: no-growth ratchet for file length and function complexity #93 and docs, tests: user-journey catalog (J1–J15) and criterion evidence trace #102 are in other jobs. TheCONTRIBUTING.mdbullets of test(arch): enforce the import contract: layers, no new cycles, wrapped clients #91 and ci: no-growth ratchet for file length and function complexity #93 sit in the same list, about 25 lines above this one.Checklist
pytestpasses (no code change; the full suite passes inmake ci-local)ruff,mypy, and schema checks passCONTRIBUTING.mdlistsdeptry .and what it holds a PR to.github/.licenserc.yaml): the changelog fragment is exempt🤖 Generated with Claude Code