Skip to main content

test-python-demo

用于验证 pypi-publish 插件打包发布链路的示例 Python 包,由 setuptools + pyproject.toml 构建,包含核心工具函数、命令行入口与单元测试。

目录结构

test_python/
├── pyproject.toml              # 打包配置(name/version/build-system)
├── README.md
├── requirements.txt            # 运行/测试依赖
├── src/
│   └── test_python_demo/
│       ├── __init__.py
│       ├── core.py             # 核心工具函数
│       └── cli.py              # 命令行入口
├── tests/
│   └── test_core.py            # 单元测试
└── .gitcode/workflows/
    └── publish.yml             # 使用 pypi-publish 插件的流水线配置

本地验证

pip install -r requirements.txt
pip install -e .
pytest -q
python -m build --outdir dist

构建成功后 dist/ 下会生成 test_python_demo-2.0-py3-none-any.whl 与 test_python_demo-2.0.tar.gz。

命令行用法

test-python-demo palindrome "A man, a plan, a canal: Panama"   # True
test-python-demo wordcount "hello world"                      # 2
test-python-demo div 6 3                                      # 2.0
test-python-demo --version                                    # 2.0

流水线发布

.gitcode/workflows/publish.yml 中通过 pypi-publish 插件发布,关键参数:

参数 取值 说明
registry-type pypi / hwy 官方 PyPI 或华为云制品仓库
package-path . 包含 pyproject.toml 的目录
pypi-token 流水线密钥 访问令牌,不要明文提交
test-pypi true / false 是否发布到 TestPyPI
skip-existing true / false 版本已存在时是否跳过

Metadata

Release files for test-python-demo 2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for test-python-demo 2.0
File Size Uploaded Provenance Actions
test_python_demo-2.0.tar.gz 3.9 kB Without provenance Details for test_python_demo-2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for test-python-demo 2.0
File Interpreter ABI Platform Actions
test_python_demo-2.0-py3-none-any.whl Python 3 none any Details for test_python_demo-2.0-py3-none-any.whl

Total release size: 8.2 kB

Release files / test_python_demo-2.0.tar.gz

Download URL test_python_demo-2.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b778849207924465b835c93cec9657f9ad8cbb71bf2416fefb4aa080e61ca521
BLAKE2b-256 checksum
How to use checksums
bff801bac9a7f26584400ac9f3f7ad19ac7ef01b70bc5114e0d4be2088e30678
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Release files / test_python_demo-2.0-py3-none-any.whl

Download URL test_python_demo-2.0-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2290464b543216ef579fcdfad6a7c3f7b76b825195ad6ce16e0338f75f1ddf0
BLAKE2b-256 checksum
How to use checksums
4528f4bfbb91b5f8adc5a41812b56ea8e89bf3062feaba2bd15b9532f797809e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.3

Security for test-python-demo 2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page