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
pip install claude-code-jupyter
For development installation:
git clone https://github.com/anthropics/claude-code-jupyter.git
cd claude-code-jupyter
pip install -e ".[dev]"
Quick Start
In a Jupyter Notebook
- Load the extension:
%load_ext cc_jupyter
- Use Claude to generate and execute code:
%cc Create a list of prime numbers up to 100
- To see available options and usage information:
%cc --help
In IPython
- Start IPython:
ipython
- Load the magic:
%load_ext cc_jupyter
- Use Claude to generate and execute code:
%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
--helpor--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:
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:
%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:
# 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
- You give Claude a task via
%cc <task> - Claude generates Python code based on your request
- The extension creates a new cell with Claude's Python code
- You review Claude's code and execute it
- You can continue working with Claude via
%cc
Examples
Data Analysis
%%cc
Load the iris dataset from sklearn and create a scatter plot matrix
Interactive Development
# 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
# 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
pytest
Code Quality
# 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 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!
Metadata
Release files for claude-code-jupyter-staging 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| claude_code_jupyter_staging-0.0.1.tar.gz | 30.6 kB | Without provenance | Details for claude_code_jupyter_staging-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| claude_code_jupyter_staging-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for claude_code_jupyter_staging-0.0.1-py3-none-any.whl |
Total release size: 63.3 kB
Release files / claude_code_jupyter_staging-0.0.1.tar.gz
| Download URL | claude_code_jupyter_staging-0.0.1.tar.gz |
|---|---|
| Size | 30.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58d4e5486d3d99b1ffd0926c90670258d5ca93e784f0e84f6ea05b9457e788c7
|
|
BLAKE2b-256 checksum How to use checksums |
1d5d4e0d15b2960bca0717ec9cbf9c9c9bf5c7add9390ed0ac8e628c32aa1a65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / claude_code_jupyter_staging-0.0.1-py3-none-any.whl
| Download URL | claude_code_jupyter_staging-0.0.1-py3-none-any.whl |
|---|---|
| Size | 32.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7cd98acea08bcd68473e8009769b85722272b76278fc5a6ba06fc13607071811
|
|
BLAKE2b-256 checksum How to use checksums |
7408a56bae56457f9798ec16f81e1ccaad713f4f54c430fe3d2787dc1e39796b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for claude-code-jupyter-staging 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.