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-0.1.0-py3-none-any.whl 与 test_python_demo-0.1.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                                    # 0.1.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 0.1.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 0.1.0
File Size Uploaded Provenance Actions
test_python_demo-0.1.0.tar.gz 3.9 kB Without provenance Details for test_python_demo-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 8.3 kB

Release files / test_python_demo-0.1.0.tar.gz

Download URL test_python_demo-0.1.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
be9c60c547489bcc2a013cfbac51fd79f18cb6aa8bf0c061427ee7fb39cef582
BLAKE2b-256 checksum
How to use checksums
54a15dc51fd7c3d300674b97f8dec97d127f44af2ccc5fc50c0f4a5f5ddfd760
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-0.1.0-py3-none-any.whl

Download URL test_python_demo-0.1.0-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2191add85d3de13f64f730ba5bb93505e15f50deb4f5c07a6b57ad5bd010e889
BLAKE2b-256 checksum
How to use checksums
10a67cfc101590b2c5f50efe20af7f08609580fd41355a9ba6c56a2945e332bb
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 0.1.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

0.1.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