| 1 | # SPDX-License-Identifier: Apache-2.0 |
| 2 | # SPDX-FileCopyrightText: Copyright contributors to the vLLM project |
| 3 | |
| 4 | import argparse |
| 5 | import typing |
| 6 | |
| 7 | from vllm.collect_env import main as collect_env_main |
| 8 | from vllm.entrypoints.cli.types import CLISubcommand |
| 9 | |
| 10 | if typing.TYPE_CHECKING: |
| 11 | from vllm.utils.argparse_utils import FlexibleArgumentParser |
| 12 | else: |
| 13 | FlexibleArgumentParser = argparse.ArgumentParser |
| 14 | |
| 15 | |
| 16 | class CollectEnvSubcommand(CLISubcommand): |
| 17 | """The `collect-env` subcommand for the vLLM CLI.""" |
| 18 | |
| 19 | name = "collect-env" |
| 20 | |
| 21 | @staticmethod |
| 22 | def cmd(args: argparse.Namespace) -> None: |
| 23 | """Collect information about the environment.""" |
| 24 | collect_env_main() |
| 25 | |
| 26 | def subparser_init( |
| 27 | self, subparsers: argparse._SubParsersAction |
| 28 | ) -> FlexibleArgumentParser: |
| 29 | return subparsers.add_parser( |
| 30 | "collect-env", |
| 31 | help="Start collecting environment information.", |
| 32 | description="Start collecting environment information.", |
| 33 | usage="vllm collect-env", |
| 34 | ) |
| 35 | |
| 36 | |
| 37 | def cmd_init() -> list[CLISubcommand]: |
| 38 | return [CollectEnvSubcommand()] |