Metadata-Version: 2.4
Name: claude-code-jupyter-staging
Version: 0.0.1
Summary: IPython/Jupyter magic commands for interacting with Claude
Project-URL: Homepage, https://github.com/anthropics/claude-code-jupyter
Project-URL: Documentation, https://github.com/anthropics/claude-code-jupyter
Project-URL: Issues, https://github.com/anthropics/claude-code-jupyter/issues
Author-email: Anthropic <support@anthropic.com>
License: MIT
License-File: LICENSE
Keywords: ai,claude,ipython,jupyter,llm,magic
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: IPython
Classifier: Framework :: Jupyter
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: claude-agent-sdk
Requires-Dist: httpx
Requires-Dist: ipython
Requires-Dist: pygments
Requires-Dist: trio
Provides-Extra: dev
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.20.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest-mock; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# Claude Code Jupyter

IPython/Jupyter magic commands for interacting with Claude. This extension allows Claude to generate code that executes in your **current** Jupyter notebook or IPython session, sharing all variables and state.

## Installation

```bash
pip install claude-code-jupyter
```

For development installation:

```bash
git clone https://github.com/anthropics/claude-code-jupyter.git
cd claude-code-jupyter
pip install -e ".[dev]"
```

## Quick Start

### In a Jupyter Notebook

1. Load the extension:
```python
%load_ext cc_jupyter
```

2. Use Claude to generate and execute code:
```python
%cc Create a list of prime numbers up to 100
```

3. To see available options and usage information:
```python
%cc --help
```

### In IPython

1. Start IPython:
```bash
ipython
```

2. Load the magic:
```python
%load_ext cc_jupyter
```

3. Use Claude to generate and execute code:
```python
%cc Create a list of prime numbers up to 100
```

## When to use %cc vs %%cc

- **Use `%cc` (single %)** for:
  - Short, one-line instructions
  - Command options like `--help` or `--verbose`
  - Continuing without additional instructions

- **Use `%%cc` (double %)** for:
  - Multi-line instructions or detailed prompts
  - Complex requests that need more explanation
  - Any prompt ending with `?` (to avoid IPython's help system)

## Features

### Automatic Code Writing

Claude's code blocks are automatically extracted and written into a new cell that you approve by executing:

```python
import numpy as np
data = np.random.randn(1000)

%%cc
Create a histogram of the data array and calculate its statistics
```

### Continue Conversations

Follow up on previous requests:

```python
%cc Create a pandas DataFrame with sales data

# Claude writes code into a new cell, you review it and execute it

%cc Now add a column for profit margin
```

### Shared State

All variables are shared between you and Claude:

```python
# You create:
x = [1, 2, 3, 4, 5]

# Claude can use:
%cc Square each element in x and store in a new list called x_squared

# Claude writes code into a new cell, you review it and execute it

# You can use:
print(x_squared)  # Claude's variable is available!
```

## How It Works

1. You give Claude a task via `%cc <task>`
2. Claude generates Python code based on your request
3. The extension creates a new cell with Claude's Python code
4. You review Claude's code and execute it
5. You can continue working with Claude via `%cc`

## Examples

### Data Analysis
```python
%%cc
Load the iris dataset from sklearn and create a scatter plot matrix
```

### Interactive Development
```python
# Your code
data = load_my_data()

%cc Clean the data by removing NaN values and outliers

# Claude writes code into a new cell, you review it and execute it

%cc Now normalize the numerical columns

# data is now cleaned and normalized in your session
```

## Development

### Setup

```bash
# Clone the repository
git clone https://github.com/anthropics/claude-code-jupyter.git
cd claude-code-jupyter

# Install in development mode with dev dependencies
pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install
```

### Running Tests

```bash
pytest
```

### Code Quality

```bash
# Run linting
ruff check .

# Run formatting
ruff format .

# Run type checking
pyright
```

## Safety

- Claude does not execute code by itself. All code is reviewed by a human, who can choose to execute (or not).

## Limitations

- Claude can write code with errors
- No sandboxing - code runs with same access as rest of notebook

## License

MIT License - see [LICENSE](LICENSE) for details.

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

This extension is perfect for interactive data analysis, learning, and development where you want Claude to work alongside you in the same environment!
