Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

%load does not update #7158

Open
Reissner opened this issue Nov 19, 2023 · 1 comment
Open

%load does not update #7158

Reissner opened this issue Nov 19, 2023 · 1 comment

Comments

@Reissner
Copy link

Description

In a python field, one may load python files with %load file.py.
This works fine, but what is done is,
the line %load file.py is commented out
and after it, the file is inserted in the cell.

The result is

# %load file.py 

<here comes the file> 

The problem with this is, that if the file changes, the inserted text does not change and what is really recomputed
is what is effectively what is in the cell disregarding the changed file.

Reproduce

Very simple, wirte f ile $file.py$, write a minimum notebook with a single cell of type python
containing just %load file.py.
Running the cell shows the behavior.

Expected behavior

There are several possibilities for a decent behavior.

I would prefer to keep the cell unchanged
and just interpret the line %load file.py as if there would be the content of the file in the current version.

I would not mind that the details are invisible.
If One cares, the solution is more difficult.
maybe replacing %load file.py by

<here comes the file 

Context

I think this does not depend on context at all.

@Reissner Reissner added bug status:Needs Triage Applied to issues that need triage labels Nov 19, 2023
@RRosio RRosio added enhancement status:Needs Discussion and removed bug status:Needs Triage Applied to issues that need triage labels Nov 28, 2023
@ericsnekbytes
Copy link
Collaborator

ericsnekbytes commented Nov 28, 2023

For context, here are the docs for the %load magic command.

I think what you want goes beyond what %load is meant to do, which is just insert text into the cell. For customizing or defining new magics, you probably need to read about making those kind of customizations in ipython.

Does anyone else have a better suggestion? I don't think this is possible with the JupyterLab extension system (which Notebook 7 is built off on top of).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants