jiecheng_pkg
一个用于演示 PyPI 发布流程的极简阶乘包(实验三)。
状态:尚未发布,仅作为"实验三包"的源码准备,等研究清楚后再上传 PyPI。
功能
| 函数 | 说明 |
|---|---|
jiecheng(n) |
返回 n 的阶乘(递归实现,n 为正整数) |
使用
from jiecheng_pkg import jiecheng
print(jiecheng(5)) # 120
目录结构
实验三_jiecheng_package/
├── jiecheng_pkg/
│ ├── __init__.py
│ └── jiecheng.py
├── tests/
│ └── test_jiecheng.py
├── LICENSE
├── README.md
└── pyproject.toml
本地测试
在包根目录执行:
python -m unittest discover -s tests -v
发布到 PyPI 的步骤(待研究)
-
在 https://pypi.org 注册账号并开启双因素认证。
-
在 Account settings → API tokens 创建令牌,复制
pypi-...开头的 Token。 -
安装构建与上传工具:
pip install build twine
-
构建分发包:
python -m build
会生成
dist/jiecheng_pkg-0.1.0-py3-none-any.whl与.tar.gz。 -
检查并上传(PyPI 已禁用账号密码,必须用 API Token):
twine check dist/* twine upload -u __token__ -p pypi-你的Token dist/*
-
若用 GitHub Actions 等 CI,可改用 Trusted Publishers(OIDC),无需保存 Token。
-
上传后用
pip install jiecheng-pkg验证,并让同学互相安装测试。
Metadata
Release files for jiecheng-pkg 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jiecheng_pkg-0.1.0.tar.gz | 3.7 kB | Without provenance | Details for jiecheng_pkg-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jiecheng_pkg-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for jiecheng_pkg-0.1.0-py3-none-any.whl |
Total release size: 8.1 kB
Release files / jiecheng_pkg-0.1.0.tar.gz
| Download URL | jiecheng_pkg-0.1.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ddb4f8833d91145d532c49f5f821868198cd252b50ad959abe466128841fd8e
|
|
BLAKE2b-256 checksum How to use checksums |
a86bef3c1e9a94d55077efddf2980f2f160da387e1471d0d9d308657ddb6d62f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / jiecheng_pkg-0.1.0-py3-none-any.whl
| Download URL | jiecheng_pkg-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
06f3dfc12969798472a9281ab00ae7d8835973e26f94aac76fc06e9394a19d3c
|
|
BLAKE2b-256 checksum How to use checksums |
aa16905d08fe33a4d4bfcf22e745e5ba54137714a11c17aa3a7535189d32f6bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for jiecheng-pkg 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.