claude-code-analytics 0.1.0__cp311-abi3-macosx_11_0_arm64.whl → 0.1.1__cp311-abi3-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {claude_sdk → claude_code_analytics}/__init__.py +1 -1
- {claude_sdk → claude_code_analytics}/_core.abi3.so +0 -0
- {claude_code_analytics-0.1.0.dist-info → claude_code_analytics-0.1.1.dist-info}/METADATA +37 -37
- claude_code_analytics-0.1.1.dist-info/RECORD +6 -0
- claude_code_analytics-0.1.0.dist-info/RECORD +0 -6
- {claude_code_analytics-0.1.0.dist-info → claude_code_analytics-0.1.1.dist-info}/WHEEL +0 -0
- {claude_code_analytics-0.1.0.dist-info → claude_code_analytics-0.1.1.dist-info}/licenses/LICENSE +0 -0
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: claude-code-analytics
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.1
|
4
4
|
Classifier: Development Status :: 4 - Beta
|
5
5
|
Classifier: Intended Audience :: Developers
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
@@ -73,10 +73,10 @@ uv build
|
|
73
73
|
## Quick Start
|
74
74
|
|
75
75
|
```python
|
76
|
-
import
|
76
|
+
import claude_code_analytics
|
77
77
|
|
78
78
|
# Load a session from a JSONL file
|
79
|
-
session =
|
79
|
+
session = claude_code_analytics.load("~/.claude/projects/myproject/session_20240101_120000.jsonl")
|
80
80
|
|
81
81
|
# Basic session info
|
82
82
|
print(f"Session ID: {session.session_id}")
|
@@ -89,7 +89,7 @@ for message in session:
|
|
89
89
|
print(f"{message.role}: {message.text[:100]}...")
|
90
90
|
|
91
91
|
# Find all your sessions
|
92
|
-
sessions =
|
92
|
+
sessions = claude_code_analytics.find_sessions()
|
93
93
|
for session_path in sessions:
|
94
94
|
print(f"Found session: {session_path}")
|
95
95
|
```
|
@@ -139,7 +139,7 @@ The SDK automatically reconstructs the conversation structure, handling:
|
|
139
139
|
Load a Claude Code session from a JSONL file.
|
140
140
|
|
141
141
|
```python
|
142
|
-
session =
|
142
|
+
session = claude_code_analytics.load("path/to/session.jsonl")
|
143
143
|
```
|
144
144
|
|
145
145
|
**Parameters:**
|
@@ -158,13 +158,13 @@ Discover Claude Code session files.
|
|
158
158
|
|
159
159
|
```python
|
160
160
|
# Find all sessions
|
161
|
-
all_sessions =
|
161
|
+
all_sessions = claude_code_analytics.find_sessions()
|
162
162
|
|
163
163
|
# Find sessions in a specific project
|
164
|
-
project_sessions =
|
164
|
+
project_sessions = claude_code_analytics.find_sessions(project="myproject")
|
165
165
|
|
166
166
|
# Search in a custom location
|
167
|
-
custom_sessions =
|
167
|
+
custom_sessions = claude_code_analytics.find_sessions(base_path="/custom/path")
|
168
168
|
```
|
169
169
|
|
170
170
|
**Parameters:**
|
@@ -178,7 +178,7 @@ custom_sessions = claude_sdk.find_sessions(base_path="/custom/path")
|
|
178
178
|
Find all Claude Code projects.
|
179
179
|
|
180
180
|
```python
|
181
|
-
projects =
|
181
|
+
projects = claude_code_analytics.find_projects()
|
182
182
|
for project_path in projects:
|
183
183
|
print(f"Project: {project_path.name}")
|
184
184
|
```
|
@@ -194,10 +194,10 @@ Load an entire project with all its sessions.
|
|
194
194
|
|
195
195
|
```python
|
196
196
|
# Load by project name
|
197
|
-
project =
|
197
|
+
project = claude_code_analytics.load_project("myproject")
|
198
198
|
|
199
199
|
# Load by path
|
200
|
-
project =
|
200
|
+
project = claude_code_analytics.load_project("/path/to/project")
|
201
201
|
|
202
202
|
print(f"Total sessions: {len(project.sessions)}")
|
203
203
|
print(f"Total cost: ${project.total_cost:.2f}")
|
@@ -303,9 +303,9 @@ text_blocks = message.get_text_blocks()
|
|
303
303
|
|
304
304
|
# Get all content blocks with proper typing
|
305
305
|
for block in message.get_content_blocks():
|
306
|
-
if isinstance(block,
|
306
|
+
if isinstance(block, claude_code_analytics.TextBlock):
|
307
307
|
print(f"Text: {block.text}")
|
308
|
-
elif isinstance(block,
|
308
|
+
elif isinstance(block, claude_code_analytics.ToolUseBlock):
|
309
309
|
print(f"Tool: {block.name}")
|
310
310
|
```
|
311
311
|
|
@@ -325,7 +325,7 @@ Container for multiple sessions in a project.
|
|
325
325
|
| `total_duration` | `Optional[float]` | Total time in seconds |
|
326
326
|
|
327
327
|
```python
|
328
|
-
project =
|
328
|
+
project = claude_code_analytics.load_project("myproject")
|
329
329
|
|
330
330
|
# Analyze tool usage patterns
|
331
331
|
for tool, count in project.tool_usage_count.items():
|
@@ -396,17 +396,17 @@ for root in tree.root_messages:
|
|
396
396
|
|
397
397
|
```python
|
398
398
|
# Exception hierarchy
|
399
|
-
|
400
|
-
├──
|
401
|
-
├──
|
402
|
-
└──
|
399
|
+
claude_code_analytics.ClaudeSDKError # Base exception
|
400
|
+
├── claude_code_analytics.ParseError # JSONL parsing failed
|
401
|
+
├── claude_code_analytics.ValidationError # Invalid data
|
402
|
+
└── claude_code_analytics.SessionError # Session-specific issues
|
403
403
|
|
404
404
|
# Example handling
|
405
405
|
try:
|
406
|
-
session =
|
407
|
-
except
|
406
|
+
session = claude_code_analytics.load("session.jsonl")
|
407
|
+
except claude_code_analytics.ParseError as e:
|
408
408
|
print(f"Failed to parse: {e}")
|
409
|
-
except
|
409
|
+
except claude_code_analytics.ClaudeSDKError as e:
|
410
410
|
print(f"SDK error: {e}")
|
411
411
|
```
|
412
412
|
|
@@ -415,10 +415,10 @@ except claude_sdk.ClaudeSDKError as e:
|
|
415
415
|
### Basic Session Analysis
|
416
416
|
|
417
417
|
```python
|
418
|
-
import
|
418
|
+
import claude_code_analytics
|
419
419
|
|
420
420
|
# Load session
|
421
|
-
session =
|
421
|
+
session = claude_code_analytics.load("session.jsonl")
|
422
422
|
|
423
423
|
# Print summary
|
424
424
|
print(f"Session: {session.session_id}")
|
@@ -435,10 +435,10 @@ print(f"Total tokens: {total_tokens:,}")
|
|
435
435
|
### Tool Usage Patterns
|
436
436
|
|
437
437
|
```python
|
438
|
-
import
|
438
|
+
import claude_code_analytics
|
439
439
|
from collections import defaultdict
|
440
440
|
|
441
|
-
session =
|
441
|
+
session = claude_code_analytics.load("session.jsonl")
|
442
442
|
|
443
443
|
# Count tool usage by message
|
444
444
|
tool_messages = defaultdict(list)
|
@@ -460,16 +460,16 @@ for tool, messages in sorted(tool_messages.items()):
|
|
460
460
|
### Cost Analysis Across Projects
|
461
461
|
|
462
462
|
```python
|
463
|
-
import
|
463
|
+
import claude_code_analytics
|
464
464
|
|
465
465
|
# Find all projects
|
466
|
-
projects =
|
466
|
+
projects = claude_code_analytics.find_projects()
|
467
467
|
|
468
468
|
# Analyze costs
|
469
469
|
project_costs = []
|
470
470
|
for project_path in projects:
|
471
471
|
try:
|
472
|
-
project =
|
472
|
+
project = claude_code_analytics.load_project(project_path)
|
473
473
|
project_costs.append((project.name, project.total_cost, len(project.sessions)))
|
474
474
|
except Exception as e:
|
475
475
|
print(f"Failed to load {project_path}: {e}")
|
@@ -488,9 +488,9 @@ for name, cost, session_count in project_costs:
|
|
488
488
|
### Conversation Flow Analysis
|
489
489
|
|
490
490
|
```python
|
491
|
-
import
|
491
|
+
import claude_code_analytics
|
492
492
|
|
493
|
-
session =
|
493
|
+
session = claude_code_analytics.load("session.jsonl")
|
494
494
|
tree = session.conversation_tree
|
495
495
|
|
496
496
|
# Find branching points
|
@@ -517,11 +517,11 @@ if sidechain_messages:
|
|
517
517
|
### Exporting Session Data
|
518
518
|
|
519
519
|
```python
|
520
|
-
import
|
520
|
+
import claude_code_analytics
|
521
521
|
import json
|
522
522
|
import csv
|
523
523
|
|
524
|
-
session =
|
524
|
+
session = claude_code_analytics.load("session.jsonl")
|
525
525
|
|
526
526
|
# Export to JSON
|
527
527
|
export_data = {
|
@@ -578,7 +578,7 @@ The Claude SDK is built with Rust for exceptional performance:
|
|
578
578
|
|
579
579
|
### Common Issues
|
580
580
|
|
581
|
-
#### ImportError: No module named '
|
581
|
+
#### ImportError: No module named 'claude_code_analytics'
|
582
582
|
|
583
583
|
**Solution**: Ensure you've installed the package:
|
584
584
|
```bash
|
@@ -594,7 +594,7 @@ uv build
|
|
594
594
|
import os
|
595
595
|
path = os.path.expanduser("~/.claude/projects/myproject/session.jsonl")
|
596
596
|
if os.path.exists(path):
|
597
|
-
session =
|
597
|
+
session = claude_code_analytics.load(path)
|
598
598
|
```
|
599
599
|
|
600
600
|
#### ParseError: Invalid JSONL format
|
@@ -614,8 +614,8 @@ python -m json.tool session.jsonl
|
|
614
614
|
```python
|
615
615
|
# Instead of loading all sessions at once
|
616
616
|
sessions = []
|
617
|
-
for path in
|
618
|
-
session =
|
617
|
+
for path in claude_code_analytics.find_sessions(project="large_project"):
|
618
|
+
session = claude_code_analytics.load(path)
|
619
619
|
# Process session
|
620
620
|
del session # Free memory
|
621
621
|
```
|
@@ -629,7 +629,7 @@ import logging
|
|
629
629
|
logging.basicConfig(level=logging.DEBUG)
|
630
630
|
|
631
631
|
# Now SDK operations will print debug info
|
632
|
-
session =
|
632
|
+
session = claude_code_analytics.load("session.jsonl")
|
633
633
|
```
|
634
634
|
|
635
635
|
## Development
|
@@ -0,0 +1,6 @@
|
|
1
|
+
claude_code_analytics-0.1.1.dist-info/METADATA,sha256=2FNGHhFiJQkzrlP3vd6hL0zFEBA4MrhxAesBB79DnZA,18926
|
2
|
+
claude_code_analytics-0.1.1.dist-info/WHEEL,sha256=l9jBLnRRly5LD7TW-oNpYWU1DRojZivxrl_VDrtEJF4,103
|
3
|
+
claude_code_analytics-0.1.1.dist-info/licenses/LICENSE,sha256=VOy5LfrbCUMxLGMwcxF3KTEyMO8xzEBm713UCA6sQng,1069
|
4
|
+
claude_code_analytics/__init__.py,sha256=9hf80COeu7SX1rTiyTHztOcZoi1DNZLvdjNPDVF3Unk,3582
|
5
|
+
claude_code_analytics/_core.abi3.so,sha256=DZPkMK_pdQIo4qEkXaGSycwCfwc3t5QveoSShFcesao,1087808
|
6
|
+
claude_code_analytics-0.1.1.dist-info/RECORD,,
|
@@ -1,6 +0,0 @@
|
|
1
|
-
claude_code_analytics-0.1.0.dist-info/METADATA,sha256=gJa9SdZOx4sNnWFQuQ8ESQ_xvIr9Ov4IVgy8xxzKX8s,18530
|
2
|
-
claude_code_analytics-0.1.0.dist-info/WHEEL,sha256=l9jBLnRRly5LD7TW-oNpYWU1DRojZivxrl_VDrtEJF4,103
|
3
|
-
claude_code_analytics-0.1.0.dist-info/licenses/LICENSE,sha256=VOy5LfrbCUMxLGMwcxF3KTEyMO8xzEBm713UCA6sQng,1069
|
4
|
-
claude_sdk/__init__.py,sha256=ZOdoUccrl-IPf563jSRbyHBfzhTDScrE_qVRSZ7GiB8,3571
|
5
|
-
claude_sdk/_core.abi3.so,sha256=hQccQ4bfAyqY6d5hN8tIERNBWzMIcn_fAH0SzQBI31Q,1087808
|
6
|
-
claude_code_analytics-0.1.0.dist-info/RECORD,,
|
File without changes
|
{claude_code_analytics-0.1.0.dist-info → claude_code_analytics-0.1.1.dist-info}/licenses/LICENSE
RENAMED
File without changes
|