ipython#

IPython related law functionality.

Task Task#

class Task(*args, **kwargs)#

Bases: Task

Base task for use in notebooks with additional features such as automatically updating of task class register or HTML representations.

Functions#

register_magics(init_cmd=None, init_fn=None, line_cmd=None, line_fn=None, log_level=None)#

Registers the two IPython magic methods %law and %ilaw which execute law commands either via a subprocess in bash (%law) or interactively / inline within the running process (%ilaw).

init_cmd can be a shell command that is called before the magic methods are registered. Similarly, init_fn can be a callable that is invoked prior to the method setup. line_cmd, a shell command, and line_fn, a callable, are executed before a line magic is called. The former is run before %law is evaluated, while the latter is called before %ilaw with the line to interpret as the only argument.

log_level conveniently sets the level of the law.contrib.ipython.magic logger that is used within the magic methods. It should be a number, or a string denoting a Python log level.