RepoPilot

anthropics / anthropic-sdk-python

Search anthropics/anthropic-sdk-python

GitHub

Code

How anthropics/anthropic-sdk-python is laid out, and where to start for common changes.

C
Architecture grade
score 64/100
8+
Import cycles
lower is better
400
Files mapped
1,890 imports between them
93%
Layering
of imports point one way

From the map of which files import which, built when the code was last read in full. It shows what depends on what, not a reading order.

Module map

Shade by
Entry points and orchestratorsShared coreFoundationStandalone_utils15 files · 4 commits_types1 file · 5 commits_models1 file · 6 commits_compat1 file · 1 commit_base_client1 file · 14 commits_exceptions1 file · 5 commits_constants1 file · 6 commits_response1 file · 3 commits_streaming1 file · 6 commitslib93 files · 66 commits__init__1 file · 5 commits_client1 file · 15 commits_files1 file · 3 commits_middleware1 file · 0 commits_request1 file · 2 commits_tracing1 file · 2 commits_version1 file · 31 commitstypes2137 files · 100+ commitsresources133 files · 95 commits_decoders1 file · 2 commits_qs1 file · 2 commits_resource1 file · 1 commitpagination1 file · not checked_data4 files · 2 commits_vendor4 files · 1 commit

25 modules, 116 links. A link means one module imports another; thicker lines mean more imports. Links come from 400 of 2,442 source files, so the real counts are higher. Select a module to trace it: blue lines go to what it uses, orange lines come from what uses it.

_utils151434Shared core
_types11325Shared core
_models11246Shared core
_compat1821Shared core
_base_client171514Orchestrator
_exceptions1715Shared core
_constants1606Foundation
_response1693Orchestrator
_streaming1666Shared core
lib9341266Orchestrator
__init__14125Orchestrator
_client141415Orchestrator
_files1323Shared core
_middleware1320Shared core
_request1342Orchestrator
_tracing1352Orchestrator
_version13031Foundation
types213721100+Shared core
resources13321695Orchestrator
_decoders1222Shared core
_qs1222Shared core
_resource1111Shared core
pagination111–Shared core
_data4002Standalone
_vendor4001Standalone

Where to start reading

  1. Repository root
  2. Repository root
  3. Likely public API
  4. Likely public API
  5. Suggested starting pointAI
  6. Suggested starting pointAI
  7. Suggested starting pointAI
  8. Suggested starting pointAI

Find files for a task

AI

Add a new cloud platform backend (e.g., Azure Batch)

  • Add credential chain provider for the platform

Add a new helper utility (e.g., structured output validator)

  • Export from src/anthropic/lib/__init__.py to make public

Extend tracing instrumentation (e.g., add custom span attributes)

  • Add attribute definitions to _attributes.py
  • Integrate into relevant span creation sites (_api_call.py, _streaming.py)
  • Update tracing config if new settings needed

Add middleware for custom request/response handling

  • Implement hooks that patch _base_client._middleware list
  • Export factory function from src/anthropic/lib/middleware/__init__.py

Change the public API

Add or update tests

Change build or automation

RepoPilot lists up to 500 files, so a file missing here may still exist.

  • Files marked “likely” are guessed from their names.

Code quality and hotspots

Largest source files

  • Branch points32 per file on average
  • Code issues0 errors, 43 warnings
  • Largest file4,232 lines
  • Hotspot load10 high-risk files

Static checks on the 15 largest source files.

Tests, CI and tooling

  • CIGitHub Actions3 workflows
  • Tests270 test filesPytest · 0.11 test files per source file (file count, not coverage)
  • Dependency updatesNo config detected

Test folders: tests/api_resources/beta/organization/analytics · tests/api_resources/beta/organization/plugins · tests/api_resources/beta/memory_stores

Hotspots

Files that change often and branch heavily, highest first. Branch points count if, loop, case, catch, ternary, && and || in the file.