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 --help
cli hello
cli hello Ezra
cli version
cli update

cli hello [NAME]

输出一条问候语。

cli version

显示当前 CLI 版本。

cli update

使用 uv tool 升级当前 CLI。

cli update
cli update --dry-run

说明:

  • cli update 会执行 uv tool upgrade 32r4-cli-demo
  • cli 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.0
git push origin v0.2.0

然后在 GitHub 上创建并发布对应 Release;或者直接手动触发 release 工作流。

本地验证

uv sync
uv build
uv run cli --help
uv run cli hello
uv run cli hello Ezra
uv run cli version
uv run cli update
uv run cli 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.0.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.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file 32r4_cli_demo-0.2.0.tar.gz.

File metadata

  • Download URL: 32r4_cli_demo-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 98cf2338b3f8be3972f38255c192415c368cb9c9d03d894b3eb18b231503285c
MD5 26427fa4339224c66d6634a838399c3d
BLAKE2b-256 303d43699ff03c06ce59fdc9c4dd58944f20aa524b6e477a6b3af61a3beff40a

See more details on using hashes here.

Provenance

The following attestation bundles were made for 32r4_cli_demo-0.2.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: 32r4_cli_demo-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2abb1eafb4da6369baf9b890c815b9a746ea7eb343e1d84327f7bf9c8858a17d
MD5 d2f2d51fb4ebc17fffc08fba04f430dd
BLAKE2b-256 b4df80f1f7f41d934f14dd4147610a6b6b28c204d10da8f36014f7ad9d4c78d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for 32r4_cli_demo-0.2.0-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