run_command#

scikitplot._ipymagic.run_command(args, *, stdin=None, settings=None, out=None, err=None)[source]#

Run one scikitplot command and return its result.

Parameters:
argsstr or sequence of str

The command line after scikitplot ("env plan -n demo") or its arguments.

stdinstr or None, default=None

Text given to the command on standard input (the cell of %%scikitplot); the command then runs in a subprocess.

settingsMagicSettings or None, default=None

Timeout, isolation, streaming, raising; defaults when None.

out, errtext stream or None, default=None

Where the output is shown; sys.stdout / sys.stderr at call time when None.

Returns:
CommandResult

Exit status, captured output, timing and, for --format json, the parsed data.

Raises:
MagicUsageError

For arguments that name no command (nothing is run).

CommandFailedError

For a non-zero exit status when settings.raise_on_error.

KeyboardInterrupt

After stopping the command, when interrupted.

Parameters:
Return type:

CommandResult

Examples

>>> import io
>>> from scikitplot._ipymagic import run_command
>>> result = run_command("info --format json", out=io.StringIO())
>>> result.ok, sorted(result.data)
(True, ['platform', 'python', 'scikitplot'])