Skip to content

chore: drop anthropic dependency — SDK migration complete#38

Merged
joshbouncesecurity merged 1 commit intomasterfrom
chore/drop-anthropic-dep
Apr 19, 2026
Merged

chore: drop anthropic dependency — SDK migration complete#38
joshbouncesecurity merged 1 commit intomasterfrom
chore/drop-anthropic-dep

Conversation

@joshbouncesecurity
Copy link
Copy Markdown
Owner

Summary

Final step of the SDK migration tracked in #35. With all four file ports merged, nothing in libs/openant-core/ still imports anthropic, so the dep can come out of pyproject.toml.

Changes

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 (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.
  • All packaged modules import cleanly: import openant, core, utilities, parsers, prompts, context, report.

What this closes

End state: zero anthropic Python dep; all LLM traffic routes through the Claude Agent SDK via utilities.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

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>
@joshbouncesecurity joshbouncesecurity merged commit 67376c9 into master Apr 19, 2026
7 checks passed
@joshbouncesecurity joshbouncesecurity deleted the chore/drop-anthropic-dep branch April 19, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant