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
{{ message }}
Repository navigation
InteractiveShell.magic is deprecated but is what we use in history. #10327
There's a method called InteractiveShell.magic that we use somewhere in the history code (not sure where - you could have been more precise, @Carreau ;-). We're now encouraging people to use InteractiveShell.run_line_magic instead.
You can see that magic is used in a couple of places (interaciveshell, line 2029) we call self.magic('color %s % self.colors)instead ofself.run_line_magic('color', self.colors)`.
And if you run the hist magic:
In [1]: time 1+1
CPU times: user 3 µs, sys: 1 µs, total: 4 µs
Wall time: 5.72 µs
Out[1]: 2
In [2]: hist -t
get_ipython().magic('time 1+1')
get_ipython().magic('hist -t')`
You see that what was executed is get_ipython().magic(...) instead of get_ipython().run_line_magic()
Reacted by Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి)
We need to also make changes to a lot of core test cases, if we replace get_ipython().magic(..) with get_ipython().run_line_magic(..). We can simply un-deprecate get_ipython().magic(..).
We need to also make changes to a lot of core test cases, if we replace get_ipython().magic(..) with get_ipython().run_line_magic(..). We can simply un-deprecate get_ipython().magic(..).
Yes, we can also undeprecate magic(), in general we should figure out why (and when?) it was deprecated. It is still likely something we want to keep for backward compatibility for a while anyway.
Activity
srinivasreddy commentedon May 26, 2017
I do not understand, and could you please care to explain?
takluyver commentedon May 26, 2017
There's a method called
InteractiveShell.magicthat we use somewhere in the history code (not sure where - you could have been more precise, @Carreau ;-). We're now encouraging people to useInteractiveShell.run_line_magicinstead.Carreau commentedon May 26, 2017
You can see that magic is used in a couple of places (interaciveshell, line 2029) we call
self.magic('color %s% self.colors)instead ofself.run_line_magic('color', self.colors)`.And if you run the hist magic:
You see that what was executed is
get_ipython().magic(...)instead ofget_ipython().run_line_magic()Carreau commentedon May 26, 2017
(Note, one possible thing is to un-deprecate magic if it's too painful to update.
srinivasreddy commentedon May 29, 2017
I am taking it
fix for ipython#10327 : get_ipython.magic() replaced with get_ipython…
fix for ipython#10327 : get_ipython().magic() replaced with get_ipyth…
fix for ipython#10327 : get_ipython().magic() replaced with get_ipyth…
adityausathe commentedon Jun 5, 2017
We need to also make changes to a lot of core test cases, if we replace
get_ipython().magic(..)withget_ipython().run_line_magic(..). We can simply un-deprecateget_ipython().magic(..).Carreau commentedon Jun 5, 2017
Yes, we can also undeprecate
magic(), in general we should figure out why (and when?) it was deprecated. It is still likely something we want to keep for backward compatibility for a while anyway.Fix ipython#10327: Test fails handled and magic() backward compatibil…
Fix ipython#10327: Test fails handled and magic() backward compatibil…
adityausathe commentedon Jun 6, 2017
Please, have a look at PR #10638. I have resolved the issue and also kept backward compatibility support for
get_ipython().magic()fix for ipython#10327: _stack_depth added and {u} string literals rem…
Merge pull request #10638 from adityausathe/master
FIX, WIP: fix test_widget_abstract_notebook bc of deprecated method?