How to use the kedro.cli.utils.call function in kedro

To help you get started, we’ve selected a few kedro examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github quantumblacklabs / kedro / kedro / template / {{ cookiecutter.repo_name }} / kedro_cli.py View on Github external
def build_docs(open_docs):
    """Build the project documentation."""
    python_call("pip", ["install", "src/[docs]"])
    python_call("pip", ["install", "-r", "src/requirements.txt"])
    python_call(
        "ipykernel", ["install", "--user", "--name={{ cookiecutter.python_package }}"]
    )
    shutil.rmtree("docs/build", ignore_errors=True)
    call(
        [
            "sphinx-apidoc",
            "--module-first",
            "-o",
            "docs/source",
            "src/{{ cookiecutter.python_package }}",
        ]
    )
    call(["sphinx-build", "-M", "html", "docs/source", "docs/build", "-a"])
    if open_docs:
        docs_page = (Path.cwd() / "docs" / "build" / "html" / "index.html").as_uri()
        secho("Opening {}".format(docs_page))
        webbrowser.open(docs_page)
github Minyus / causallift / kedro_cli.py View on Github external
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)
    )
github quantumblacklabs / kedro-examples / kedro-tutorial / kedro_cli.py View on Github external
def install():
    """Install project dependencies from both requirements.txt
    and environment.yml (optional)."""

    if (Path.cwd() / "src" / "environment.yml").is_file():
        call(["conda", "install", "--file", "src/environment.yml", "--yes"])

    pip_command = ["install", "-U", "-r", "src/requirements.txt"]

    if os.name == "posix":
        python_call("pip", pip_command)
    else:
        command = [sys.executable, "-m", "pip"] + pip_command
        subprocess.Popen(command, creationflags=subprocess.CREATE_NEW_CONSOLE)
github tipresias / tipresias / data_science / kedro_cli.py View on Github external
def build_docs():
    """Build the project documentation."""
    python_call("pip", ["install", "src/[docs]"])
    python_call("pip", ["install", "-r", "requirements.txt"])
    python_call("ipykernel", ["install", "--user", "--name=machine_learning"])
    if Path("docs/build").exists():
        shutil.rmtree("docs/build")
    call(
        ["sphinx-apidoc", "--module-first", "-o", "docs/source", "src/machine_learning"]
    )
    call(["sphinx-build", "-M", "html", "docs/source", "docs/build", "-a"])
github quantumblacklabs / kedro / kedro / template / {{ cookiecutter.repo_name }} / kedro_cli.py View on Github external
import nbstripout  # pylint: disable=unused-import
    except ImportError:
        raise KedroCliError(NO_DEPENDENCY_MESSAGE.format("nbstripout"))

    try:
        res = subprocess.run(
            ["git", "rev-parse", "--git-dir"],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
        )
        if res.returncode:
            raise KedroCliError("Not a git repository. Run `git init` first.")
    except FileNotFoundError:
        raise KedroCliError("Git executable not found. Install Git first.")

    call(["nbstripout", "--install"])
github quantumblacklabs / kedro-examples / kedro-tutorial / kedro_cli.py View on Github external
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))
github quantumblacklabs / kedro / kedro / template / {{ cookiecutter.repo_name }} / kedro_cli.py View on Github external
def package():
    """Package the project as a Python egg and wheel."""
    call([sys.executable, "setup.py", "clean", "--all", "bdist_egg"], cwd="src")
    call([sys.executable, "setup.py", "clean", "--all", "bdist_wheel"], cwd="src")
github quantumblacklabs / kedro / kedro / template / {{ cookiecutter.repo_name }} / kedro_cli.py View on Github external
def install():
    """Install project dependencies from both requirements.txt
    and environment.yml (optional)."""

    if (Path.cwd() / "src" / "environment.yml").is_file():
        call(["conda", "install", "--file", "src/environment.yml", "--yes"])

    pip_command = ["install", "-U", "-r", "src/requirements.txt"]

    if os.name == "posix":
        python_call("pip", pip_command)
    else:
        command = [sys.executable, "-m", "pip"] + pip_command
        subprocess.Popen(command, creationflags=subprocess.CREATE_NEW_CONSOLE)
github quantumblacklabs / kedro-docker / kedro_docker / plugin.py View on Github external
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()
    )

    args = add_jupyter_args(list(args))
    command = (
        ["docker", "run"] + _docker_run_args + [image, "kedro", "jupyter", "lab"] + args
    )
    call(command)
github tipresias / tipresias / data_science / kedro_cli.py View on Github external
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))