prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Feature proposal: `dvc artifacts get --show-url`
  DVC currently supports `dvc get --show-url` as a way to retrieve just the URL of a DVC-versioned object as opposed to the object itself.
  
  However, there is no equivalent for `dvc artifacts get`. This came as a customer request (to allow easier sharing of results even to people who are not DVC/DVC Studio users). It also has advantages e.g. in model deployment to Sagemaker (which requires the artifact URL on S3).
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `dvc/commands/artifacts.py`
  Content:
  ```
  1 from dvc.cli import completion, formatter
  2 from dvc.cli.command import CmdBaseNoRepo
  3 from dvc.cli.utils import DictAction, append_doc_link
  4 from dvc.exceptions import DvcException
  5 from dvc.log import logger
  6 
  7 logger = logger.getChild(__name__)
  8 
  9 
  10 class CmdArtifactsGet(CmdBaseNoRepo):
  11     def run(self):
  12         from dvc.repo.artifacts import Artifacts
  13         from dvc.scm import CloneError
  14         from dvc.ui import ui
  15 
  16         try:
  17             count, out = Artifacts.get(
  18                 self.args.url,
  19                 name=self.args.name,
  20                 version=self.args.rev,
  21                 stage=self.args.stage,
  22                 force=self.args.force,
  23                 config=self.args.config,
  24                 remote=self.args.remote,
  25                 remote_config=self.args.remote_config,
  26                 out=self.args.out,
  27             )
  28             ui.write(f"Downloaded {count} file(s) to '{out}'")
  29             return 0
  30         except CloneError:
  31             logger.exception("failed to get '%s'", self.args.name)
  32             return 1
  33         except DvcException:
  34             logger.exception(
  35                 "failed to get '%s' from '%s'", self.args.name, self.args.url
  36             )
  37             return 1
  38 
  39 
  40 def add_parser(subparsers, parent_parser):
  41     ARTIFACTS_HELP = "DVC model registry artifact commands."
  42 
  43     artifacts_parser = subparsers.add_parser(
  44         "artifacts",
  45         parents=[parent_parser],
  46         description=append_doc_link(ARTIFACTS_HELP, "artifacts"),
  47         help=ARTIFACTS_HELP,
  48         formatter_class=formatter.RawDescriptionHelpFormatter,
  49     )
  50     artifacts_subparsers = artifacts_parser.add_subparsers(
  51         dest="cmd",
  52         help="Use `dvc artifacts CMD --help` to display command-specific help.",
  53         required=True,
  54     )
  55 
  56     ARTIFACTS_GET_HELP = "Download an artifact from a DVC project."
  57     get_parser = artifacts_subparsers.add_parser(
  58         "get",
  59         parents=[parent_parser],
  60         description=append_doc_link(ARTIFACTS_GET_HELP, "artifacts/get"),
  61         help=ARTIFACTS_HELP,
  62         formatter_class=formatter.RawDescriptionHelpFormatter,
  63     )
  64     get_parser.add_argument("url", help="Location of DVC repository to download from")
  65     get_parser.add_argument(
  66         "name", help="Name of artifact in the repository"
  67     ).complete = completion.FILE
  68     get_parser.add_argument(
  69         "--rev",
  70         nargs="?",
  71         help="Artifact version",
  72         metavar="<version>",
  73     )
  74     get_parser.add_argument(
  75         "--stage",
  76         nargs="?",
  77         help="Artifact stage",
  78         metavar="<stage>",
  79     )
  80     get_parser.add_argument(
  81         "-o",
  82         "--out",
  83         nargs="?",
  84         help="Destination path to download artifact to",
  85         metavar="<path>",
  86     ).complete = completion.DIR
  87     get_parser.add_argument(
  88         "-j",
  89         "--jobs",
  90         type=int,
  91         help=(
  92             "Number of jobs to run simultaneously. "
  93             "The default value is 4 * cpu_count(). "
  94         ),
  95         metavar="<number>",
  96     )
  97     get_parser.add_argument(
  98         "-f",
  99         "--force",
  100         action="store_true",
  101         default=False,
  102         help="Override local file or folder if exists.",
  103     )
  104     get_parser.add_argument(
  105         "--config",
  106         type=str,
  107         help=(
  108             "Path to a config file that will be merged with the config "
  109             "in the target repository."
  110         ),
  111     )
  112     get_parser.add_argument(
  113         "--remote",
  114         type=str,
  115         help=(
  116             "Remote name to set as a default in the target repository "
  117             "(only applicable when downloading from DVC remote)."
  118         ),
  119     )
  120     get_parser.add_argument(
  121         "--remote-config",
  122         type=str,
  123         nargs="*",
  124         action=DictAction,
  125         help=(
  126             "Remote config options to merge with a remote's config (default or one "
  127             "specified by '--remote') in the target repository (only applicable "
  128             "when downloading from DVC remote)."
  129         ),
  130     )
  131     get_parser.set_defaults(func=CmdArtifactsGet)
  132
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/dvc/commands/artifacts.py b/dvc/commands/artifacts.py
  --- a/dvc/commands/artifacts.py
  +++ b/dvc/commands/artifacts.py
  @@ -13,6 +13,9 @@
           from dvc.scm import CloneError
           from dvc.ui import ui
   
  +        if self.args.show_url:
  +            return self._show_url()
  +
           try:
               count, out = Artifacts.get(
                   self.args.url,
  @@ -36,6 +39,28 @@
               )
               return 1
   
  +    def _show_url(self):
  +        from dvc.api import artifacts_show, get_url
  +        from dvc.ui import ui
  +
  +        artifact = artifacts_show(
  +            self.args.name,
  +            version=self.args.rev,
  +            stage=self.args.stage,
  +            repo=self.args.url,
  +        )
  +
  +        url = get_url(
  +            artifact["path"],
  +            repo=self.args.url,
  +            rev=artifact["rev"],
  +            remote=self.args.remote,
  +            remote_config=self.args.remote_config,
  +        )
  +        ui.write(url, force=True)
  +
  +        return 0
  +
   
   def add_parser(subparsers, parent_parser):
       ARTIFACTS_HELP = "DVC model registry artifact commands."
  @@ -84,6 +109,14 @@
           help="Destination path to download artifact to",
           metavar="<path>",
       ).complete = completion.DIR
  +    get_parser.add_argument(
  +        "--show-url",
  +        action="store_true",
  +        help=(
  +            "Print the storage location (URL) the target data would be "
  +            "downloaded from, and exit."
  +        ),
  +    )
       get_parser.add_argument(
           "-j",
           "--jobs",
  
verification_info: {"golden_diff": "diff --git a/dvc/commands/artifacts.py b/dvc/commands/artifacts.py\n--- a/dvc/commands/artifacts.py\n+++ b/dvc/commands/artifacts.py\n@@ -13,6 +13,9 @@\n         from dvc.scm import CloneError\n         from dvc.ui import ui\n \n+        if self.args.show_url:\n+            return self._show_url()\n+\n         try:\n             count, out = Artifacts.get(\n                 self.args.url,\n@@ -36,6 +39,28 @@\n             )\n             return 1\n \n+    def _show_url(self):\n+        from dvc.api import artifacts_show, get_url\n+        from dvc.ui import ui\n+\n+        artifact = artifacts_show(\n+            self.args.name,\n+            version=self.args.rev,\n+            stage=self.args.stage,\n+            repo=self.args.url,\n+        )\n+\n+        url = get_url(\n+            artifact[\"path\"],\n+            repo=self.args.url,\n+            rev=artifact[\"rev\"],\n+            remote=self.args.remote,\n+            remote_config=self.args.remote_config,\n+        )\n+        ui.write(url, force=True)\n+\n+        return 0\n+\n \n def add_parser(subparsers, parent_parser):\n     ARTIFACTS_HELP = \"DVC model registry artifact commands.\"\n@@ -84,6 +109,14 @@\n         help=\"Destination path to download artifact to\",\n         metavar=\"<path>\",\n     ).complete = completion.DIR\n+    get_parser.add_argument(\n+        \"--show-url\",\n+        action=\"store_true\",\n+        help=(\n+            \"Print the storage location (URL) the target data would be \"\n+            \"downloaded from, and exit.\"\n+        ),\n+    )\n     get_parser.add_argument(\n         \"-j\",\n         \"--jobs\",\n", "issue": "Feature proposal: `dvc artifacts get --show-url`\nDVC currently supports `dvc get --show-url` as a way to retrieve just the URL of a DVC-versioned object as opposed to the object itself.\r\n\r\nHowever, there is no equivalent for `dvc artifacts get`. This came as a customer request (to allow easier sharing of results even to people who are not DVC/DVC Studio users). It also has advantages e.g. in model deployment to Sagemaker (which requires the artifact URL on S3).\n", "before_files": [{"content": "from dvc.cli import completion, formatter\nfrom dvc.cli.command import CmdBaseNoRepo\nfrom dvc.cli.utils import DictAction, append_doc_link\nfrom dvc.exceptions import DvcException\nfrom dvc.log import logger\n\nlogger = logger.getChild(__name__)\n\n\nclass CmdArtifactsGet(CmdBaseNoRepo):\n    def run(self):\n        from dvc.repo.artifacts import Artifacts\n        from dvc.scm import CloneError\n        from dvc.ui import ui\n\n        try:\n            count, out = Artifacts.get(\n                self.args.url,\n                name=self.args.name,\n                version=self.args.rev,\n                stage=self.args.stage,\n                force=self.args.force,\n                config=self.args.config,\n                remote=self.args.remote,\n                remote_config=self.args.remote_config,\n                out=self.args.out,\n            )\n            ui.write(f\"Downloaded {count} file(s) to '{out}'\")\n            return 0\n        except CloneError:\n            logger.exception(\"failed to get '%s'\", self.args.name)\n            return 1\n        except DvcException:\n            logger.exception(\n                \"failed to get '%s' from '%s'\", self.args.name, self.args.url\n            )\n            return 1\n\n\ndef add_parser(subparsers, parent_parser):\n    ARTIFACTS_HELP = \"DVC model registry artifact commands.\"\n\n    artifacts_parser = subparsers.add_parser(\n        \"artifacts\",\n        parents=[parent_parser],\n        description=append_doc_link(ARTIFACTS_HELP, \"artifacts\"),\n        help=ARTIFACTS_HELP,\n        formatter_class=formatter.RawDescriptionHelpFormatter,\n    )\n    artifacts_subparsers = artifacts_parser.add_subparsers(\n        dest=\"cmd\",\n        help=\"Use `dvc artifacts CMD --help` to display command-specific help.\",\n        required=True,\n    )\n\n    ARTIFACTS_GET_HELP = \"Download an artifact from a DVC project.\"\n    get_parser = artifacts_subparsers.add_parser(\n        \"get\",\n        parents=[parent_parser],\n        description=append_doc_link(ARTIFACTS_GET_HELP, \"artifacts/get\"),\n        help=ARTIFACTS_HELP,\n        formatter_class=formatter.RawDescriptionHelpFormatter,\n    )\n    get_parser.add_argument(\"url\", help=\"Location of DVC repository to download from\")\n    get_parser.add_argument(\n        \"name\", help=\"Name of artifact in the repository\"\n    ).complete = completion.FILE\n    get_parser.add_argument(\n        \"--rev\",\n        nargs=\"?\",\n        help=\"Artifact version\",\n        metavar=\"<version>\",\n    )\n    get_parser.add_argument(\n        \"--stage\",\n        nargs=\"?\",\n        help=\"Artifact stage\",\n        metavar=\"<stage>\",\n    )\n    get_parser.add_argument(\n        \"-o\",\n        \"--out\",\n        nargs=\"?\",\n        help=\"Destination path to download artifact to\",\n        metavar=\"<path>\",\n    ).complete = completion.DIR\n    get_parser.add_argument(\n        \"-j\",\n        \"--jobs\",\n        type=int,\n        help=(\n            \"Number of jobs to run simultaneously. \"\n            \"The default value is 4 * cpu_count(). \"\n        ),\n        metavar=\"<number>\",\n    )\n    get_parser.add_argument(\n        \"-f\",\n        \"--force\",\n        action=\"store_true\",\n        default=False,\n        help=\"Override local file or folder if exists.\",\n    )\n    get_parser.add_argument(\n        \"--config\",\n        type=str,\n        help=(\n            \"Path to a config file that will be merged with the config \"\n            \"in the target repository.\"\n        ),\n    )\n    get_parser.add_argument(\n        \"--remote\",\n        type=str,\n        help=(\n            \"Remote name to set as a default in the target repository \"\n            \"(only applicable when downloading from DVC remote).\"\n        ),\n    )\n    get_parser.add_argument(\n        \"--remote-config\",\n        type=str,\n        nargs=\"*\",\n        action=DictAction,\n        help=(\n            \"Remote config options to merge with a remote's config (default or one \"\n            \"specified by '--remote') in the target repository (only applicable \"\n            \"when downloading from DVC remote).\"\n        ),\n    )\n    get_parser.set_defaults(func=CmdArtifactsGet)\n", "path": "dvc/commands/artifacts.py"}], "after_files": [{"content": "from dvc.cli import completion, formatter\nfrom dvc.cli.command import CmdBaseNoRepo\nfrom dvc.cli.utils import DictAction, append_doc_link\nfrom dvc.exceptions import DvcException\nfrom dvc.log import logger\n\nlogger = logger.getChild(__name__)\n\n\nclass CmdArtifactsGet(CmdBaseNoRepo):\n    def run(self):\n        from dvc.repo.artifacts import Artifacts\n        from dvc.scm import CloneError\n        from dvc.ui import ui\n\n        if self.args.show_url:\n            return self._show_url()\n\n        try:\n            count, out = Artifacts.get(\n                self.args.url,\n                name=self.args.name,\n                version=self.args.rev,\n                stage=self.args.stage,\n                force=self.args.force,\n                config=self.args.config,\n                remote=self.args.remote,\n                remote_config=self.args.remote_config,\n                out=self.args.out,\n            )\n            ui.write(f\"Downloaded {count} file(s) to '{out}'\")\n            return 0\n        except CloneError:\n            logger.exception(\"failed to get '%s'\", self.args.name)\n            return 1\n        except DvcException:\n            logger.exception(\n                \"failed to get '%s' from '%s'\", self.args.name, self.args.url\n            )\n            return 1\n\n    def _show_url(self):\n        from dvc.api import artifacts_show, get_url\n        from dvc.ui import ui\n\n        artifact = artifacts_show(\n            self.args.name,\n            version=self.args.rev,\n            stage=self.args.stage,\n            repo=self.args.url,\n        )\n\n        url = get_url(\n            artifact[\"path\"],\n            repo=self.args.url,\n            rev=artifact[\"rev\"],\n            remote=self.args.remote,\n            remote_config=self.args.remote_config,\n        )\n        ui.write(url, force=True)\n\n        return 0\n\n\ndef add_parser(subparsers, parent_parser):\n    ARTIFACTS_HELP = \"DVC model registry artifact commands.\"\n\n    artifacts_parser = subparsers.add_parser(\n        \"artifacts\",\n        parents=[parent_parser],\n        description=append_doc_link(ARTIFACTS_HELP, \"artifacts\"),\n        help=ARTIFACTS_HELP,\n        formatter_class=formatter.RawDescriptionHelpFormatter,\n    )\n    artifacts_subparsers = artifacts_parser.add_subparsers(\n        dest=\"cmd\",\n        help=\"Use `dvc artifacts CMD --help` to display command-specific help.\",\n        required=True,\n    )\n\n    ARTIFACTS_GET_HELP = \"Download an artifact from a DVC project.\"\n    get_parser = artifacts_subparsers.add_parser(\n        \"get\",\n        parents=[parent_parser],\n        description=append_doc_link(ARTIFACTS_GET_HELP, \"artifacts/get\"),\n        help=ARTIFACTS_HELP,\n        formatter_class=formatter.RawDescriptionHelpFormatter,\n    )\n    get_parser.add_argument(\"url\", help=\"Location of DVC repository to download from\")\n    get_parser.add_argument(\n        \"name\", help=\"Name of artifact in the repository\"\n    ).complete = completion.FILE\n    get_parser.add_argument(\n        \"--rev\",\n        nargs=\"?\",\n        help=\"Artifact version\",\n        metavar=\"<version>\",\n    )\n    get_parser.add_argument(\n        \"--stage\",\n        nargs=\"?\",\n        help=\"Artifact stage\",\n        metavar=\"<stage>\",\n    )\n    get_parser.add_argument(\n        \"-o\",\n        \"--out\",\n        nargs=\"?\",\n        help=\"Destination path to download artifact to\",\n        metavar=\"<path>\",\n    ).complete = completion.DIR\n    get_parser.add_argument(\n        \"--show-url\",\n        action=\"store_true\",\n        help=(\n            \"Print the storage location (URL) the target data would be \"\n            \"downloaded from, and exit.\"\n        ),\n    )\n    get_parser.add_argument(\n        \"-j\",\n        \"--jobs\",\n        type=int,\n        help=(\n            \"Number of jobs to run simultaneously. \"\n            \"The default value is 4 * cpu_count(). \"\n        ),\n        metavar=\"<number>\",\n    )\n    get_parser.add_argument(\n        \"-f\",\n        \"--force\",\n        action=\"store_true\",\n        default=False,\n        help=\"Override local file or folder if exists.\",\n    )\n    get_parser.add_argument(\n        \"--config\",\n        type=str,\n        help=(\n            \"Path to a config file that will be merged with the config \"\n            \"in the target repository.\"\n        ),\n    )\n    get_parser.add_argument(\n        \"--remote\",\n        type=str,\n        help=(\n            \"Remote name to set as a default in the target repository \"\n            \"(only applicable when downloading from DVC remote).\"\n        ),\n    )\n    get_parser.add_argument(\n        \"--remote-config\",\n        type=str,\n        nargs=\"*\",\n        action=DictAction,\n        help=(\n            \"Remote config options to merge with a remote's config (default or one \"\n            \"specified by '--remote') in the target repository (only applicable \"\n            \"when downloading from DVC remote).\"\n        ),\n    )\n    get_parser.set_defaults(func=CmdArtifactsGet)\n", "path": "dvc/commands/artifacts.py"}]}