jupyter / jupyter/nbclient

Executing notebooks with %load and other IPython magic commands

Open
#313 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
186
Forks
69
PR merge metrics
No merged PRs in 30d

Description

Hi! I'm seeing different behavior in how nbclient handles inline magics.
It's cool with `%%bash` but won't execute `%load`.

Is that something that could be addressed?

## What happens after running nbclient
![image](https://github.com/jupyter/nbclient/assets/47034358/de5a3edc-f9ab-4646-9d1f-d5f4fae53f2d)

## What happens when running in Jupyter (what I'd like nbclient to do)
![image](https://github.com/jupyter/nbclient/assets/47034358/bdcbbfe7-f16c-4585-a151-24a453c90250)

Notebook:

```
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "4547",
"metadata": {},
"outputs": [],
"source": [
"%%bash\n",
"pwd"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7184",
"metadata": {},
"outputs": [],
"source": [
"%load https://raw.githubusercontent.com/liquidcarbon/puppy/main/examples/Q-strings/Q.py"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bc1947e4-a990-4e54-8bd4-a3abb9ff2baa",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "ducks-pandas-3.12",
"language": "python",
"name": "ducks-pandas-3.12"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the supplied notebook with nbclient, comparing execution of the %%bash and %load cells with the behavior described for Jupyter. Trace the notebook execution entry point to determine where inline magic handling differs; done means %load executes as expected while the existing %%bash behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.