chore: drop anthropic dependency — SDK migration complete#38
Merged
joshbouncesecurity merged 1 commit intomasterfrom Apr 19, 2026
Merged
chore: drop anthropic dependency — SDK migration complete#38joshbouncesecurity merged 1 commit intomasterfrom
joshbouncesecurity merged 1 commit intomasterfrom
Conversation
Final step of the SDK migration tracked in issue #35. Removes "anthropic>=0.40.0" from pyproject.toml now that no Python code under libs/openant-core/ still imports it. Cleanup alongside the dep drop: - `utilities/context_enhancer.py`: remove the now-orphaned `import anthropic`. PR #34 took it out of `_build_error_info`; PR #36 removed `shared_client`. The import line was kept alive across both as a staging measure. - `openant/cli.py` (cmd_report_data): replace the last `anthropic.Anthropic()` instantiation — used for the HTML report's remediation-guidance LLM call — with `AnthropicClient(model=MODEL_AUXILIARY).analyze_sync(...)`. Usage tracking is now automatic via the global TokenTracker; cost display pulls from `client.get_last_call()`. Neither PR #36 nor #37 touched this site because it was outside their scope; the dep-drift test (PR #30) surfaced it when pyproject.toml's dependency list shrank. - `utilities/rate_limiter.py`: update the module docstring's example. The pre-migration example showed `except anthropic.RateLimitError as e: retry_after = e.response.headers.get(...)`. That code path no longer exists — rate-limit detection is centralised in `llm_client._run_query`, which raises `utilities.sdk_errors.RateLimitError` after notifying the global limiter. Example updated to match. Verification: - `grep -rn '^import anthropic\|^from anthropic' libs/openant-core/` returns zero hits. - `grep -rn 'anthropic\.' libs/openant-core/` returns only a historical docstring reference in `sdk_errors.py`. - `tests/test_declared_dependencies.py` passes — the regression guard from PR #30 now enforces that no undeclared imports exist with anthropic gone. - `tests/test_sdk_errors.py` (12) + `tests/test_sdk_error_surfacing.py` (9) all pass. - `import openant, core, utilities, parsers, prompts, context, report` all succeed. End state: zero `anthropic` Python dep, all LLM traffic routes through the Claude Agent SDK via `utilities.llm_client`. Step 8 (end-to-end verification with a live API key) is the only remaining non-user-action item in the plan. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Final step of the SDK migration tracked in #35. With all four file ports merged, nothing in
libs/openant-core/still importsanthropic, so the dep can come out ofpyproject.toml.Changes
libs/openant-core/pyproject.toml— removedanthropic>=0.40.0.libs/openant-core/utilities/context_enhancer.py— removed the orphanedimport anthropicline. PR refactor: port context_enhancer error classifier to sdk_errors #34 took it out of_build_error_info; PR refactor: port agentic_enhancer to Claude Agent SDK native tools #36 removedshared_client. The import was kept alive across both as a staging measure.libs/openant-core/openant/cli.py(cmd_report_data) — replaced the lastanthropic.Anthropic()instantiation (for the HTML report's remediation-guidance LLM call) withAnthropicClient(model=MODEL_AUXILIARY).analyze_sync(...). Usage tracking is now automatic via the globalTokenTracker; cost display pulls fromclient.get_last_call(). Neither PR refactor: port agentic_enhancer to Claude Agent SDK native tools #36 nor refactor: port finding_verifier.py to Claude Agent SDK native tools #37 touched this site — it was outside their scope — and the dep-drift test surfaced it whenpyproject.toml's dependency list shrank.libs/openant-core/utilities/rate_limiter.py— updated the module docstring example. The pre-migration example referencedanthropic.RateLimitError; that code path no longer exists. Rate-limit detection is centralised inllm_client._run_query, which raisesutilities.sdk_errors.RateLimitErrorafter notifying the limiter.Verification
grep -rn '^import anthropic\|^from anthropic' libs/openant-core/returns zero hits.grep -rn 'anthropic\.' libs/openant-core/returns only a historical docstring reference insdk_errors.py.tests/test_declared_dependencies.py(regression guard from fix: declare anthropic and tree-sitter-zig, guard against dep drift #30) passes.tests/test_sdk_errors.py(12) +tests/test_sdk_error_surfacing.py(9) pass.import openant, core, utilities, parsers, prompts, context, report.What this closes
End state: zero
anthropicPython dep; all LLM traffic routes through the Claude Agent SDK viautilities.llm_client. Steps 1–7 of #35 are done. Step 8 (end-to-end verification with a live API key, ~$30-50 spend) and Step 9 (upstream PR to `knostic/OpenAnt`) remain user actions.Closes per-file ports from #31, #32, #33, #34, #36, #37. Final dep cleanup here.
🤖 Generated with Claude Code