Skip to main content

Agentic AI coding partner for IPython and Jupyter

Project description

🧠 JupyterPilot AI

JupyterPilot AI (jupyterpilot-ai) is a lightweight, provider-agnostic AI coding partner for IPython and Jupyter. It brings natural language code generation (%do) and automated error healing (%fix) to your notebook.


🚀 Features

  • %do : Transform instructions into Python code instantly.
  • %fix: Post-mortem self-healing for your last error.
  • %review: Analyze the previous cell and get optimization suggestions or code reviews.
  • Context Awareness: Remembers your last 3 cells for accurate variable usage.
  • Data Observer (New): Automatically detects Pandas DataFrames, SQL engines, and MongoDB databases to provide schema context to the AI.
    • Smart MongoDB Introspection: Aggregates schema keys from the 20 most recent documents and extracts collection indexes, helping the AI write highly optimized queries.
  • Hybrid Support: Switch between local Ollama and cloud GPT-4o/Claude via LiteLLM.

📥 Installation

pip install jupyterpilot-ai

Enable Data Observer (Optional)

To enable automatic schema detection for Pandas, SQL, and MongoDB, install the data extras:

pip install "jupyterpilot-ai[data]"

Enable the Extension

Add this to any cell in your notebook or your IPython startup script:

%load_ext jupyterpilot_ai

⚙️ Configuration

JupyterPilot AI looks for a configuration file at ~/.jupyterpilot/config.json.

Switching Modes

To switch between local and paid models, simply change the "mode" value in your config file:

{
    "mode": "cloud", 
    "local": {
        "url": "http://localhost:11434/api/generate",
        "model": "qwen2.5-coder:7b"
    },
    "cloud": {
        "provider": "openai",
        "model": "gpt-4o",
        "api_key": "sk-..."
    },
    "custom_jar_ai": {
        "url": "",
        "model": "",
        "api_key": ""
    }
}
  • Local Mode ("mode": "local"):

    • Uses Ollama by default.
    • Requires Ollama to be running (ollama run qwen2.5-coder:7b).
    • You can customize the url and model in the local block.
  • Cloud Mode ("mode": "cloud"):

    • Uses LiteLLM to connect to paid providers.
    • Supports OpenAI, Anthropic (Claude), Google (Gemini), etc.
    • Specify your provider, model, and api_key.
  • Custom Jar AI Mode ("mode": "custom_jar_ai"):

    • Connect to your custom AI API endpoint directly.
    • Set your custom url, model, and api_key.

🛠️ Usage

Basic Commands

  • %do plot a sine wave
  • %fix (after an error)
  • %review (to review the last run cell)

Advanced Data Observer Example

If you have jupyterpilot-ai[data] installed, simply connecting to your database in a cell is enough for the AI to understand your schema.

# Cell 1: Connect to your database (Pandas, SQL, or Mongo)
from pymongo import MongoClient
client = MongoClient("mongodb://localhost:27017/")
db = client["Testing"]
# Cell 2: Ask the AI to write a query without explaining your collections or fields!
%do find the most recently active admin user

Behind the scenes, JupyterPilot automatically extracts the collection names, schema keys, and indices from db and injects them into the AI's context so it generates perfect code.


📬 Contact

Wajoud Noorani - Wajoudnoorani59@gmail.com


📄 License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyterpilot_ai-0.3.1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jupyterpilot_ai-0.3.1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file jupyterpilot_ai-0.3.1.tar.gz.

File metadata

  • Download URL: jupyterpilot_ai-0.3.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for jupyterpilot_ai-0.3.1.tar.gz
Algorithm Hash digest
SHA256 c5c1a7e17a23951a91a72d24912967b6cce205943c7227056f6ad1f27dbd8f9b
MD5 68d6bc66440387d25834e3ce58f8ab02
BLAKE2b-256 087043a800dd6194a3c3202d6df04cd3ab6bb98c6150f94a8fbe130cd422f49d

See more details on using hashes here.

File details

Details for the file jupyterpilot_ai-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyterpilot_ai-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dd29606006c0dd5a67a06736e98905d3f5ea958073fbecd0cb54c062bbb98890
MD5 9e3452755f44409a5eb3f37b4ed4f0a6
BLAKE2b-256 6f66fdae9a74802e929c17da910be82bd165b1d8e09d9c182151cb70513ccbe6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page