Skip to content

Commit 611d332

Browse files
dicksontsaiclaude
authored andcommitted
Add settings option to ClaudeCodeOptions (anthropics#100)
- Add `settings` field to `ClaudeCodeOptions` to expose the `--settings` CLI flag - Allow SDK users to specify custom settings configuration path - Added `settings: str | None = None` field to `ClaudeCodeOptions` dataclass - Added CLI argument conversion logic in `SubprocessCLITransport` to pass `--settings` flag to Claude Code CLI - [x] All existing tests pass - [x] Linting passes (`python -m ruff check`) - [x] Type checking passes (`python -m mypy src/`) 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent a517fab commit 611d332

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.0.18
4+
5+
- Add `ClaudeCodeOptions.settings` for `--settings`
6+
7+
## 0.0.17
8+
9+
- Remove dependency on asyncio for Trio compatibility
10+
311
## 0.0.16
412

513
- Introduce ClaudeSDKClient for bidirectional streaming conversation

src/claude_code_sdk/_internal/transport/subprocess_cli.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ def _build_command(self) -> list[str]:
128128
if self._options.resume:
129129
cmd.extend(["--resume", self._options.resume])
130130

131+
if self._options.settings:
132+
cmd.extend(["--settings", self._options.settings])
133+
131134
if self._options.mcp_servers:
132135
cmd.extend(
133136
["--mcp-config", json.dumps({"mcpServers": self._options.mcp_servers})]

src/claude_code_sdk/types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,5 @@ class ClaudeCodeOptions:
126126
disallowed_tools: list[str] = field(default_factory=list)
127127
model: str | None = None
128128
permission_prompt_tool_name: str | None = None
129-
cwd: str | Path | None = None
129+
cwd: str | Path | None = None
130+
settings: str | None = None

0 commit comments

Comments
 (0)