You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When executing a notebook with nbval, get_ipython().history_manager.input_hist_raw (mentioned by @takluyver in jupyter/notebook#3101 (comment)) does not work for recent versions of nbval, so it is not possible to get the source of a cell from a cell.
But this is all a bunch of implementation details, so don't be too surprised if that one day stops working as well. If you want a stable API to get the code cell currently running, that would be up to IPython or ipykernel - but I think it's a pretty niche request.
(Oh, and in case it's not obvious, the sys._getframe() thing needs to be directly in a code cell, not wrapped in a function. You could walk the stack from inside a function to get back to the code cell, if you need to, but it's going to get fiddly.)
When executing a notebook with nbval,
get_ipython().history_manager.input_hist_raw
(mentioned by @takluyver in jupyter/notebook#3101 (comment)) does not work for recent versions of nbval, so it is not possible to get the source of a cell from a cell.I used this feature in https://transonic.readthedocs.io and I test it with
nbval~=0.9.6
.Is it possible to get the cell input in Python from the cell with recent version of nbval ?
The text was updated successfully, but these errors were encountered: