Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@forward_command(stub_cli, name="forwarded_command")
def forwarded_command(args):
print("fred", args)
@forward_command(stub_cli)
def unnamed(args):
print("fred", args)
@forward_command(cli, forward_help=True)
def test(args):
"""Run the test suite."""
try:
import pytest # pylint: disable=unused-import
except ImportError:
raise KedroCliError(NO_DEPENDENCY_MESSAGE.format("pytest"))
else:
python_call("pytest", args)
@forward_command(jupyter, "lab", forward_help=True)
@click.option("--ip", type=str, default="127.0.0.1")
@click.option("--all-kernels", is_flag=True, default=False)
def jupyter_lab(ip, all_kernels, args):
"""Open Jupyter Lab with project specific variables loaded."""
if "-h" not in args and "--help" not in args:
ipython_message(all_kernels)
call(
_build_jupyter_command("jupyter-lab", ip=ip, all_kernels=all_kernels, args=args)
)
@forward_command(cli, forward_help=True)
def ipython(args):
"""Open IPython with project specific variables loaded."""
if "-h" not in args and "--help" not in args:
ipython_message()
call(["ipython"] + list(args))
@forward_command(docker_jupyter, "lab")
@_make_image_option(callback=_image_callback)
@_make_port_option()
@_make_docker_args_option()
def docker_jupyter_lab(docker_args, port, image, args):
"""Run jupyter lab in the Docker container.
Any extra arguments unspecified in this help are passed to
`kedro jupyter lab` command inside the container as is."""
container_name = make_container_name(image, "jupyter-lab")
_docker_run_args = compose_docker_run_args(
required_args=[("-p", "{}:8888".format(port))],
optional_args=[("--rm", None), ("-it", None), ("--name", container_name)],
user_args=docker_args,
**_mount_info()
)
@forward_command(jupyter, "notebook", forward_help=True)
@click.option("--ip", type=str, default="127.0.0.1", help=JUPYTER_IP_HELP)
@click.option(
"--all-kernels", is_flag=True, default=False, help=JUPYTER_ALL_KERNELS_HELP
)
@click.option("--idle-timeout", type=int, default=30, help=JUPYTER_IDLE_TIMEOUT_HELP)
@click.option(
"--env",
"-e",
type=str,
default=None,
multiple=False,
help=ENV_ARG_HELP,
)
def jupyter_notebook(ip, all_kernels, env, idle_timeout, args):
"""Open Jupyter Notebook with project specific variables loaded."""
if "-h" not in args and "--help" not in args:
@forward_command(jupyter, "notebook", forward_help=True)
@click.option("--ip", type=str, default="127.0.0.1")
@click.option("--all-kernels", is_flag=True, default=False)
def jupyter_notebook(ip, all_kernels, args):
"""Open Jupyter Notebook with project specific variables loaded."""
if "-h" not in args and "--help" not in args:
ipython_message(all_kernels)
call(
_build_jupyter_command(
"jupyter-notebook", ip=ip, all_kernels=all_kernels, args=args
)
@forward_command(jupyter, "notebook", forward_help=True)
@click.option("--ip", type=str, default="127.0.0.1")
def jupyter_notebook(ip, args):
"""Open Jupyter Notebook with project specific variables loaded."""
if "-h" not in args and "--help" not in args:
ipython_message()
call(["jupyter-notebook", "--ip=" + ip] + list(args))
@forward_command(jupyter, "lab", forward_help=True)
@click.option("--ip", type=str, default="127.0.0.1")
def jupyter_lab(ip, args):
"""Open Jupyter Lab with project specific variables loaded."""
if "-h" not in args and "--help" not in args:
ipython_message()
call(["jupyter-lab", "--ip=" + ip] + list(args))