Example #1
0
def jupyter_lab(
    metadata: ProjectMetadata,
    ip_address,
    all_kernels,
    env,
    idle_timeout,
    args,
    **kwargs,
):  # pylint: disable=unused-argument,too-many-arguments
    """Open Jupyter Lab with project specific variables loaded."""
    _check_module_importable("jupyter_core")

    if "-h" not in args and "--help" not in args:
        ipython_message(all_kernels)

    _update_ipython_dir(metadata.project_path)
    arguments = _build_jupyter_command(
        "lab",
        ip_address=ip_address,
        all_kernels=all_kernels,
        args=args,
        idle_timeout=idle_timeout,
        project_name=metadata.project_name,
    )

    python_call_kwargs = _build_jupyter_env(env)
    python_call("jupyter", arguments, **python_call_kwargs)
Example #2
0
def ipython(env, args):
    """Open IPython with project specific variables loaded."""
    context = _load_project_context(env=env)
    os.environ["IPYTHONDIR"] = str(context.project_path / ".ipython")
    if env:
        os.environ["KEDRO_ENV"] = env
    if "-h" not in args and "--help" not in args:
        ipython_message()
    call(["ipython"] + list(args))
Example #3
0
def ipython(metadata: ProjectMetadata, env, args, **kwargs):  # pylint: disable=unused-argument
    """Open IPython with project specific variables loaded."""
    _check_module_importable("IPython")

    os.environ["IPYTHONDIR"] = str(metadata.project_path / ".ipython")
    if env:
        os.environ["KEDRO_ENV"] = env
    if "-h" not in args and "--help" not in args:
        ipython_message()
    call(["ipython"] + list(args))
Example #4
0
def jupyter_lab(ip_address, all_kernels, env, idle_timeout, args):
    """Open Jupyter Lab with project specific variables loaded."""
    context = _load_project_context(env=env)
    if "-h" not in args and "--help" not in args:
        ipython_message(all_kernels)

    _update_ipython_dir(context.project_path)
    arguments = _build_jupyter_command(
        "lab",
        ip_address=ip_address,
        all_kernels=all_kernels,
        args=args,
        idle_timeout=idle_timeout,
        project_name=context.project_name,
    )

    python_call_kwargs = _build_jupyter_env(env)
    python_call("jupyter", arguments, **python_call_kwargs)