A publishable Typer CLI demo with hello, version, and self-update help.
Project description
32r4-cli-demo
32r4-cli-demo 是一个用 Typer 构建的最小 CLI 示例项目,现在已经补齐了发布和升级所需的基础结构。
安装
这个项目面向 uv tool 的使用方式来分发和升级。
从 PyPI 安装
包发布到 PyPI 后,其他人可以直接安装:
uv tool install 32r4-cli-demo
直接从 GitHub 安装
在正式发布到 PyPI 之前,也可以直接从仓库安装:
uv tool install git+https://github.com/32r4/cli-demo.git
使用
cli-demo --help
cli-demo hello
cli-demo hello Ezra
cli-demo version
cli-demo update
cli-demo hello [NAME]
输出一条问候语。
cli-demo version
显示当前 CLI 版本。
cli-demo update
使用 uv tool 升级当前 CLI。
cli-demo update
cli-demo update --dry-run
说明:
cli-demo update会执行uv tool upgrade 32r4-cli-democli-demo update --dry-run只展示命令,不执行
发布到 PyPI
仓库已经包含 GitHub Actions 发布工作流 release.yml,使用 PyPI Trusted Publishing。
首次发布前,你还需要在 PyPI 做一次配置:
- 在 PyPI 创建
32r4-cli-demo项目或添加 Trusted Publisher。 - Publisher 类型选择 GitHub。
- 仓库填写
32r4/cli-demo。 - Workflow 文件名填写
release.yml。 - Environment 填写
pypi。
配置完成后,发布方式有两种:
git tag v0.2.1
git push origin v0.2.1
然后在 GitHub 上创建并发布对应 Release;或者直接手动触发 release 工作流。
本地验证
uv sync
uv build
uv run cli-demo --help
uv run cli-demo hello
uv run cli-demo hello Ezra
uv run cli-demo version
uv run cli-demo update
uv run cli-demo update --dry-run
uv run python -m cli_demo --help
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file 32r4_cli_demo-0.2.1.tar.gz.
File metadata
- Download URL: 32r4_cli_demo-0.2.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d1adfb38d265179d8da126207b4c63ed7ce8e00d5c13581bf7d1542f7b21382
|
|
| MD5 |
9d9a8976f0b974936c64c227c6385ae4
|
|
| BLAKE2b-256 |
52cab270192ab5a0d6f95c7f5e3687c320d10777727ff17d29d09c690664f2ed
|
Provenance
The following attestation bundles were made for 32r4_cli_demo-0.2.1.tar.gz:
Publisher:
release.yml on 32r4/cli-demo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
32r4_cli_demo-0.2.1.tar.gz -
Subject digest:
8d1adfb38d265179d8da126207b4c63ed7ce8e00d5c13581bf7d1542f7b21382 - Sigstore transparency entry: 1358717653
- Sigstore integration time:
-
Permalink:
32r4/cli-demo@aebf128d35d4f45eba4f92c3f65f9d5e7d578d0d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/32r4
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@aebf128d35d4f45eba4f92c3f65f9d5e7d578d0d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file 32r4_cli_demo-0.2.1-py3-none-any.whl.
File metadata
- Download URL: 32r4_cli_demo-0.2.1-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36fb0b98da1782b9efd814787c274081ce73bcebc06c2774fb1886d9f9dfc1cd
|
|
| MD5 |
22e27d3d2d385165e51e4d1a5b4636c9
|
|
| BLAKE2b-256 |
d7c6c9829de30caa1b3c488961349da2dc2ad2a4b1ae280f0629e0ed83bbef60
|
Provenance
The following attestation bundles were made for 32r4_cli_demo-0.2.1-py3-none-any.whl:
Publisher:
release.yml on 32r4/cli-demo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
32r4_cli_demo-0.2.1-py3-none-any.whl -
Subject digest:
36fb0b98da1782b9efd814787c274081ce73bcebc06c2774fb1886d9f9dfc1cd - Sigstore transparency entry: 1358717749
- Sigstore integration time:
-
Permalink:
32r4/cli-demo@aebf128d35d4f45eba4f92c3f65f9d5e7d578d0d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/32r4
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@aebf128d35d4f45eba4f92c3f65f9d5e7d578d0d -
Trigger Event:
workflow_dispatch
-
Statement type: