vscode-jupyter
vscode-jupyter copied to clipboard
python notebooks with dependent source files fail to update
Type: Bug
I often create python notebooks that include imports of .py files with functions and/or .env files. When I make an edit to those referenced files (and save) and re-run the kernel in my ipynb, the changes in the underlying files are not reflected. I must close and reopen VSCode to have those changes reflected.
Steps to reproduce:
- create an ipynb that references code in a separate .py or .env
- edit code in the referenced .py or .env; save
- run all in ipynb
Expected behavior: edit in referenced file is reflected in the ipynb output Actual behavior: the edit is not reflected.
VS Code version: Code 1.71.2 (74b1f979648cc44d385a2286793c226e611f59e7, 2022-09-14T21:03:37.738Z) OS version: Windows_NT x64 10.0.19044 Modes: Sandboxed: No
System Info
Item | Value |
---|---|
CPUs | Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz (16 x 2304) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_renderer: enabled_on video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off |
Load (avg) | undefined |
Memory (System) | 31.75GB (20.07GB free) |
Process Argv | --crash-reporter-id a842f04e-e6ef-4792-ad55-af25695af9d4 |
Screen Reader | no |
VM | 0% |
Extensions (20)
Extension | Author (truncated) | Version |
---|---|---|
jsonviewer | cci | 1.2.5 |
vscode-npm-script | eg2 | 0.3.28 |
code-runner | for | 0.11.8 |
vscode-pull-request-github | Git | 0.50.0 |
gc-excelviewer | Gra | 4.2.56 |
dotenv | mik | 1.0.1 |
prettify-json | moh | 0.0.3 |
vscode-docker | ms- | 1.22.1 |
anaconda-extension-pack | ms- | 1.0.1 |
python | ms- | 2022.14.0 |
vscode-pylance | ms- | 2022.9.20 |
jupyter | ms- | 2022.8.1002431955 |
jupyter-keymap | ms- | 1.0.0 |
jupyter-renderers | ms- | 1.0.9 |
remote-ssh | ms- | 0.84.0 |
remote-ssh-edit | ms- | 0.80.0 |
vsliveshare | ms- | 1.0.5723 |
geo-data-viewer | Ran | 2.5.0 |
vscode-commons | red | 0.0.6 |
vscode-yaml | red | 1.10.1 |
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411cf:30557515
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vscaac:30438847
vsclangdf:30486550
c4g48928:30535728
hb751961:30553087
dsvsc012cf:30540253
azure-dev_surveyone:30548225
i497e931:30553904
@DanielFernandoArias Just to check the scenario. You have the kernel started in a notebook and you have run a cell importing a .py module, you then edit the file for the .py module, then you run all in the notebook? If I'm understanding correctly at this point I don't believe the module would be updated.
For IPython they provide an autoreload magic like so: https://ipython.org/ipython-doc/3/config/extensions/autoreload.html but even that is not considered a 100% thing.
I think that restarting your kernel (should be able to just restart the kernel and not close VS Code) would be the safest option to pick up changes in imports.
Closing on no response.