{ } Raw JSON

bundles / IPython 9.17.0 / IPython / core / magic / Magics

MetaHasTraits

IPython.core.magic:Magics

source: /dev/ipython/IPython/core/magic.py:745

Signature

def Magics(shell: InteractiveShell | None = None, **kwargs: Any) → None

Members

Summary

Base class for implementing magic functions.

Extended Summary

Shell functions which can be reached as %function_name. All magic functions should accept a string, which they can parse for their own needs. This can make some functions easier to type, eg %cd ../ vs. %cd("../")

Classes providing magic functions need to subclass this class, and they MUST:

  • Use the method decorators @line_magic and @cell_magic to decorate individual methods as magic functions, AND

  • Use the class decorator @magics_class to ensure that the magic methods are properly registered at the instance level upon instance initialization.

See magic_functions for examples of actual implementation classes.

Aliases

  • IPython.core.magic.Magics

Referenced by