claude-code-sdk-python/src/claude_code_sdk
Dickson Tsai f550c21a7e
Some checks are pending
Lint / lint (push) Waiting to run
Test / test (3.10) (push) Waiting to run
Test / test (3.11) (push) Waiting to run
Test / test-e2e (3.13) (push) Blocked by required conditions
Test / test-examples (3.11) (push) Blocked by required conditions
Test / test-examples (3.12) (push) Blocked by required conditions
Test / test-examples (3.13) (push) Blocked by required conditions
Test / test (3.12) (push) Waiting to run
Test / test (3.13) (push) Waiting to run
Test / test-e2e (3.10) (push) Blocked by required conditions
Test / test-e2e (3.11) (push) Blocked by required conditions
Test / test-e2e (3.12) (push) Blocked by required conditions
Test / test-examples (3.10) (push) Blocked by required conditions
Add support for streaming partial messages via include_partial_messages option (#168)
## Summary
- Adds support for streaming partial messages through the
`include_partial_messages` option
- Introduces `StreamEvent` message type to handle Anthropic API stream
events
- Enables real-time streaming of Claude's responses for building
interactive UIs

## Changes
- Added `StreamEvent` dataclass with proper structure matching
TypeScript SDK (uuid, session_id, event, parent_tool_use_id)
- Added `include_partial_messages` boolean option to `ClaudeCodeOptions`
- Updated message parser to handle `stream_event` message type
- Updated subprocess CLI transport to pass `--include-partial-messages`
flag when enabled
- Added example demonstrating partial message streaming usage

## Test plan
- [x] Verified CLI flag is passed correctly when
`include_partial_messages=True`
- [x] Confirmed `StreamEvent` structure matches TypeScript SDK
implementation
- [x] Added test for user parameter in transport
- [x] Example runs successfully with streaming events

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-17 16:32:21 -07:00
..
_internal Add support for streaming partial messages via include_partial_messages option (#168) 2025-09-17 16:32:21 -07:00
__init__.py chore: bump version to 0.0.22 (#163) 2025-09-12 08:27:47 -07:00
_errors.py Remove hardcoded timeout for control messages to match Typescript SDK 2025-07-19 20:43:07 -07:00
client.py Update changelog, readme, and examples for custom tools and hooks (#162) 2025-09-12 08:14:34 -07:00
py.typed Initial Python SDK import 2025-06-12 00:16:19 -07:00
query.py feat: enable custom transports (#91) 2025-08-19 13:28:42 -07:00
types.py Add support for streaming partial messages via include_partial_messages option (#168) 2025-09-17 16:32:21 -07:00