Skip to content

InteractiveShell.magic is deprecated but is what we use in history. #10327

Closed

Description

@Carreau

All in title.

Activity

  1. added this to the wishlist milestone on Feb 23, 2017
  2. srinivasreddy commented on May 26, 2017

    @srinivasreddy
    Contributor

    I do not understand, and could you please care to explain?

  3. takluyver commented on May 26, 2017

    @takluyver
    Member

    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.

  4. Carreau commented on May 26, 2017

    @Carreau
    MemberAuthor

    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()

  5. Carreau commented on May 26, 2017

    @Carreau
    MemberAuthor

    (Note, one possible thing is to un-deprecate magic if it's too painful to update.

  6. srinivasreddy commented on May 29, 2017

    @srinivasreddy
    Contributor

    I am taking it

  7. added 3 commits that reference this issue on Jun 4, 2017
  8. adityausathe commented on Jun 5, 2017

    @adityausathe
    Contributor

    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(..).

  9. Carreau commented on Jun 5, 2017

    @Carreau
    MemberAuthor

    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.

  10. added 2 commits that reference this issue on Jun 6, 2017
    c997a27
    60c5850
  11. adityausathe commented on Jun 6, 2017

    @adityausathe
    Contributor

    Please, have a look at PR #10638. I have resolved the issue and also kept backward compatibility support for get_ipython().magic()

  12. added a commit that references this issue on Jun 8, 2017
  13. added a commit that references this issue on Jun 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions