韩灵稚打包测试
Hanlingzhi's Package PyPi Demo ##工程结构说明
.
├── LICENSE.txt // 证书文件
├── README.md // MD文件
├── hanlingzhi
│ ├── __init__.py
│ └── math_h.py
├── setup.py // 打包配置
└── string_h
├── __init__.py
└── reverse.py
##测试服务器打包流程
- 升级setuptools和wheel包
python3 -m pip install --user --upgrade setuptools wheel
- 打包到本地文件
python3 setup.py sdist bdist_wheel 会生成build、dist、hanlingzhi_test.egg-info文件,其中dist文件就是制品 ├── dist │ ├── hanlingzhi-test-0.0.1.tar.gz │ └── hanlingzhi_test-0.0.1-py3-none-any.whl
- 分发到PyPi私服(pypi提供的测试版 test.pypi.org),首先安装twine
pip3 install twine python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/* Uploading distributions to https://test.pypi.org/legacy/ Enter your username: hanlingzhi // 私服注册的用户名 Enter your password: // 私服注册的密码 Uploading hanlingzhi_test-0.0.1-py3-none-any.whl 100%|████| 7.96k/7.96k [00:16<00:00, 486B/s] Uploading hanlingzhi-test-0.0.1.tar.gz 100%|████| 7.28k/7.28k [00:01<00:00, 4.34kB/s]
- 下载依赖
最好在虚拟环境下测试 python3 -m venv venv python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps hanlingzhi_test Looking in indexes: https://test.pypi.org/simple/ Collecting hanlingzhi_test Downloading https://test-files.pythonhosted.org/packages/a7/ca/3e5ecda3c564a721642a756e31ec2f6f340067cfa4dddb119e2eb2c98dd0/hanlingzhi_test-0.0.1-py3-none-any.whl Installing collected packages: hanlingzhi-test Successfully installed hanlingzhi-test-0.0.1
- 测试
python3 \>>> from hanlingzhi import math_h \>>> math_h.addition(3,4) 7 // 成功
- 上传正式服务
python3 -m twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
Metadata
Release files for hanlingzhi-test 0.0.2
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 |
|---|---|---|---|---|
| hanlingzhi-test-0.0.2.tar.gz | 3.5 kB | Without provenance | Details for hanlingzhi-test-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hanlingzhi_test-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for hanlingzhi_test-0.0.2-py3-none-any.whl |
Total release size: 7.5 kB
Release files / hanlingzhi-test-0.0.2.tar.gz
| Download URL | hanlingzhi-test-0.0.2.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5571fa994dfeb439ad486028c6bd7ca9a4f32e66b11fc4788e585f6eb4235e2
|
|
BLAKE2b-256 checksum How to use checksums |
7f5c38f4fafddd8a04dd351ac100d3959aa4736c1aa2f91122cca706c35f1340
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
|
Release files / hanlingzhi_test-0.0.2-py3-none-any.whl
| Download URL | hanlingzhi_test-0.0.2-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d469e2d2a56c33b38cf4a40a5aec38486de8c801f80ff9585c35317eed90e6f6
|
|
BLAKE2b-256 checksum How to use checksums |
92a783ce1deb77a4f13f55a5dd7df10ed68e93de1a2f07b54114b173a28d024c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
|
Security for hanlingzhi-test 0.0.2
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.