mirror of
https://github.com/anthropics/claude-code-sdk-python.git
synced 2025-12-23 09:19:52 +00:00
|
Some checks failed
Lint / lint (push) Has been cancelled
Test / test (macos-latest, 3.10) (push) Has been cancelled
Test / test (macos-latest, 3.11) (push) Has been cancelled
Test / test (macos-latest, 3.12) (push) Has been cancelled
Test / test (macos-latest, 3.13) (push) Has been cancelled
Test / test (ubuntu-latest, 3.10) (push) Has been cancelled
Test / test (ubuntu-latest, 3.11) (push) Has been cancelled
Test / test (ubuntu-latest, 3.12) (push) Has been cancelled
Test / test (ubuntu-latest, 3.13) (push) Has been cancelled
Test / test (windows-latest, 3.10) (push) Has been cancelled
Test / test (windows-latest, 3.11) (push) Has been cancelled
Test / test (windows-latest, 3.12) (push) Has been cancelled
Test / test (windows-latest, 3.13) (push) Has been cancelled
Test / test-examples (3.10) (push) Has been cancelled
Test / test-e2e (macos-latest, 3.10) (push) Has been cancelled
Test / test-e2e (macos-latest, 3.11) (push) Has been cancelled
Test / test-e2e (macos-latest, 3.12) (push) Has been cancelled
Test / test-e2e (macos-latest, 3.13) (push) Has been cancelled
Test / test-e2e (ubuntu-latest, 3.10) (push) Has been cancelled
Test / test-e2e (ubuntu-latest, 3.11) (push) Has been cancelled
Test / test-e2e (ubuntu-latest, 3.12) (push) Has been cancelled
Test / test-e2e (ubuntu-latest, 3.13) (push) Has been cancelled
Test / test-e2e (windows-latest, 3.10) (push) Has been cancelled
Test / test-e2e (windows-latest, 3.12) (push) Has been cancelled
Test / test-e2e (windows-latest, 3.13) (push) Has been cancelled
Test / test-examples (3.11) (push) Has been cancelled
Test / test-examples (3.12) (push) Has been cancelled
Test / test-examples (3.13) (push) Has been cancelled
Test / test-e2e (windows-latest, 3.11) (push) Has been cancelled
## Summary Adds support for passing custom Claude Code CLI paths through `ClaudeAgentOptions`, allowing organizations with non-standard installation locations to specify the CLI path explicitly. ## Motivation As noted in #214, organizations may install Claude Code CLI (or wrapped versions) at custom locations and prefer to provide those paths instead of relying on the SDK's default search logic. The transport layer already supported `cli_path`, but it was never exposed through the public API. ## Changes 1. **types.py**: Added `cli_path: str | Path | None = None` parameter to `ClaudeAgentOptions` dataclass 2. **_internal/client.py**: Pass `cli_path` from `configured_options.cli_path` to `SubprocessCLITransport` 3. **client.py**: Pass `cli_path` from `options.cli_path` to `SubprocessCLITransport` ## Implementation Details The `SubprocessCLITransport` constructor already accepted a `cli_path` parameter (line 40 of subprocess_cli.py), but it was never passed from the client layers. This PR completes the wiring by: - Adding the option to the public `ClaudeAgentOptions` interface - Extracting and passing it through both client implementations (`InternalClient.process_query` and `ClaudeSDKClient.connect`) ## Usage Example ```python from claude_agent_sdk import query, ClaudeAgentOptions # Specify custom CLI path options = ClaudeAgentOptions( cli_path="/custom/path/to/claude" ) result = await query("Hello!", options=options) ``` ## Testing - No new tests added as this is a straightforward parameter pass-through - Existing tests should continue to work (default behavior unchanged) - CI will validate the changes don't break existing functionality Fixes #214 --------- Co-authored-by: Ashwin Bhat <ashwin@anthropic.com> |
||
|---|---|---|
| .. | ||
| conftest.py | ||
| test_changelog.py | ||
| test_client.py | ||
| test_errors.py | ||
| test_integration.py | ||
| test_message_parser.py | ||
| test_sdk_mcp_integration.py | ||
| test_streaming_client.py | ||
| test_subprocess_buffering.py | ||
| test_tool_callbacks.py | ||
| test_transport.py | ||
| test_types.py | ||