Beispiel #1
0
def add_parser(subparsers, parent_parser):
    FREEZE_HELP = "Freeze stages or .dvc files."
    freeze_parser = subparsers.add_parser(
        "freeze",
        parents=[parent_parser],
        description=append_doc_link(FREEZE_HELP, "freeze"),
        help=FREEZE_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    freeze_parser.add_argument(
        "targets",
        nargs="+",
        help="Stages or .dvc files to freeze",
        metavar="targets",
        choices=completion.Required.DVC_FILE,
    )
    freeze_parser.set_defaults(func=CmdFreeze)

    UNFREEZE_HELP = "Unfreeze stages or .dvc files."
    unfreeze_parser = subparsers.add_parser(
        "unfreeze",
        parents=[parent_parser],
        description=append_doc_link(UNFREEZE_HELP, "unfreeze"),
        help=UNFREEZE_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    unfreeze_parser.add_argument(
        "targets",
        nargs="+",
        help="Stages or .dvc files to unfreeze",
        metavar="targets",
        choices=completion.Required.DVC_FILE,
    )
    unfreeze_parser.set_defaults(func=CmdUnfreeze)
Beispiel #2
0
def add_parser(subparsers, parent_parser):
    FREEZE_HELP = "Freeze DVC-files."
    freeze_parser = subparsers.add_parser(
        "freeze",
        parents=[parent_parser],
        description=append_doc_link(FREEZE_HELP, "freeze"),
        help=FREEZE_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    freeze_parser.add_argument("targets",
                               nargs="+",
                               help="DVC-files to freeze.")
    freeze_parser.set_defaults(func=CmdFreeze)

    UNFREEZE_HELP = "Unfreeze DVC-files."
    unfreeze_parser = subparsers.add_parser(
        "unfreeze",
        parents=[parent_parser],
        description=append_doc_link(UNFREEZE_HELP, "unfreeze"),
        help=UNFREEZE_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    unfreeze_parser.add_argument("targets",
                                 nargs="+",
                                 help="DVC-files to unfreeze.")
    unfreeze_parser.set_defaults(func=CmdUnfreeze)
Beispiel #3
0
def add_parser(subparsers, parent_parser):
    from dvc.command.config import parent_config_parser

    PKG_HELP = "Manage DVC packages."
    pkg_parser = subparsers.add_parser(
        "pkg",
        parents=[parent_parser],
        description=append_doc_link(PKG_HELP, "pkg"),
        help=PKG_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
        add_help=False,
    )

    pkg_subparsers = pkg_parser.add_subparsers(
        dest="cmd", help="Use dvc pkg CMD --help for command-specific help.")

    fix_subparsers(pkg_subparsers)

    PKG_INSTALL_HELP = "Install package."
    pkg_install_parser = pkg_subparsers.add_parser(
        "install",
        parents=[parent_config_parser, parent_parser],
        description=append_doc_link(PKG_INSTALL_HELP, "pkg-install"),
        help=PKG_INSTALL_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    pkg_install_parser.add_argument(
        "address",
        nargs="?",
        default="",
        help="Package address: git://<url> or https://github.com/...",
    )
    pkg_install_parser.add_argument(
        "target_dir",
        metavar="target",
        nargs="?",
        default=".",
        help="Target directory to deploy package outputs. "
        "Default value is the current dir.",
    )
    pkg_install_parser.add_argument(
        "-s",
        "--select",
        metavar="OUT",
        action="append",
        default=[],
        help="Select and persist only specified outputs from a package. "
        "The parameter can be used multiple times. "
        "All outputs will be selected by default.",
    )
    pkg_install_parser.add_argument(
        "-f",
        "--file",
        help="Specify name of the stage file. It should be "
        "either 'Dvcfile' or have a '.dvc' suffix (e.g. "
        "'prepare.dvc', 'clean.dvc', etc). "
        "By default the file has 'mod_' prefix and imported package name "
        "followed by .dvc",
    )
    pkg_install_parser.set_defaults(func=CmdPkg)
Beispiel #4
0
def add_parser(subparsers, parent_parser):
    PARAMS_HELP = "Commands to display params."

    params_parser = subparsers.add_parser(
        "params",
        parents=[parent_parser],
        description=append_doc_link(PARAMS_HELP, "params"),
        help=PARAMS_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )

    params_subparsers = params_parser.add_subparsers(
        dest="cmd",
        help="Use `dvc params CMD --help` to display command-specific help.",
    )

    fix_subparsers(params_subparsers)

    PARAMS_DIFF_HELP = (
        "Show changes in params between commits in the DVC repository, or "
        "between a commit and the workspace.")
    params_diff_parser = params_subparsers.add_parser(
        "diff",
        parents=[parent_parser],
        description=append_doc_link(PARAMS_DIFF_HELP, "params/diff"),
        help=PARAMS_DIFF_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    params_diff_parser.add_argument(
        "a_rev",
        nargs="?",
        help="Old Git commit to compare (defaults to HEAD)")
    params_diff_parser.add_argument(
        "b_rev",
        nargs="?",
        help=("New Git commit to compare (defaults to the current workspace)"),
    )
    params_diff_parser.add_argument(
        "--all",
        action="store_true",
        default=False,
        help="Show unchanged params as well.",
    )
    params_diff_parser.add_argument(
        "--show-json",
        action="store_true",
        default=False,
        help="Show output in JSON format.",
    )
    params_diff_parser.add_argument(
        "--show-md",
        action="store_true",
        default=False,
        help="Show tabulated output in the Markdown format (GFM).",
    )
    params_diff_parser.set_defaults(func=CmdParamsDiff)
Beispiel #5
0
def add_parser(subparsers, parent_parser):
    from dvc.command.config import parent_config_parser

    CACHE_HELP = "Manage cache settings."

    cache_parser = subparsers.add_parser(
        "cache",
        parents=[parent_parser],
        description=append_doc_link(CACHE_HELP, "cache"),
        help=CACHE_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )

    cache_subparsers = cache_parser.add_subparsers(
        dest="cmd",
        help="Use `dvc cache CMD --help` for command-specific " "help.",
    )

    fix_subparsers(cache_subparsers)

    parent_cache_config_parser = argparse.ArgumentParser(
        add_help=False, parents=[parent_config_parser]
    )
    CACHE_DIR_HELP = "Configure cache directory location."

    cache_dir_parser = cache_subparsers.add_parser(
        "dir",
        parents=[parent_parser, parent_cache_config_parser],
        description=append_doc_link(CACHE_HELP, "cache/dir"),
        help=CACHE_DIR_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    cache_dir_parser.add_argument(
        "-u",
        "--unset",
        default=False,
        action="store_true",
        help="Unset option.",
    )
    cache_dir_parser.add_argument(
        "value",
        help="Path to cache directory. Relative paths are resolved relative "
        "to the current directory and saved to config relative to the "
        "config file location. If no path is provided, it returns the "
        "current cache directory.",
        nargs="?",
    ).complete = completion.DIR
    cache_dir_parser.set_defaults(func=CmdCacheDir)
Beispiel #6
0
def add_parser(subparsers, parent_parser):
    IMPORT_HELP = (
        "Download a file or directory from any DVC project or Git repository "
        "and take it under DVC control."
    )

    import_parser = subparsers.add_parser(
        "import",
        parents=[parent_parser],
        description=append_doc_link(IMPORT_HELP, "import"),
        help=IMPORT_HELP,
        formatter_class=argparse.RawTextHelpFormatter,
    )
    import_parser.add_argument(
        "url",
        help="Location of DVC project or Git repository to download from",
    )
    import_parser.add_argument(
        "path",
        help="Path to a file or directory within the project or repository",
    )
    import_parser.add_argument(
        "-o", "--out", nargs="?", help="Destination path to download files to"
    )
    import_parser.add_argument(
        "--rev", nargs="?", help="Git revision (e.g. branch, tag, SHA)"
    )
    import_parser.set_defaults(func=CmdImport)
Beispiel #7
0
def add_parser(subparsers, parent_parser):
    RENDER_HELP = "Render templated dvc.yaml"
    render_parser = subparsers.add_parser(
        "render",
        parents=[parent_parser],
        description=append_doc_link(RENDER_HELP, "render"),
        help=RENDER_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    render_parser.add_argument(
        "--path",
        default="dvc.yaml",
        help="Path to dvc.yaml file",
    )
    render_parser.add_argument(
        "--stage",
        "-s",
        default=None,
        help="Only render a specified stage",
    )
    render_parser.add_argument(
        "--only-vars",
        action="store_true",
        default=False,
        help="Only render the `vars` component of the dvc.yaml",
    )
    render_parser.add_argument(
        "--only-stages",
        action="store_true",
        default=False,
        help="Only render the `stages` component of the dvc.yaml",
    )

    render_parser.set_defaults(func=CmdRender)
Beispiel #8
0
def add_parser(subparsers, parent_parser):
    IMPORT_HELP = "Download or copy files from URL and take under DVC control."

    import_parser = subparsers.add_parser(
        "import",
        parents=[parent_parser],
        description=append_doc_link(IMPORT_HELP, "import"),
        help=IMPORT_HELP,
        formatter_class=argparse.RawTextHelpFormatter,
    )
    import_parser.add_argument(
        "url",
        help="Supported urls:\n"
        "/path/to/file\n"
        "C:\\\\path\\to\\file\n"
        "https://example.com/path/to/file\n"
        "s3://bucket/path/to/file\n"
        "gs://bucket/path/to/file\n"
        "hdfs://example.com/path/to/file\n"
        "ssh://example.com:/path/to/file\n"
        "remote://myremote/path/to/file (see `dvc remote`)",
    )
    import_parser.add_argument(
        "--resume",
        action="store_true",
        default=False,
        help="Resume previously started download.",
    )
    import_parser.add_argument("out",
                               nargs="?",
                               help="Destination path to put files to.")
    import_parser.set_defaults(func=CmdImport)
Beispiel #9
0
def add_parser(subparsers, parent_parser):
    UPDATE_HELP = "Update data artifacts imported from other DVC repositories."
    update_parser = subparsers.add_parser(
        "update",
        parents=[parent_parser],
        description=append_doc_link(UPDATE_HELP, "update"),
        help=UPDATE_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    update_parser.add_argument("targets",
                               nargs="+",
                               help="DVC-files to update.")
    update_parser.add_argument(
        "--rev",
        nargs="?",
        help="Git revision (e.g. SHA, branch, tag)",
        metavar="<commit>",
    )
    update_parser.add_argument(
        "-R",
        "--recursive",
        action="store_true",
        default=False,
        help="Update all stages in the specified directory.",
    )
    update_parser.set_defaults(func=CmdUpdate)
Beispiel #10
0
Datei: run.py Projekt: pared/dvc
def add_parser(experiments_subparsers, parent_parser):

    EXPERIMENTS_RUN_HELP = "Run or resume an experiment."
    experiments_run_parser = experiments_subparsers.add_parser(
        "run",
        parents=[parent_parser],
        description=append_doc_link(EXPERIMENTS_RUN_HELP, "exp/run"),
        help=EXPERIMENTS_RUN_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    _add_run_common(experiments_run_parser)
    experiments_run_parser.add_argument(
        "-r",
        "--rev",
        type=str,
        dest="checkpoint_resume",
        help=("Continue the specified checkpoint experiment. Can only be used "
              "in conjunction with --queue or --temp."),
        metavar="<experiment_rev>",
    ).complete = completion.EXPERIMENT
    experiments_run_parser.add_argument(
        "--reset",
        action="store_true",
        help="Reset existing checkpoints and restart the experiment.",
    )
    experiments_run_parser.set_defaults(func=CmdExperimentsRun)
Beispiel #11
0
def add_parser(subparsers, parent_parser):
    IMPORT_HELP = (
        "Download data from DVC repository and take it under DVC control."
    )

    import_parser = subparsers.add_parser(
        "import",
        parents=[parent_parser],
        description=append_doc_link(IMPORT_HELP, "import"),
        help=IMPORT_HELP,
        formatter_class=argparse.RawTextHelpFormatter,
    )
    import_parser.add_argument(
        "url", help="URL of Git repository with DVC project to download from."
    )
    import_parser.add_argument(
        "path", help="Path to data within DVC repository."
    )
    import_parser.add_argument(
        "-o", "--out", nargs="?", help="Destination path to put data to."
    )
    import_parser.add_argument(
        "--rev", nargs="?", help="DVC repository git revision."
    )
    import_parser.set_defaults(func=CmdImport)
Beispiel #12
0
def add_parser(subparsers, parent_parser):
    DAG_HELP = "Visualize DVC project DAG."
    dag_parser = subparsers.add_parser(
        "dag",
        parents=[parent_parser],
        description=append_doc_link(DAG_HELP, "dag"),
        help=DAG_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    dag_parser.add_argument(
        "--dot",
        action="store_true",
        default=False,
        help="Print DAG with .dot format.",
    )
    dag_parser.add_argument(
        "--full",
        action="store_true",
        default=False,
        help=(
            "Show full DAG that the target belongs too, instead of "
            "showing DAG consisting only of ancestors."
        ),
    )
    dag_parser.add_argument(
        "target",
        nargs="?",
        help="Stage or output to show pipeline for (optional). "
        "Finds all stages in the workspace by default.",
    )
    dag_parser.set_defaults(func=CmdDAG)
Beispiel #13
0
def add_parser(subparsers, parent_parser):
    ADD_HELP = "Track data files or directories with DVC."

    parser = subparsers.add_parser(
        "add",
        parents=[parent_parser],
        description=append_doc_link(ADD_HELP, "add"),
        help=ADD_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    parser.add_argument(
        "-R",
        "--recursive",
        action="store_true",
        default=False,
        help="Recursively add files under directory targets.",
    )
    parser.add_argument(
        "--no-commit",
        action="store_true",
        default=False,
        help="Don't put files/directories into cache.",
    )
    parser.add_argument(
        "-f",
        "--file",
        help="Specify name of the DVC-file this command will generate.",
        metavar="<filename>",
    )
    parser.add_argument(
        "targets", nargs="+", help="Input files/directories to add."
    )
    parser.set_defaults(func=CmdAdd)
Beispiel #14
0
def add_parser(subparsers, parent_parser):
    REMOVE_HELP = "Remove DVC-file outputs."
    remove_parser = subparsers.add_parser(
        "remove",
        parents=[parent_parser],
        description=append_doc_link(REMOVE_HELP, "remove"),
        help=REMOVE_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    remove_parser_group = remove_parser.add_mutually_exclusive_group()
    remove_parser_group.add_argument(
        "-o",
        "--outs",
        action="store_true",
        default=True,
        help="Only remove DVC-file outputs. (Default)",
    )
    remove_parser_group.add_argument(
        "-p",
        "--purge",
        action="store_true",
        default=False,
        help="Remove DVC-file and all its outputs.",
    )
    remove_parser.add_argument(
        "-f",
        "--force",
        action="store_true",
        default=False,
        help="Force purge.",
    )
    remove_parser.add_argument("targets",
                               nargs="+",
                               help="DVC-files to remove.")
    remove_parser.set_defaults(func=CmdRemove)
Beispiel #15
0
def add_parser(subparsers, parent_parser):
    LIST_HELP = ("List repository contents, including files"
                 " and directories tracked by DVC and by Git.")
    list_parser = subparsers.add_parser(
        "list",
        parents=[parent_parser],
        description=append_doc_link(LIST_HELP, "list"),
        help=LIST_HELP,
        formatter_class=argparse.RawTextHelpFormatter,
    )
    list_parser.add_argument("url", help="Location of DVC repository to list")
    list_parser.add_argument(
        "-R",
        "--recursive",
        action="store_true",
        help="Recursively list files.",
    )
    list_parser.add_argument("--dvc-only",
                             action="store_true",
                             help="Show only DVC outputs.")
    list_parser.add_argument("--show-json",
                             action="store_true",
                             help="Show output in JSON format.")
    list_parser.add_argument(
        "--rev",
        nargs="?",
        help="Git revision (e.g. SHA, branch, tag)",
        metavar="<commit>",
    )
    list_parser.add_argument(
        "path",
        nargs="?",
        help="Path to directory within the repository to list outputs for",
    ).complete = completion.DIR
    list_parser.set_defaults(func=CmdList)
Beispiel #16
0
def add_parser(subparsers, parent_parser):
    DIFF_DESCRIPTION = (
        "Show diff of a data file or a directory that is under DVC control.\n"
        "Some basic statistics summary, how many files were deleted/changed.")
    DIFF_HELP = "Show a diff of a DVC controlled data file or a directory."
    diff_parser = subparsers.add_parser(
        "diff",
        parents=[parent_parser],
        description=append_doc_link(DIFF_DESCRIPTION, "diff"),
        help=DIFF_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    diff_parser.add_argument(
        "-t",
        "--target",
        default=None,
        help=("Source path to a data file or directory. Default None. "
              "If not specified, compares all files and directories "
              "that are under DVC control in the current working space."),
    )
    diff_parser.add_argument("a_ref",
                             help="Git reference from which diff calculates")
    diff_parser.add_argument(
        "b_ref",
        help=("Git reference untill which diff calculates, if omitted "
              "diff shows the difference between current HEAD and a_ref"),
        nargs="?",
        default=None,
    )
    diff_parser.set_defaults(func=CmdDiff)
Beispiel #17
0
def add_parser(subparsers, parent_parser):
    IMPORT_HELP = (
        "Download file or directory tracked by DVC or by Git "
        "into the workspace, and track it."
    )

    import_parser = subparsers.add_parser(
        "import",
        parents=[parent_parser],
        description=append_doc_link(IMPORT_HELP, "import"),
        help=IMPORT_HELP,
        formatter_class=argparse.RawTextHelpFormatter,
    )
    import_parser.add_argument(
        "url", help="Location of DVC or Git repository to download from"
    )
    import_parser.add_argument(
        "path", help="Path to a file or directory within the repository"
    )
    import_parser.add_argument(
        "-o", "--out", nargs="?", help="Destination path to download files to"
    )
    import_parser.add_argument(
        "--rev", nargs="?", help="Git revision (e.g. SHA, branch, tag)"
    )
    import_parser.set_defaults(func=CmdImport)
Beispiel #18
0
def add_parser(experiments_subparsers, parent_parser):

    EXPERIMENTS_REMOVE_HELP = "Remove experiments."
    experiments_remove_parser = experiments_subparsers.add_parser(
        "remove",
        parents=[parent_parser],
        description=append_doc_link(EXPERIMENTS_REMOVE_HELP, "exp/remove"),
        help=EXPERIMENTS_REMOVE_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    remove_group = experiments_remove_parser.add_mutually_exclusive_group()
    remove_group.add_argument("--queue",
                              action="store_true",
                              help="Remove all queued experiments.")
    remove_group.add_argument(
        "-A",
        "--all",
        action="store_true",
        help="Remove all committed experiments.",
    )
    remove_group.add_argument(
        "-g",
        "--git-remote",
        metavar="<git_remote>",
        help="Name or URL of the Git remote to remove the experiment from",
    )
    experiments_remove_parser.add_argument(
        "experiment",
        nargs="*",
        help="Experiments to remove.",
        metavar="<experiment>",
    )
    experiments_remove_parser.set_defaults(func=CmdExperimentsRemove)
Beispiel #19
0
def add_parser(subparsers, parent_parser):
    DIFF_DESCRIPTION = ("Compare two versions of the DVC repository.\n"
                        "Shows the list of paths added, modified, or deleted")
    diff_parser = subparsers.add_parser(
        "diff",
        parents=[parent_parser],
        description=append_doc_link(DIFF_DESCRIPTION, "diff"),
        help=DIFF_DESCRIPTION,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    diff_parser.add_argument(
        "a_rev",
        help="Old Git commit to compare (defaults to HEAD)",
        nargs="?",
        default="HEAD",
    )
    diff_parser.add_argument(
        "b_rev",
        help=("New Git commit to compare (defaults to the current workspace)"),
        nargs="?",
    )
    diff_parser.add_argument(
        "--show-json",
        help="Format the output into a JSON",
        action="store_true",
        default=False,
    )
    diff_parser.add_argument(
        "--checksums",
        help="Display hash value for each entry",
        action="store_true",
        default=False,
    )
    diff_parser.set_defaults(func=CmdDiff)
Beispiel #20
0
def add_parser(subparsers, parent_parser):
    CHECKOUT_HELP = "Checkout data files from cache."

    checkout_parser = subparsers.add_parser(
        "checkout",
        parents=[parent_parser],
        description=append_doc_link(CHECKOUT_HELP, "checkout"),
        help=CHECKOUT_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    checkout_parser.add_argument(
        "-d",
        "--with-deps",
        action="store_true",
        default=False,
        help="Checkout all dependencies of the specified target.",
    )
    checkout_parser.add_argument(
        "-f",
        "--force",
        action="store_true",
        default=False,
        help="Do not prompt when removing working directory files.",
    )
    checkout_parser.add_argument(
        "-R",
        "--recursive",
        action="store_true",
        default=False,
        help="Checkout all subdirectories of the specified directory.",
    )
    checkout_parser.add_argument("targets", nargs="*", help="DVC files.")
    checkout_parser.set_defaults(func=CmdCheckout)
Beispiel #21
0
def add_parser(subparsers, parent_parser):
    """Setup parser for `dvc init`."""
    INIT_HELP = "Initialize DVC in the current directory."
    INIT_DESCRIPTION = (
        "Initialize DVC in the current directory. Expects directory\n"
        "to be a Git repository unless --no-scm option is specified."
    )

    init_parser = subparsers.add_parser(
        "init",
        parents=[parent_parser],
        description=append_doc_link(INIT_DESCRIPTION, "init"),
        help=INIT_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    init_parser.add_argument(
        "--no-scm",
        action="store_true",
        default=False,
        help="Initiate dvc in directory that is "
        "not tracked by any scm tool (e.g. git).",
    )
    init_parser.add_argument(
        "-f",
        "--force",
        action="store_true",
        default=False,
        help=(
            "Overwrite existing '.dvc/' directory. "
            "This operation removes local cache."
        ),
    )
    init_parser.set_defaults(func=CmdInit)
Beispiel #22
0
def add_parser(subparsers, parent_parser):
    CONFIG_HELP = "Get or set config options."

    config_parser = subparsers.add_parser(
        "config",
        parents=[parent_config_parser, parent_parser],
        description=append_doc_link(CONFIG_HELP, "config"),
        help=CONFIG_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    config_parser.add_argument(
        "-u",
        "--unset",
        default=False,
        action="store_true",
        help="Unset option.",
    )
    config_parser.add_argument(
        "name",
        nargs="?",
        type=_name_type,
        help="Option name (section.option or remote.name.option).",
    )
    config_parser.add_argument("value", nargs="?", help="Option value.")
    config_parser.add_argument(
        "-l",
        "--list",
        default=False,
        action="store_true",
        help="List all defined config values.",
    )
    config_parser.set_defaults(func=CmdConfig)
Beispiel #23
0
def add_parser(subparsers, parent_parser):
    ADD_HELP = "Take data files or directories under DVC control."

    add_parser = subparsers.add_parser(
        "add",
        parents=[parent_parser],
        description=append_doc_link(ADD_HELP, "add"),
        help=ADD_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    add_parser.add_argument(
        "-R",
        "--recursive",
        action="store_true",
        default=False,
        help="Recursively add each file under the directory.",
    )
    add_parser.add_argument(
        "--no-commit",
        action="store_true",
        default=False,
        help="Don't put files/directories into cache.",
    )
    add_parser.add_argument(
        "-f", "--file", help="Specify name of the DVC-file it generates."
    )
    add_parser.add_argument(
        "targets", nargs="+", help="Input files/directories to add."
    )
    add_parser.set_defaults(func=CmdAdd)
Beispiel #24
0
Datei: imp_url.py Projekt: yk/dvc
def add_parser(subparsers, parent_parser):
    IMPORT_HELP = (
        "Download or copy file from URL and take it under DVC control.")

    import_parser = subparsers.add_parser(
        "import-url",
        parents=[parent_parser],
        description=append_doc_link(IMPORT_HELP, "import-url"),
        help=IMPORT_HELP,
        formatter_class=argparse.RawTextHelpFormatter,
    )
    import_parser.add_argument(
        "url",
        help="Supported urls:\n"
        "/path/to/file\n"
        "C:\\\\path\\to\\file\n"
        "https://example.com/path/to/file\n"
        "s3://bucket/path/to/file\n"
        "gs://bucket/path/to/file\n"
        "hdfs://example.com/path/to/file\n"
        "ssh://example.com:/path/to/file\n"
        "remote://myremote/path/to/file (see `dvc remote`)",
    )
    import_parser.add_argument("out",
                               nargs="?",
                               help="Destination path to put files to.")
    import_parser.add_argument(
        "-f", "--file", help="Specify name of the DVC-file it generates.")
    import_parser.set_defaults(func=CmdImportUrl)
Beispiel #25
0
def add_parser(subparsers, parent_parser):
    MOVE_HELP = "Rename or move a DVC controlled data file or a directory."
    MOVE_DESCRIPTION = (
        "Rename or move a DVC controlled data file or a directory.\n"
        "It renames and modifies the corresponding DVC-file to reflect the"
        " changes.")

    move_parser = subparsers.add_parser(
        "move",
        parents=[parent_parser],
        description=append_doc_link(MOVE_DESCRIPTION, "move"),
        help=MOVE_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    move_parser.add_argument(
        "src",
        help="Source path to a data file or directory.",
        metavar="src",
        choices=completion.Required.FILE,
    )
    move_parser.add_argument(
        "dst",
        help="Destination path.",
        metavar="dst",
        choices=completion.Required.FILE,
    )
    move_parser.set_defaults(func=CmdMove)
Beispiel #26
0
def add_parser(subparsers, parent_parser):
    GC_HELP = "Collect unused data from DVC cache or a remote storage."
    GC_DESCRIPTION = (
        "Deletes all files in the cache or a remote which are not in\n"
        "use by the specified git references (defaults to just HEAD).")
    gc_parser = subparsers.add_parser(
        "gc",
        parents=[parent_parser],
        description=append_doc_link(GC_DESCRIPTION, "gc"),
        help=GC_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    gc_parser.add_argument(
        "-a",
        "--all-branches",
        action="store_true",
        default=False,
        help="Keep data files for the tips of all git branches.",
    )
    gc_parser.add_argument(
        "-T",
        "--all-tags",
        action="store_true",
        default=False,
        help="Keep data files for all git tags.",
    )
    gc_parser.add_argument(
        "-c",
        "--cloud",
        action="store_true",
        default=False,
        help="Collect garbage in remote repository.",
    )
    gc_parser.add_argument("-r",
                           "--remote",
                           help="Remote storage to collect garbage in.")
    gc_parser.add_argument(
        "-f",
        "--force",
        action="store_true",
        default=False,
        help="Force garbage collection - automatically agree to all prompts.",
    )
    gc_parser.add_argument("-j",
                           "--jobs",
                           type=int,
                           help="Number of jobs to run simultaneously.")
    gc_parser.add_argument(
        "-p",
        "--projects",
        dest="repos",
        type=str,
        nargs="*",
        help="Keep data files required by these projects "
        "in addition to the current one. "
        "Useful if you share a single cache across repos.",
    )
    gc_parser.set_defaults(func=CmdGC)
Beispiel #27
0
def add_parser(subparsers, parent_parser):
    IMPORT_HELP = ("Download file or directory tracked by DVC or by Git "
                   "into the workspace, and track it.")

    import_parser = subparsers.add_parser(
        "import",
        parents=[parent_parser],
        description=append_doc_link(IMPORT_HELP, "import"),
        help=IMPORT_HELP,
        formatter_class=argparse.RawTextHelpFormatter,
    )
    import_parser.add_argument(
        "url", help="Location of DVC or Git repository to download from")
    import_parser.add_argument(
        "path",
        help="Path to a file or directory within the repository",
    ).complete = completion.FILE
    import_parser.add_argument(
        "-o",
        "--out",
        nargs="?",
        help="Destination path to download files to",
        metavar="<path>",
    ).complete = completion.DIR
    import_parser.add_argument(
        "--rev",
        nargs="?",
        help="Git revision (e.g. SHA, branch, tag)",
        metavar="<commit>",
    )
    import_parser.add_argument(
        "--file",
        help="Specify name of the DVC-file this command will generate.",
        metavar="<filename>",
    )
    import_parser.add_argument(
        "--no-exec",
        action="store_true",
        default=False,
        help="Only create DVC-file without actually downloading it.",
    )
    import_parser.add_argument(
        "--desc",
        type=str,
        metavar="<text>",
        help=("User description of the data (optional). "
              "This doesn't affect any DVC operations."),
    )
    import_parser.add_argument(
        "-j",
        "--jobs",
        type=int,
        help=("Number of jobs to run simultaneously. "
              "The default value is 4 * cpu_count(). "
              "For SSH remotes, the default is 4. "),
        metavar="<number>",
    )
    import_parser.set_defaults(func=CmdImport)
Beispiel #28
0
Datei: pull.py Projekt: pared/dvc
def add_parser(experiments_subparsers, parent_parser):
    EXPERIMENTS_PULL_HELP = "Pull an experiment from a Git remote."
    experiments_pull_parser = experiments_subparsers.add_parser(
        "pull",
        parents=[parent_parser],
        description=append_doc_link(EXPERIMENTS_PULL_HELP, "exp/pull"),
        help=EXPERIMENTS_PULL_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    experiments_pull_parser.add_argument(
        "-f",
        "--force",
        action="store_true",
        help="Replace local experiment already exists.",
    )
    experiments_pull_parser.add_argument(
        "--no-cache",
        action="store_false",
        dest="pull_cache",
        help=(
            "Do not pull cached outputs for this experiment from DVC remote "
            "storage."
        ),
    )
    experiments_pull_parser.add_argument(
        "-r",
        "--remote",
        dest="dvc_remote",
        metavar="<name>",
        help="Name of the DVC remote to use when pulling cached outputs.",
    )
    experiments_pull_parser.add_argument(
        "-j",
        "--jobs",
        type=int,
        metavar="<number>",
        help=(
            "Number of jobs to run simultaneously when pulling from DVC "
            "remote storage."
        ),
    )
    experiments_pull_parser.add_argument(
        "--run-cache",
        action="store_true",
        default=False,
        help="Pull run history for all stages.",
    )
    experiments_pull_parser.add_argument(
        "git_remote",
        help="Git remote name or Git URL.",
        metavar="<git_remote>",
    )
    experiments_pull_parser.add_argument(
        "experiment", help="Experiment to pull.", metavar="<experiment>"
    )
    experiments_pull_parser.set_defaults(func=CmdExperimentsPull)
Beispiel #29
0
def add_parser(experiments_subparsers, parent_parser):

    EXPERIMENTS_GC_HELP = "Garbage collect unneeded experiments."
    EXPERIMENTS_GC_DESCRIPTION = (
        "Removes all experiments which are not derived from the specified"
        "Git revisions.")
    experiments_gc_parser = experiments_subparsers.add_parser(
        "gc",
        parents=[parent_parser],
        description=append_doc_link(EXPERIMENTS_GC_DESCRIPTION, "exp/gc"),
        help=EXPERIMENTS_GC_HELP,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    experiments_gc_parser.add_argument(
        "-w",
        "--workspace",
        action="store_true",
        default=False,
        help="Keep experiments derived from the current workspace.",
    )
    experiments_gc_parser.add_argument(
        "-a",
        "--all-branches",
        action="store_true",
        default=False,
        help="Keep experiments derived from the tips of all Git branches.",
    )
    experiments_gc_parser.add_argument(
        "-T",
        "--all-tags",
        action="store_true",
        default=False,
        help="Keep experiments derived from all Git tags.",
    )
    experiments_gc_parser.add_argument(
        "-A",
        "--all-commits",
        action="store_true",
        default=False,
        help="Keep experiments derived from all Git commits.",
    )
    experiments_gc_parser.add_argument(
        "--queued",
        action="store_true",
        default=False,
        help=("Keep queued experiments (experiments run queue will be cleared "
              "by default)."),
    )
    experiments_gc_parser.add_argument(
        "-f",
        "--force",
        action="store_true",
        default=False,
        help="Force garbage collection - automatically agree to all prompts.",
    )
    experiments_gc_parser.set_defaults(func=CmdExperimentsGC)
Beispiel #30
0
def add_parser(subparsers, parent_parser):
    DIFF_DESCRIPTION = (
        "Show added, modified, or deleted data between commits in the DVC"
        " repository, or between a commit and the workspace."
    )
    diff_parser = subparsers.add_parser(
        "diff",
        parents=[parent_parser],
        description=append_doc_link(DIFF_DESCRIPTION, "diff"),
        help=DIFF_DESCRIPTION,
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    diff_parser.add_argument(
        "--targets",
        nargs="*",
        help=(
            "Specific DVC-tracked files to compare. "
            "Accepts one or more file paths."
        ),
        metavar="<paths>",
    ).complete = completion.FILE
    diff_parser.add_argument(
        "a_rev",
        help="Old Git commit to compare (defaults to HEAD)",
        nargs="?",
        default="HEAD",
    )
    diff_parser.add_argument(
        "b_rev",
        help=("New Git commit to compare (defaults to the current workspace)"),
        nargs="?",
    )
    diff_parser.add_argument(
        "--show-json",
        help="Format the output into a JSON",
        action="store_true",
        default=False,
    )
    diff_parser.add_argument(
        "--show-hash",
        help="Display hash value for each entry",
        action="store_true",
        default=False,
    )
    diff_parser.add_argument(
        "--show-md",
        help="Show tabulated output in the Markdown format (GFM).",
        action="store_true",
        default=False,
    )
    diff_parser.add_argument(
        "--hide-missing",
        help="Hide missing cache file status.",
        action="store_true",
    )
    diff_parser.set_defaults(func=CmdDiff)