diff --git a/dvc/commands/repro.py b/dvc/commands/repro.py index 137f36832..b5a95749b 100644 --- a/dvc/commands/repro.py +++ b/dvc/commands/repro.py @@ -66,6 +66,13 @@ def add_arguments(repro_parser): default=False, help="Reproduce even if dependencies were not changed.", ) + repro_parser.add_argument( + "-i", + "--interactive", + action="store_true", + default=False, + help="Ask for confirmation before reproducing each stage.", + ) repro_parser.add_argument( "-s", "--single-item", @@ -74,27 +81,6 @@ def add_arguments(repro_parser): help="Reproduce only single data item without recursive dependencies " "check.", ) - repro_parser.add_argument( - "-m", - "--metrics", - action="store_true", - default=False, - help="Show metrics after reproduction.", - ) - repro_parser.add_argument( - "--dry", - action="store_true", - default=False, - help="Only print the commands that would be executed without " - "actually executing.", - ) - repro_parser.add_argument( - "-i", - "--interactive", - action="store_true", - default=False, - help="Ask for confirmation before reproducing each stage.", - ) repro_parser.add_argument( "-p", "--pipeline", @@ -118,11 +104,11 @@ def add_arguments(repro_parser): help="Reproduce all stages in the specified directory.", ) repro_parser.add_argument( - "--force-downstream", + "-m", + "--metrics", action="store_true", default=False, - help="Reproduce all descendants of a changed stage even if their " - "direct dependencies didn't change.", + help="Show metrics after reproduction.", ) repro_parser.add_argument( "--downstream", @@ -130,6 +116,13 @@ def add_arguments(repro_parser): default=False, help="Start from the specified stages when reproducing pipelines.", ) + repro_parser.add_argument( + "--force-downstream", + action="store_true", + default=False, + help="Reproduce all descendants of a changed stage even if their " + "direct dependencies didn't change.", + ) repro_parser.add_argument( "--pull", action="store_true", @@ -139,6 +132,13 @@ def add_arguments(repro_parser): "from the run-cache." ), ) + repro_parser.add_argument( + "--dry", + action="store_true", + default=False, + help="Only print the commands that would be executed without " + "actually executing.", + ) def add_parser(subparsers, parent_parser): @@ -156,13 +156,10 @@ def add_parser(subparsers, parent_parser): add_arguments(repro_parser) # repro only args repro_parser.add_argument( - "--no-run-cache", + "--glob", action="store_true", default=False, - help=( - "Execute stage commands even if they have already been run with " - "the same command/dependencies/outputs/etc before." - ), + help="Allows targets containing shell-style wildcards.", ) repro_parser.add_argument( "--no-commit", @@ -171,9 +168,12 @@ def add_parser(subparsers, parent_parser): help="Don't put files/directories into cache.", ) repro_parser.add_argument( - "--glob", + "--no-run-cache", action="store_true", default=False, - help="Allows targets containing shell-style wildcards.", + help=( + "Execute stage commands even if they have already been run with " + "the same command/dependencies/outputs/etc before." + ), ) repro_parser.set_defaults(func=CmdRepro) diff --git a/dvc/commands/run.py b/dvc/commands/run.py index 8dcb43bb0..bc17e4ad5 100644 --- a/dvc/commands/run.py +++ b/dvc/commands/run.py @@ -69,12 +69,25 @@ def add_parser(subparsers, parent_parser): run_parser.add_argument( "--file", metavar="", help=argparse.SUPPRESS ) + run_parser.add_argument( + "--single-stage", + action="store_true", + default=False, + help=argparse.SUPPRESS, + ) + _add_common_args(run_parser) run_parser.add_argument( "--no-exec", action="store_true", default=False, help="Only create dvc.yaml without actually running it.", ) + run_parser.add_argument( + "--no-commit", + action="store_true", + default=False, + help="Don't put files/directories into cache.", + ) run_parser.add_argument( "--no-run-cache", action="store_true", @@ -84,17 +97,4 @@ def add_parser(subparsers, parent_parser): "with the same command/dependencies/outputs/etc before." ), ) - run_parser.add_argument( - "--no-commit", - action="store_true", - default=False, - help="Don't put files/directories into cache.", - ) - run_parser.add_argument( - "--single-stage", - action="store_true", - default=False, - help=argparse.SUPPRESS, - ) - _add_common_args(run_parser) run_parser.set_defaults(func=CmdRun) diff --git a/dvc/commands/stage.py b/dvc/commands/stage.py index 90b1234c3..23db60d65 100644 --- a/dvc/commands/stage.py +++ b/dvc/commands/stage.py @@ -137,6 +137,13 @@ class CmdStageAdd(CmdBase): def _add_common_args(parser): + parser.add_argument( + "-f", + "--force", + action="store_true", + default=False, + help="Overwrite existing stage", + ) parser.add_argument( "-d", "--deps", @@ -145,6 +152,14 @@ def _add_common_args(parser): help="Declare dependencies for reproducible cmd.", metavar="", ).complete = completion.FILE + parser.add_argument( + "-p", + "--params", + action="append", + default=[], + help="Declare parameter to use as additional dependency.", + metavar="[:]", + ).complete = completion.FILE parser.add_argument( "-o", "--outs", @@ -163,13 +178,36 @@ def _add_common_args(parser): metavar="", ).complete = completion.FILE parser.add_argument( - "-p", - "--params", + "-c", + "--checkpoints", action="append", default=[], - help="Declare parameter to use as additional dependency.", - metavar="[:]", + help="Declare checkpoint output file or directory for 'dvc exp run'. " + "Not compatible with 'dvc repro'.", + metavar="", ).complete = completion.FILE + parser.add_argument( + "--external", + action="store_true", + default=False, + help="Allow outputs that are outside of the DVC repository.", + ) + parser.add_argument( + "--outs-persist", + action="append", + default=[], + help="Declare output file or directory that will not be " + "removed upon repro.", + metavar="", + ) + parser.add_argument( + "--outs-persist-no-cache", + action="append", + default=[], + help="Declare output file or directory that will not be " + "removed upon repro (do not put into DVC cache).", + metavar="", + ) parser.add_argument( "-m", "--metrics", @@ -226,50 +264,12 @@ def _add_common_args(parser): help="Directory within your repo to run your command in.", metavar="", ) - parser.add_argument( - "-f", - "--force", - action="store_true", - default=False, - help="Overwrite existing stage", - ) - parser.add_argument( - "--outs-persist", - action="append", - default=[], - help="Declare output file or directory that will not be " - "removed upon repro.", - metavar="", - ) - parser.add_argument( - "--outs-persist-no-cache", - action="append", - default=[], - help="Declare output file or directory that will not be " - "removed upon repro (do not put into DVC cache).", - metavar="", - ) - parser.add_argument( - "-c", - "--checkpoints", - action="append", - default=[], - help="Declare checkpoint output file or directory for 'dvc exp run'. " - "Not compatible with 'dvc repro'.", - metavar="", - ).complete = completion.FILE parser.add_argument( "--always-changed", action="store_true", default=False, help="Always consider this DVC-file as changed.", ) - parser.add_argument( - "--external", - action="store_true", - default=False, - help="Allow outputs that are outside of the DVC repository.", - ) parser.add_argument( "--desc", type=str,