compshare-cli 0.3.5__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. {compshare_cli-0.3.5/src/compshare_cli.egg-info → compshare_cli-0.4.0}/PKG-INFO +18 -3
  2. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/README.md +16 -1
  3. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/pyproject.toml +1 -1
  4. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/__init__.py +1 -1
  5. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/actions.py +17 -2
  6. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/cli.py +48 -10
  7. compshare_cli-0.4.0/src/compshare_cli/commands/bandwidth.py +452 -0
  8. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/commands/common.py +6 -1
  9. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/commands/feedback.py +1 -1
  10. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/commands/instance.py +7 -19
  11. compshare_cli-0.4.0/src/compshare_cli/commands/minimax.py +428 -0
  12. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/i18n.py +119 -3
  13. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/insights.py +63 -56
  14. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/location.py +29 -2
  15. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/sdk.py +11 -3
  16. {compshare_cli-0.3.5 → compshare_cli-0.4.0/src/compshare_cli.egg-info}/PKG-INFO +18 -3
  17. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli.egg-info/SOURCES.txt +4 -0
  18. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/tests/test_actions.py +5 -3
  19. compshare_cli-0.4.0/tests/test_bandwidth.py +273 -0
  20. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/tests/test_cli.py +4 -2
  21. compshare_cli-0.4.0/tests/test_feedback.py +202 -0
  22. compshare_cli-0.4.0/tests/test_minimax.py +287 -0
  23. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/tests/test_sdk.py +24 -0
  24. compshare_cli-0.3.5/tests/test_feedback.py +0 -159
  25. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/LICENSE +0 -0
  26. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/setup.cfg +0 -0
  27. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/__main__.py +0 -0
  28. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/api.py +0 -0
  29. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/commands/__init__.py +0 -0
  30. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/commands/ask.py +0 -0
  31. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/commands/doctor.py +0 -0
  32. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/commands/image.py +0 -0
  33. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/commands/storage.py +0 -0
  34. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/commands/team.py +0 -0
  35. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/config.py +0 -0
  36. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/errors.py +0 -0
  37. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/instance_templates.py +0 -0
  38. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/output.py +0 -0
  39. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/parsing.py +0 -0
  40. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/qa.py +0 -0
  41. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/remote_jobs.py +0 -0
  42. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/runtime.py +0 -0
  43. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/ssh.py +0 -0
  44. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli/ssh_cache.py +0 -0
  45. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli.egg-info/dependency_links.txt +0 -0
  46. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli.egg-info/entry_points.txt +0 -0
  47. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli.egg-info/requires.txt +0 -0
  48. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/src/compshare_cli.egg-info/top_level.txt +0 -0
  49. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/tests/test_api.py +0 -0
  50. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/tests/test_config.py +0 -0
  51. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/tests/test_instance_templates.py +0 -0
  52. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/tests/test_location.py +0 -0
  53. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/tests/test_output.py +0 -0
  54. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/tests/test_parsing.py +0 -0
  55. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/tests/test_qa.py +0 -0
  56. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/tests/test_release_version.py +0 -0
  57. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/tests/test_remote_jobs.py +0 -0
  58. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/tests/test_ssh.py +0 -0
  59. {compshare_cli-0.3.5 → compshare_cli-0.4.0}/tests/test_ssh_cache.py +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compshare-cli
3
- Version: 0.3.5
4
- Summary: Command-line client for CompShare GPU compute
3
+ Version: 0.4.0
4
+ Summary: Command-line client for CompShare GPU compute and MiniMax H3
5
5
  Author: CompShare
6
6
  License-Expression: Apache-2.0
7
7
  Project-URL: Homepage, https://github.com/BennielAllan/compshare-cli
@@ -25,12 +25,14 @@ Dynamic: license-file
25
25
 
26
26
  # CompShare CLI
27
27
 
28
- 在终端管理优云智算 GPU 实例、镜像、云盘、US3 挂载和团队资源。
28
+ 在终端管理优云智算 GPU 实例、镜像、云盘、US3 挂载、独享带宽、团队资源和 MiniMax H3 视频任务。
29
29
 
30
30
  - 交互式创建实例,实时查询规格、库存和价格
31
31
  - 支持批量生命周期操作、等待状态和跨地域查询
32
32
  - 支持可断线恢复的远程任务、状态查询和增量日志读取
33
33
  - 支持社区/自定义镜像、云盘、团队额度与账单
34
+ - 支持独享带宽询价、购买、改配、退款预估及实例 EIP 切换
35
+ - 支持创建、查询和取消 MiniMax H3 视频任务,并查看积分套餐包与余额
34
36
  - 默认中文帮助,可切换英文;所有命令支持 JSON 输出
