Metadata-Version: 2.4
Name: test-python-demo
Version: 0.1.0
Summary: pypi-publish 插件测试用 Python 包
Author: lcq_test
License: MIT
Project-URL: Homepage, https://gitcode.com/lcq_test/test_python
Keywords: test,pypi-publish,gitcode
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"

# 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 插件的流水线配置
```

## 本地验证

```bash
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`。

## 命令行用法

```bash
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` | 版本已存在时是否跳过 |
