Repository navigation
build(deps): move ragas and langchain to a dokimi[ragas] extra - #126
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The focused dependency split, error handling, documentation, and regression coverage are consistent, with no blocking issues identified.
No open issues 🎉
What changed in this PR
Moves RAGAS and LangChain into an optional extra, keeping core installs smaller and supporting conda-forge packaging.
Changes:
- Adds
dokimi[ragas], included automatically by thedevextra. - Makes missing RAGAS dependencies produce a nonzero exit with installation guidance.
- Adds regression coverage and updates documentation.
| File | Description |
|---|---|
dokimi/tests/test_ragas_runtime.py |
Tests missing-extra failure and installation guidance. |
dokimi/pyproject.toml |
Moves five dependencies into the ragas extra. |
dokimi/dokimi/eval/ragas_eval.py |
Updates dependency installation hints. |
dokimi/dokimi/commands/evaluate.py |
Exits with an error on import failure. |
dokimi/docs/quickstart.md |
Documents the optional RAGAS installation. |
dokimi/CONTRIBUTING.md |
Lists the extra and its inclusion in dev. |
dokimi/changelog.d/20261019_120000_vchamarthi_ragas-extra.md |
Records installation and exit-behavior changes. |
Review effort: Balanced
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #126 +/- ##
==========================================
+ Coverage 90.27% 90.28% +0.01%
==========================================
Files 206 206
Lines 24351 24356 +5
Branches 3921 3923 +2
==========================================
+ Hits 21982 21991 +9
+ Misses 1703 1698 -5
- Partials 666 667 +1
🚀 New features to boost your workflow:
|
Why an extra
|
pip install dokimi no longer installs ragas, langchain-community, langchain-anthropic, langchain-openai or langchain-core. eval ragas and answers generate --ragas need the extra and exit with the install command when it is missing. The dev extra includes it. Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
60eab32 to
aa7a784
Compare
antonwolfy
left a comment
There was a problem hiding this comment.
LGTM. The split is clean: the caps and their reasons moved intact, dev still pulls the extra in, and the new test fails without the except ImportError clause. A few nits inline.
What I ran, on a Linux review host at aa7a784:
make ci-local: 20 passed, 0 failed, 4 skipped (docker/network/PR-condition jobs); 5222 tests passed, 1 skipped; changed-line coverage 100% (2 lines).deptry,mypy, the wheel smoke test andmkdocs buildpass.- Reproductions with the RAGAS transport mocked. The new test passes at the head and fails with
DID NOT RAISE SystemExitwhen theevaluate.pychange is reverted.
Checked, no issues
- Exit path:
_run_ragas_evalhas two callers,cmd_eval_ragasandanswers generate. Neither catchesSystemExit, andEmptyQuestionErroris still handled first (exit 2). - Answers saved first:
answers.pywrites the answers before it calls_run_ragas_eval, as the description says. - Imports: no module under
dokimi/importsragasorlangchain_*at module level, so a plain install imports everything. - Packaging: CI installs from the lock, which still has the five packages, so the test, typecheck and deptry jobs keep RAGAS. The changelog fragment matches the scriv format.
One more nit outside the diff: the comment in [tool.deptry.per_rule_ignores] (pyproject.toml:133) still says "see the comment in [project]", but the langchain-community cap comment now sits under the ragas extra.
- eval ragas and answers generate --ragas exit before any model call when ragas is not installed - import-failure hints say when the extra is the fix - README lists the ragas extra; deptry comment points at it Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
|
Deptry comment ( |
Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
* release: 0.1.0 - CHANGELOG.md: 0.1.0 section, fragments collected - README and quickstart: pip install dokimi - releasing.md: python_min for the conda-forge recipe Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com> * release: collect the #126 and #127 fragments into 0.1.0 Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com> --------- Signed-off-by: vchamarthi <venkata.sai.gireesh.chamarthi@intel.com>
Summary
A plain
pip install dokiminow gets only what most commands need. RAGAS and the LangChain packages it uses become an opt-in extra, because onlyeval ragasandanswers generate --ragastouch them.Why now: this is needed for the conda-forge package (Part of #123). With these packages in the core list, conda-forge cannot build an environment that satisfies all of them. It has no
langchain-community0.4.0 or 0.4.1, so the<0.4.2cap pushes the solver to 0.3.x, which needsanthropic<1. Before #109 removed the directanthropic~=1.12pin, the solve failed outright. After #109 it succeeds, but it lands on older releases than pip does (ragas 0.3.1, langchain-community 0.3.31) that our CI never tests. With the extra, the core list solves on conda-forge with no LangChain at all, and pip and conda users get the same core.Changes
pyproject.toml: the five packages move to a newragasextra, with their version caps and reasons unchanged.devpulls it in, so contributors and the test suite still get them.eval ragasandanswers generate --ragaswithout the extra stop with an error. The error names the missing module and sayspip install 'dokimi[ragas]'.eval/ragas_eval.pypoint at the extra instead of the lock file.requirements.txtand the lock are unchanged. CI andmake devkeep installing RAGAS.What breaks
pip install dokimiand runseval ragasoranswers generate --ragasmust now installdokimi[ragas].answers generate --ragas, the answers are saved before the exit.ragasorlangchain_*from dokimi's environment without declaring them must install them itself.pip install -e ".[dev]"or from the lock.Evidence
main's core dependencies (before ci(deps): deptry gate for unused, missing and misplaced dependencies #109) fails withLibMambaUnsatisfiableErroronlangchain-community <0.4.2againstanthropic >=1.12,<2. After ci(deps): deptry gate for unused, missing and misplaced dependencies #109, the solve succeeds but picks ragas 0.3.1 and langchain-community 0.3.31.After: the same solve of this branch's core dependencies succeeds with no LangChain or ragas packages.
scripts/smoke_installed.py --expect-version 0.1.0: every check ok.dokimiimports with ragas absent.dokimi eval ragas --answers a.jsonexits 1 with... could not import ragas: No module named 'ragas'. Install the ragas extra: pip install 'dokimi[ragas]'.dokimi[ragas]resolves (langchain-community 0.4.1, langchain-core 1.6.12).test_ragas_without_the_extra_exits_with_the_install_command: ragas blocked insys.modules,_run_ragas_evalraisesSystemExitwith the install command and writes no_ragas.json.ruff check,mypy,deptryandconfig_checkpass.Merge Danger
Door: two-way. Moving the packages back into
dependenciesreverts it, and nothing is published by merging.Blast Radius: install
Only plain
pip install dokimiusers of the two RAGAS commands are affected. No release has shipped yet, so if this lands before 0.1.0, no published version ever had RAGAS in its core dependencies.Checklist
pytestpassesruff,mypy, and schema checks pass.github/.licenserc.yaml)