Using Cursor with Jupyter Notebooks: A Workaround for Data Scientists | Mito

Using Cursor with Jupyter Notebooks: A Workaround for Data Scientists

Ready to write Python code 4x faster?

Calling Cursor a game changer is almost an understatement. It brings powerful AI-assisted coding tools to your workflow—but there's one major limitation: Jupyter Notebooks.

Unfortunately, Cursor doesn’t play well with .ipynb files, which is a big drawback for anyone working in data science. The good news? There’s a simple workaround that lets you enjoy the best of both worlds.

Getting Started: Set Up Cursor for Jupyter-style Workflows

Before we begin, make sure you have Cursor installed. If you haven’t downloaded it yet, now’s the time. Cursor is a paid product, but the two-week free trial is more than enough to see its value.

Next, install the Jupyter extension, along with the official Python extension if you haven’t already.

The Problem with Jupyter Notebooks in Cursor

Cursor can open and run Jupyter Notebooks, but the problems start when you try to use its standout features—like Cursor Chat or Agent.

When you do, Cursor will read your code but struggle to edit it. Even worse, it often gets stuck trying, then fails. You’re left guessing what it wanted to do and manually copying and pasting the suggestion.

Why does this happen? Jupyter Notebook files (.ipynb) are not plain text—they’re actually JSON files. This structure makes them hard for Cursor to manipulate like regular .py files.

The actual contents of a Jupyter Notebook

💡 Looking for a native solution?

Check out Mito — a Jupyter-native extension that brings AI assistance directly into your notebooks. No workarounds, no conversions—just seamless AI-powered workflows right where you already work.

The Workaround: Use Python Files with Notebook-style Cells

The fix is simple: avoid .ipynb files entirely. Instead, work in a regular .py file and use special syntax to simulate notebook cells.

Add this at the top of each block:

# %%   # This creates a code cell

For example:

# %%
# This is a code block.
x = 1
y = 2

# %%
# This a second code block
print(x + y)

The "code cell marker" format will now denote blocks of code.

You can now run blocks independently—either by clicking the run button above each cell or using Shift+Enter. Output will appear in an interactive console, just like in a Jupyter notebook.

Working with Existing Notebooks in Cursor

If you already have a .ipynb file, don’t worry. You can convert it to a Python script:

  1. Open the notebook.
  2. Select File > Export As > Python Script.
The export menu, a

This will save your notebook as a .py file with cell markers already in place.

Adding Cursor AI to Your Data Science Workflow

Once you're working in a .py file, you can take full advantage of Cursor’s AI features. Here’s a quick overview:

Cursor Chat

Use this to ask one-off questions. Good for getting answers about specific parts of a notebook.

Open with CTRL/CMD+L.

Cursor Agent

Your AI co-pilot. The Agent can write code, edit multiple files, and even run your code. Ideal for quickly building prototypes.

Open with CTRL/CMD+I.

Inline Chat

Perfect for quick refactors or precise edits without needing full explanations.

Open with CTRL/CMD+K.

Autocomplete

Start typing and get smart suggestions. Hit Tab to accept.

Getting Cursor to Think Like a Data Scientist

By default, Cursor is geared toward software development—which makes sense. But when it comes to data science, it can miss some important nuances. Luckily, you can guide Cursor’s behavior by setting custom rules.

To create a custom rule:

  1. Go to Settings > Cursor Settings > Rules.
  2. In the User Rules section, define your preferences.

For example:

You are an expert data scientist in <your field here>. You have at your disposal pandas, matplotlib, scikitlearn.

Be sure to use code cell marker for Jupyter-style code cells.

The last sentence ensures Cursor formats its responses using # %% cell markers—just like in a Jupyter Notebook—so your code is cleanly organized into blocks you can run independently.

Limitations of Cursor for Data Science

While Cursor is a powerful tool for developers, it has some limitations when applied to data science workflows—especially those involving Jupyter Notebooks:

  • Incompatible with .ipynb Editing: Cursor can open and run Jupyter Notebooks, but its AI features—like Chat and Agent—struggle with .ipynb files. Because these notebooks are JSON-formatted rather than plain text, Cursor can read them but cannot reliably edit or update them.
  • Broken AI Assistance in Notebooks: When attempting to use Cursor's Chat or Agent within a Jupyter Notebook, you’ll often find the tool hangs or fails silently. The AI may suggest changes but won’t be able to apply them, forcing you to copy and paste its output manually.
  • Developer-Centric Defaults: Cursor is optimized for traditional software development. As a result, it doesn’t always understand the specific workflows and tools common in data science—like working with pandas, matplotlib, or the structure of analytical notebooks.
  • No Native Notebook Cell Awareness: Cursor does not treat .py files as notebooks by default. Without guidance, it won’t format responses into cell-based code blocks, which are essential for iterative, interactive data analysis.

These limitations don't make Cursor unusable for data science—but they do require some workarounds. By using .py files with cell markers (# %%) and configuring custom rules, you can adapt Cursor to better support your data science workflow.

Skip the Workarounds — Use AI Natively in Jupyter with Mito

Tired of converting .ipynb files just to get AI support?

Mito brings powerful AI tools directly into your Jupyter Notebook—no hacks, no compromises:

🤖 Mito AI – Context-aware chat and code suggestions that work inside your notebook.

📊 Mito Spreadsheet – A visual spreadsheet that writes clean Python for you, perfect for data prep and analysis.

Save time, stay in your flow, and keep everything in .ipynb.

Try Mito today – it’s free and open-source. → 🚀

Ready to write Python code 4x faster?