35
37
  - 可通过 `compshare ask` 查询产品使用和计费知识
36
38
  - 可通过 `compshare feedback` 反馈 CLI 问题和建议
@@ -61,8 +63,14 @@ compshare --profile production instance list
61
63
  ```bash
62
64
  export COMPSHARE_PUBLIC_KEY='...'
63
65
  export COMPSHARE_PRIVATE_KEY='...'
66
+
67
+ # MiniMax H3 使用独立的模型 API Key
68
+ export COMPSHARE_MINIMAX_API_KEY='sk-ml-...'
64
69
  ```
65
70
 
71
+ CLI 使用统计和反馈与业务 API 一样,通过当前 profile 的凭证签名后发送到
72
+ `https://api.compshare.cn/`;开发环境可使用 `COMPSHARE_INSIGHTS_URL` 覆盖网关地址。
73
+
66
74
  ## 快速开始
67
75
 
68
76
  ```bash
@@ -74,6 +82,11 @@ compshare instance list --all
74
82
  # 连接实例
75
83
  compshare instance ssh INSTANCE_ID
76
84
 
85
+ # MiniMax H3:先预演,再创建
86
+ compshare --json minimax create '一只猫在海边奔跑' --dry-run
87
+ compshare --json minimax create '一只猫在海边奔跑' --yes
88
+ compshare --json minimax points
89
+
77
90
  # 查看帮助
78
91
  compshare -h
79
92
  compshare instance -h
@@ -89,6 +102,8 @@ compshare ask 产品使用和计费问答
89
102
  compshare instance GPU 实例、规格、库存、价格和生命周期
90
103
  compshare image 平台、自定义、社区及共享镜像
91
104
  compshare storage 云盘和 US3 挂载
105
+ compshare bandwidth 独享带宽和实例 EIP 带宽归属
106
+ compshare minimax MiniMax H3 视频任务和积分
92
107
  compshare team 团队、邀请、成员额度、账单和审计
93
108
  ```
94
109
 
@@ -1,11 +1,13 @@
1
1
  # CompShare CLI
2
2
 
3
- 在终端管理优云智算 GPU 实例、镜像、云盘、US3 挂载和团队资源。
3
+ 在终端管理优云智算 GPU 实例、镜像、云盘、US3 挂载、独享带宽、团队资源和 MiniMax H3 视频任务。
4
4
 
5
5
  - 交互式创建实例,实时查询规格、库存和价格
6
6
  - 支持批量生命周期操作、等待状态和跨地域查询
7
7
  - 支持可断线恢复的远程任务、状态查询和增量日志读取
8
8
  - 支持社区/自定义镜像、云盘、团队额度与账单
9
+ - 支持独享带宽询价、购买、改配、退款预估及实例 EIP 切换
10
+ - 支持创建、查询和取消 MiniMax H3 视频任务,并查看积分套餐包与余额
9
11
  - 默认中文帮助,可切换英文;所有命令支持 JSON 输出
10
12
  - 可通过 `compshare ask` 查询产品使用和计费知识
11
13
  - 可通过 `compshare feedback` 反馈 CLI 问题和建议
@@ -36,8 +38,14 @@ compshare --profile production instance list
36
38
  ```bash
37
39
  export COMPSHARE_PUBLIC_KEY='...'
38
40
  export COMPSHARE_PRIVATE_KEY='...'
41
+
42
+ # MiniMax H3 使用独立的模型 API Key
43
+ export COMPSHARE_MINIMAX_API_KEY='sk-ml-...'
39
44
  ```
40
45
 
46
+ CLI 使用统计和反馈与业务 API 一样,通过当前 profile 的凭证签名后发送到
47
+ `https://api.compshare.cn/`;开发环境可使用 `COMPSHARE_INSIGHTS_URL` 覆盖网关地址。
48
+
41
49
  ## 快速开始
42
50
 
43
51
  ```bash
@@ -49,6 +57,11 @@ compshare instance list --all
49
57
  # 连接实例
50
58
  compshare instance ssh INSTANCE_ID
51
59
 
60
+ # MiniMax H3:先预演,再创建
61
+ compshare --json minimax create '一只猫在海边奔跑' --dry-run
62
+ compshare --json minimax create '一只猫在海边奔跑' --yes
63
+ compshare --json minimax points
64
+
52
65
  # 查看帮助
53
66
  compshare -h
54
67
  compshare instance -h
@@ -64,6 +77,8 @@ compshare ask 产品使用和计费问答
64
77
  compshare instance GPU 实例、规格、库存、价格和生命周期
65
78
  compshare image 平台、自定义、社区及共享镜像
66
79
  compshare storage 云盘和 US3 挂载
80
+ compshare bandwidth 独享带宽和实例 EIP 带宽归属
81
+ compshare minimax MiniMax H3 视频任务和积分
67
82
  compshare team 团队、邀请、成员额度、账单和审计
68
83
  ```
