ChatHFD 0.1.1__tar.gz → 0.1.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ChatHFD
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: ChatHFD: ChatArch Hugging Face Download tooling package
5
5
  Author-email: ChatArch <1073853456@qq.com>
6
6
  License-Expression: MIT
@@ -14,8 +14,8 @@ Requires-Python: >=3.10
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
16
  Requires-Dist: click>=8.0
17
- Requires-Dist: chatstyle<0.2.0,>=0.1.0
18
- Requires-Dist: chatenv<0.3.0,>=0.2.0
17
+ Requires-Dist: chatstyle<0.3.0,>=0.2.0
18
+ Requires-Dist: chatenv<0.3.0,>=0.2.10
19
19
  Provides-Extra: dev
20
20
  Requires-Dist: build; extra == "dev"
21
21
  Requires-Dist: pytest; extra == "dev"
@@ -55,22 +55,25 @@ pip install ChatHFD
55
55
  chathfd --help
56
56
  chathfd --version
57
57
  chathfd --tree
58
+ chathfd --tree-brief
58
59
  ```
59
60
 
60
- ## 当前 CLI 树
61
+ ## 当前 CLI 树(`--tree`)
61
62
 
62
63
  ```text
63
- chathfd # ChatArch Hugging Face Download tooling entrypoint
64
- ├── --help # show command help
65
- ├── --version # show the installed package version
66
- └── --tree # show this CLI tree
64
+ chathfd
65
+ ├── --help # Show this message and exit.
66
+ ├── --version # Show the version and exit.
67
+ ├── --tree # Print the registered CLI tree and exit.
68
+ └── --tree-brief # Print the registered CLI tree without parameter signatures and exit.
67
69
  ```
68
70
 
69
71
  ## CLI 边界
70
72
 
71
73
  - 当前 CLI 只有根选项,没有业务子命令。
72
- - `--tree` 从实际 Click 命令注册面生成,用来校对 README、文档和测试。
73
- - 后续新增真实 HFD 下载、镜像、缓存或校验命令时,必须先更新 Click 注册面,再用真实 `chathfd --tree` 同步文档。
74
+ - `--tree` 和 `--tree-brief` 由 ChatStyle 共享 Click tree runtime 从实际注册面生成,公开根名固定为 `chathfd`。
75
+ - `--tree` 默认保留命令参数签名;`--tree-brief` 省略参数签名,但保留命令节点和描述。当前没有参数化子命令,因此两种模式显示同一组 root-only 节点。
76
+ - 后续新增真实 HFD 下载、镜像、缓存或校验命令时,必须先更新 Click 注册面,再用真实 `chathfd --tree` 和 `chathfd --tree-brief` 同步文档。
74
77
 
75
78
  ## 目录结构
76
79
 
@@ -26,22 +26,25 @@ pip install ChatHFD
26
26
  chathfd --help
27
27
  chathfd --version
28
28
  chathfd --tree
29
+ chathfd --tree-brief
29
30
  ```
30
31
 
31
- ## 当前 CLI 树
32
+ ## 当前 CLI 树(`--tree`)
32
33
 
33
34
  ```text
34
- chathfd # ChatArch Hugging Face Download tooling entrypoint
35
- ├── --help # show command help
36
- ├── --version # show the installed package version
37
- └── --tree # show this CLI tree
35
+ chathfd
36
+ ├── --help # Show this message and exit.
37
+ ├── --version # Show the version and exit.
38
+ ├── --tree # Print the registered CLI tree and exit.
39
+ └── --tree-brief # Print the registered CLI tree without parameter signatures and exit.
38
40
  ```
39
41
 
40
42
  ## CLI 边界
41
43
 
42
44
  - 当前 CLI 只有根选项,没有业务子命令。
43
- - `--tree` 从实际 Click 命令注册面生成,用来校对 README、文档和测试。
44
- - 后续新增真实 HFD 下载、镜像、缓存或校验命令时,必须先更新 Click 注册面,再用真实 `chathfd --tree` 同步文档。
45
+ - `--tree` 和 `--tree-brief` 由 ChatStyle 共享 Click tree runtime 从实际注册面生成,公开根名固定为 `chathfd`。
46
+ - `--tree` 默认保留命令参数签名;`--tree-brief` 省略参数签名,但保留命令节点和描述。当前没有参数化子命令,因此两种模式显示同一组 root-only 节点。
47
+ - 后续新增真实 HFD 下载、镜像、缓存或校验命令时,必须先更新 Click 注册面,再用真实 `chathfd --tree` 和 `chathfd --tree-brief` 同步文档。
45
48
 
46
49
  ## 目录结构
47
50
 
@@ -9,7 +9,7 @@ description = "ChatHFD: ChatArch Hugging Face Download tooling package"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
11
11
  license = "MIT"
