{ } Raw JSON

bundles / IPython 9.17.0 / IPython / core / magic / MagicsManager / register_lazy

function

IPython.core.magic:MagicsManager.register_lazy

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

Signature

def register_lazy(self, name: str, fully_qualified_name: str, magic_kind: _MagicSpec = line_cell) → None

Summary

Lazily register a magic, without importing what implements it.

Extended Summary

The magic shows up in %lsmagic and in completion straight away; the module is only imported the first time it is looked up.

Parameters

name : str

Name of the magic you wish to register.

fully_qualified_name : str

Either "package.module", which is loaded as an IPython extension (and trusted to register the magic itself), or "package.module:MagicsClass", which is imported and registered directly -- how IPython declares its own magics.

magic_kind : str

One of 'line', 'cell' or 'line_cell' (the default, since a lazily declared magic may well be both).

Aliases

  • IPython.core.magic.MagicsManager.register_lazy