Skip to main content

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-demo
  • cli-demo update --dry-run 只展示命令,不执行

发布到 PyPI

仓库已经包含 GitHub Actions 发布工作流 release.yml,使用 PyPI Trusted Publishing。

首次发布前,你还需要在 PyPI 做一次配置:

  1. 在 PyPI 创建 32r4-cli-demo 项目或添加 Trusted Publisher。
  2. Publisher 类型选择 GitHub。
  3. 仓库填写 32r4/cli-demo
  4. Workflow 文件名填写 release.yml
  5. 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

32r4_cli_demo-0.2.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

32r4_cli_demo-0.2.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

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

Hashes for 32r4_cli_demo-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8d1adfb38d265179d8da126207b4c63ed7ce8e00d5c13581bf7d1542f7b21382
MD5 9d9a8976f0b974936c64c227c6385ae4
BLAKE2b-256 52cab270192ab5a0d6f95c7f5e3687c320d10777727ff17d29d09c690664f2ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for 32r4_cli_demo-0.2.1.tar.gz:

Publisher: release.yml on 32r4/cli-demo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for 32r4_cli_demo-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 36fb0b98da1782b9efd814787c274081ce73bcebc06c2774fb1886d9f9dfc1cd
MD5 22e27d3d2d385165e51e4d1a5b4636c9
BLAKE2b-256 d7c6c9829de30caa1b3c488961349da2dc2ad2a4b1ae280f0629e0ed83bbef60

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page