12
- dependencies = ["click>=8.0", "chatstyle>=0.1.0,<0.2.0", "chatenv>=0.2.0,<0.3.0"]
12
+ dependencies = ["click>=8.0", "chatstyle>=0.2.0,<0.3.0", "chatenv>=0.2.10,<0.3.0"]
13
13
  authors = [{name = "ChatArch", email = "1073853456@qq.com"}]
14
14
  keywords = ["chathfd", "chatarch", "cli"]
15
15
  classifiers = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ChatHFD
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: ChatHFD: ChatArch Hugging Face Download tooling package
5
5
  Author-email: ChatArch <1073853456@qq.com>
6
6
  License-Expression: MIT
@@ -14,8 +14,8 @@ Requires-Python: >=3.10
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
16
  Requires-Dist: click>=8.0
17
- Requires-Dist: chatstyle<0.2.0,>=0.1.0
18
- Requires-Dist: chatenv<0.3.0,>=0.2.0
17
+ Requires-Dist: chatstyle<0.3.0,>=0.2.0
18
+ Requires-Dist: chatenv<0.3.0,>=0.2.10
19
19
  Provides-Extra: dev
20
20
  Requires-Dist: build; extra == "dev"
21
21
  Requires-Dist: pytest; extra == "dev"
@@ -55,22 +55,25 @@ pip install ChatHFD
55
55
  chathfd --help
56
56
  chathfd --version
57
57
  chathfd --tree
58
+ chathfd --tree-brief
58
59
  ```
59
60
 
60
- ## 当前 CLI 树
61
+ ## 当前 CLI 树(`--tree`)
61
62
 
62
63
  ```text
63
- chathfd # ChatArch Hugging Face Download tooling entrypoint
64
- ├── --help # show command help
65
- ├── --version # show the installed package version
66
- └── --tree # show this CLI tree
64
+ chathfd
65
+ ├── --help # Show this message and exit.
66
+ ├── --version # Show the version and exit.
67
+ ├── --tree # Print the registered CLI tree and exit.
68
+ └── --tree-brief # Print the registered CLI tree without parameter signatures and exit.
67
69
  ```
68
70
 
69
71
  ## CLI 边界
70
72
 
71
73
  - 当前 CLI 只有根选项,没有业务子命令。
72
- - `--tree` 从实际 Click 命令注册面生成,用来校对 README、文档和测试。
73
- - 后续新增真实 HFD 下载、镜像、缓存或校验命令时,必须先更新 Click 注册面,再用真实 `chathfd --tree` 同步文档。
74
+ - `--tree` 和 `--tree-brief` 由 ChatStyle 共享 Click tree runtime 从实际注册面生成,公开根名固定为 `chathfd`。
75
+ - `--tree` 默认保留命令参数签名;`--tree-brief` 省略参数签名,但保留命令节点和描述。当前没有参数化子命令,因此两种模式显示同一组 root-only 节点。
76
+ - 后续新增真实 HFD 下载、镜像、缓存或校验命令时,必须先更新 Click 注册面,再用真实 `chathfd --tree` 和 `chathfd --tree-brief` 同步文档。
74
77
 
75
78
  ## 目录结构
76
79
 
@@ -1,6 +1,6 @@
1
1
  click>=8.0
2
- chatstyle<0.2.0,>=0.1.0
3
- chatenv<0.3.0,>=0.2.0
2
+ chatstyle<0.3.0,>=0.2.0
3
+ chatenv<0.3.0,>=0.2.10
4
4
 
5
5
  [dev]
6
6
  build
@@ -2,4 +2,4 @@
2
2
 
3
3
  __all__ = ["__version__"]
4
4
 
5
- __version__ = "0.1.1"
5
+ __version__ = "0.1.2"
@@ -0,0 +1,23 @@
1
+ """CLI entrypoint for chathfd."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import click
6
+ from chatstyle import add_tree_option
7
+
8
+ from chathfd import __version__
9
+
10
+
11
+ @click.group(invoke_without_command=True)
12
+ @click.version_option(__version__, prog_name="chathfd")
13
+ @add_tree_option(renderer_options={"root_name": "chathfd"})
14
+ @click.pass_context
15
+ def main(ctx: click.Context) -> None:
16
+ """chathfd command line interface."""
17
+ if ctx.invoked_subcommand is None:
18
+ # Root-only package for now: keep normal Click help behavior when no command is supplied.
19
+ click.echo(ctx.get_help())
20
+
21
+
22
+ if __name__ == "__main__":
23
+ main()
@@ -0,0 +1,65 @@
1
+ import click
2
+ from click.testing import CliRunner
3
+
4
+ from chathfd import __version__
5
+ from chathfd.cli import main
6
+
7
+
8
+ EXPECTED_ROOT_TREE = (
9
+ "chathfd\n"
10
+ "├── --help # Show this message and exit.\n"
11
+ "├── --version # Show the version and exit.\n"
12
+ "├── --tree # Print the registered CLI tree and exit.\n"
13
+ "└── --tree-brief # Print the registered CLI tree without parameter signatures and exit.\n"
14
+ )
15
+
16
+
17
+ def test_help_mentions_tree_options():
18
+ result = CliRunner().invoke(main, ["--help"])
19
+
20
+ assert result.exit_code == 0
21
+ assert "--tree" in result.output
22
+ assert "--tree-brief" in result.output
23
+
24
+
25
+ def test_version_option_reports_package_version():
26
+ result = CliRunner().invoke(main, ["--version"])
27
+
28
+ assert result.exit_code == 0
29
+ assert f"chathfd, version {__version__}" in result.output
30
+
31
+
32
+ def test_tree_reports_registered_root_only_surface():
33
+ result = CliRunner().invoke(main, ["--tree"])
34
+
35
+ assert result.exit_code == 0
36
+ assert result.output == EXPECTED_ROOT_TREE
37
+
38
+
39
+ def test_tree_brief_reports_registered_root_only_surface():
40
+ result = CliRunner().invoke(main, ["--tree-brief"])
41
+
42
+ assert result.exit_code == 0
43
+ assert result.output == EXPECTED_ROOT_TREE
44
+
45
+
46
+ def test_tree_modes_include_and_omit_command_parameter_signatures():
47
+ @click.command("download")
48
+ @click.argument("repo_id")
49
+ @click.option("--revision", help="Repository revision.")
50
+ def download(repo_id: str, revision: str | None) -> None:
51
+ """Download a repository."""
52
+
53
+ main.add_command(download)
54
+ try:
55
+ detailed = CliRunner().invoke(main, ["--tree"])
56
+ brief = CliRunner().invoke(main, ["--tree-brief"])
57
+ finally:
58
+ main.commands.pop("download")
59
+
60
+ assert detailed.exit_code == 0
61
+ assert "download <REPO-ID> [--revision REVISION] # Download a repository." in detailed.output
62
+ assert brief.exit_code == 0
63
+ assert "download # Download a repository." in brief.output
64
+ assert "<REPO-ID>" not in brief.output
65
+ assert "[--revision REVISION]" not in brief.output
@@ -2,4 +2,4 @@ from chathfd import __version__
2
2
 
3
3
 
4
4
  def test_version_present():
5
- assert __version__ == "0.1.1"
5
+ assert __version__ == "0.1.2"
@@ -1,38 +0,0 @@
1
- """CLI entrypoint for chathfd."""
2
-
3
- from __future__ import annotations
4
-
5
- import click
6
-
7
- from chathfd import __version__
8
-
9
-
10
- def _format_tree() -> str:
11
- """Render the public CLI surface from the registered Click command."""
12
- ctx = click.Context(main, info_name="chathfd")
13
- lines = ["chathfd # ChatArch Hugging Face Download tooling entrypoint"]
14
- params = {param.name: param for param in main.get_params(ctx)}
15
- if "help" in params:
16
- lines.append("├── --help # show command help")
17
- if "version" in params:
18
- lines.append("├── --version # show the installed package version")
19
- lines.append("└── --tree # show this CLI tree")
20
- return "\n".join(lines)
21
-
22
-
23
- @click.group(invoke_without_command=True)
24
- @click.version_option(__version__, prog_name="chathfd")
25
- @click.option("--tree", "show_tree", is_flag=True, is_eager=True, help="Show the CLI command tree and exit.")
26
- @click.pass_context
27
- def main(ctx: click.Context, show_tree: bool) -> None:
28
- """chathfd command line interface."""
29
- if show_tree:
30
- click.echo(_format_tree())
31
- ctx.exit(0)
32
- if ctx.invoked_subcommand is None:
33
- # Root-only package for now: keep normal Click help behavior when no command is supplied.
34
- click.echo(ctx.get_help())
35
-
36
-
37
- if __name__ == "__main__":
38
- main()
@@ -1,30 +0,0 @@
1
- from click.testing import CliRunner
2
-
3
- from chathfd import __version__
4
- from chathfd.cli import main
5
-
6
-
7
- def test_help_mentions_tree_option():
8
- result = CliRunner().invoke(main, ["--help"])
9
-
10
- assert result.exit_code == 0
11
- assert "--tree" in result.output
12
-
13
-
14
- def test_version_option_reports_package_version():
15
- result = CliRunner().invoke(main, ["--version"])
16
-
17
- assert result.exit_code == 0
18
- assert f"chathfd, version {__version__}" in result.output
19
-
20
-
21
- def test_tree_reports_registered_root_only_surface():
22
- result = CliRunner().invoke(main, ["--tree"])
23
-
24
- assert result.exit_code == 0
25
- assert result.output == (
26
- "chathfd # ChatArch Hugging Face Download tooling entrypoint\n"
27
- "├── --help # show command help\n"
28
- "├── --version # show the installed package version\n"
29
- "└── --tree # show this CLI tree\n"
30
- )
File without changes
File without changes
File without changes