69
84
 
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "compshare-cli"
7
7
  dynamic = ["version"]
8
- description = "Command-line client for CompShare GPU compute"
8
+ description = "Command-line client for CompShare GPU compute and MiniMax H3"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
11
11
  license = "Apache-2.0"
@@ -1,3 +1,3 @@
1
1
  """CompShare command-line client."""
2
2
 
3
- __version__ = "0.3.5"
3
+ __version__ = "0.4.0"
@@ -1,4 +1,4 @@
1
- """Public CompShare API actions covered by the first CLI release."""
1
+ """Public CompShare API actions covered by the CLI."""
2
2
 
3
3
  INSTANCE_ACTIONS = frozenset(
4
4
  {
@@ -88,7 +88,22 @@ TEAM_ACTIONS = frozenset(
88
88
  }
89
89
  )
90
90
 
91
- PUBLIC_ACTIONS = INSTANCE_ACTIONS | IMAGE_ACTIONS | STORAGE_ACTIONS | TEAM_ACTIONS
91
+ BANDWIDTH_ACTIONS = frozenset(
92
+ {
93
+ "CreateCompShareShareBandwidth",
94
+ "DeleteCompShareShareBandwidth",
95
+ "DescribeCompShareShareBandwidth",
96
+ "GetCompShareShareBandwidthPrice",
97
+ "GetCompShareShareBandwidthRefundPrice",
98
+ "GetCompShareShareBandwidthUpgradePrice",
99
+ "ModifyCompShareShareBandwidth",
100
+ "SwitchCompShareEIPShareBandwidth",
101
+ }
102
+ )
103
+
104
+ PUBLIC_ACTIONS = (
105
+ INSTANCE_ACTIONS | IMAGE_ACTIONS | STORAGE_ACTIONS | TEAM_ACTIONS | BANDWIDTH_ACTIONS
106
+ )
92
107
 
93
108
  # No unavailable API actions are currently exposed as placeholders.
94
109
  COMING_SOON_ACTIONS = frozenset()
@@ -11,9 +11,9 @@ from typer.main import get_command
11
11
 
12
12
  from compshare_cli import __version__
13
13
  from compshare_cli.commands import ask as ask_command
14
+ from compshare_cli.commands import bandwidth, image, instance, minimax, storage, team
14
15
  from compshare_cli.commands import doctor as doctor_command
15
16
  from compshare_cli.commands import feedback as feedback_command
16
- from compshare_cli.commands import image, instance, storage, team
17
17
  from compshare_cli.commands.common import confirm
18
18
  from compshare_cli.config import DEFAULT_PROFILE, ConfigStore, Profile
19
19
  from compshare_cli.errors import CLIError, ConfigError, UsageError
@@ -26,6 +26,10 @@ _TYPER_CLICK = getattr(typer_core, "_click", click)
26
26
  _TYPER_CLICK_EXCEPTIONS = getattr(_TYPER_CLICK, "exceptions", _TYPER_CLICK)
27
27
  _CLICK_EXCEPTIONS = (click.ClickException, _TYPER_CLICK_EXCEPTIONS.ClickException)
28
28
  _ABORT_EXCEPTIONS = (click.Abort, _TYPER_CLICK_EXCEPTIONS.Abort)
29
+ _GROUP_TYPES = (click.Group, typer_core.TyperGroup)
30
+ _OPTION_TYPES = (click.Option, typer_core.TyperOption)
31
+ _ARGUMENT_TYPES = (click.Argument, typer_core.TyperArgument)
32
+ _CLICK_CONTEXT = getattr(_TYPER_CLICK, "Context", click.Context)
29
33
 
30
34
  completion_init()
31
35
 
@@ -42,7 +46,7 @@ class RootGroup(typer_core.TyperGroup):
42
46
 
43
47
  app = typer.Typer(
44
48
  name="compshare",
45
- help="Manage CompShare GPU compute from the terminal.",
49
+ help="Manage CompShare GPU compute and MiniMax H3 from the terminal.",
46
50
  cls=RootGroup,
47
51
  no_args_is_help=True,
48
52
  add_completion=False,
@@ -51,6 +55,8 @@ app = typer.Typer(
51
55
  app.add_typer(instance.app, name="instance")
52
56
  app.add_typer(image.app, name="image")
53
57
  app.add_typer(storage.app, name="storage")
58
+ app.add_typer(bandwidth.app, name="bandwidth")
59
+ app.add_typer(minimax.app, name="minimax")
54
60
  app.add_typer(team.app, name="team")
55
61
  config_app = typer.Typer(
56
62
  help="Manage credential profiles.",
@@ -391,7 +397,7 @@ def _command_path(command: click.Command, argv: List[str]) -> Optional[str]:
391
397
 
392
398
  path: List[str] = []
393
399
  current = command
394
- while remaining and isinstance(current, click.Group):
400
+ while remaining and isinstance(current, _GROUP_TYPES):
395
401
  name = remaining.pop(0)
396
402
  child = current.commands.get(name)
397
403
  if child is None:
@@ -429,13 +435,13 @@ def _json_help_payload(command: click.Command, argv: List[str]) -> Dict[str, Any
429
435
  "--show-sensitive",
430
436
  }:
431
437
  continue
432
- if isinstance(current, click.Group) and token in current.commands:
438
+ if isinstance(current, _GROUP_TYPES) and token in current.commands:
433
439
  current = current.commands[token]
434
440
  path.append(token)
435
441
 
436
442
  parameters: List[Dict[str, Any]] = []
437
443
  for parameter in current.params:
438
- if isinstance(parameter, click.Option):
444
+ if isinstance(parameter, _OPTION_TYPES):
439
445
  parameters.append(
440
446
  {
441
447
  "kind": "option",
@@ -446,7 +452,7 @@ def _json_help_payload(command: click.Command, argv: List[str]) -> Dict[str, Any
446
452
  "help": parameter.help,
447
453
  }
448
454
  )
449
- elif isinstance(parameter, click.Argument):
455
+ elif isinstance(parameter, _ARGUMENT_TYPES):
450
456
  parameters.append(
451
457
  {
452
458
  "kind": "argument",
@@ -456,11 +462,11 @@ def _json_help_payload(command: click.Command, argv: List[str]) -> Dict[str, Any
456
462
  }
457
463
  )
458
464
  commands = []
459
- if isinstance(current, click.Group):
465
+ if isinstance(current, _GROUP_TYPES):
460
466
  commands = [
461
467
  {"name": name, "help": child.get_short_help_str()}
462
- for name in current.list_commands(click.Context(current))
463
- if (child := current.get_command(click.Context(current), name)) is not None
468
+ for name in current.list_commands(_CLICK_CONTEXT(current))
469
+ if (child := current.get_command(_CLICK_CONTEXT(current), name)) is not None
464
470
  and not child.hidden
465
471
  ]
466
472
  command_name = " ".join(["compshare", *path])
@@ -506,16 +512,45 @@ def _requested_language(argv: List[str]) -> Optional[str]:
506
512
  return requested
507
513
 
508
514
 
515
+ def _requested_profile(argv: List[str]) -> Optional[str]:
516
+ """Return the root --profile value, if present."""
517
+ index = 0
518
+ while index < len(argv):
519
+ option = argv[index]
520
+ if option == "--profile":
521
+ return argv[index + 1] if index + 1 < len(argv) else None
522
+ if option.startswith("--profile="):
523
+ return option.split("=", 1)[1] or None
524
+ if option in {"--lang"}:
525
+ index += 2
526
+ continue
527
+ if option.startswith("--lang=") or option in {
528
+ "--json",
529
+ "--show-sensitive",
530
+ "--version",
531
+ "-h",
532
+ "--help",
533
+ }:
534
+ index += 1
535
+ continue
536
+ if not option.startswith("-"):
537
+ break
538
+ index += 1
539
+ return None
540
+
541
+
509
542
  def main(args: Optional[List[str]] = None) -> None:
510
543
  original_argv = list(sys.argv[1:] if args is None else args)
511
544
  argv = list(original_argv)
512
545
  if not argv:
513
546
  argv = ["-h"]
514
547
  telemetry_command: Optional[str] = None
548
+ telemetry_profile: Optional[str] = None
515
549
  json_output = _global_flag_requested(argv, "--json")
516
550
  show_sensitive = _global_flag_requested(argv, "--show-sensitive")
517
551
  try:
518
552
  argv = _normalize_global_options(argv)
553
+ telemetry_profile = _requested_profile(argv)
519
554
  requested_language = _requested_language(argv)
520
555
  if requested_language is None:
521
556
  language = configured_language()
@@ -547,7 +582,10 @@ def main(args: Optional[List[str]] = None) -> None:
547
582
  raise SystemExit(1) from error
548
583
  finally:
549
584
  if telemetry_command:
550
- record_command(telemetry_command)
585
+ if telemetry_profile is None:
586
+ record_command(telemetry_command)
587
+ else:
588
+ record_command(telemetry_command, telemetry_profile)
551
589
  if isinstance(result, int) and result:
552
590
  raise SystemExit(result)
553
591