pypi项目推送演示
本地打包:
python -m pip install -e .
验证是否打包成功:
# 查看是否有包
pip list
# 执行命令查看
python -m snakesay "Hello World"
# 或均可以看到输出
ssay "Hello World"
我们通常pip install下载的包,需要到site-packages去修改代码才能生效,-e 的意思是可以编辑的含义,将本地代码和site-packages建立映射,这样修改本地源码就能生效。
推送到远端
安装必要的打包工具:
python -m pip install --upgrade pip
python -m pip install build twine
构建分发包
python -m build
上传到 PyPI:
python -m twine upload dist/*
上传时会要求输入你的 PyPI 用户名和密码 如果想先测试,可以上传到测试版 PyPI:
python -m twine upload --repository testpypi dist/*
验证安装:
pip install snakesay
或从测试版 PyPI 安装:
pip install --index-url https://test.pypi.org/simple/ snakesay
注意事项:
- 请确保更新 pyproject.toml 中的个人信息(作者名称和邮箱)
- 确保包名 "snakesay" 在 PyPI 上是可用的(没有被其他人使用)
- 每次上传新版本时,需要在 pyproject.toml 中更新版本号
- 建议先上传到 test.pypi.org 测试无误后再上传到正式的 PyPI
Metadata
Release files for mxqq-snakesay 1.0.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 | |
|---|---|---|---|---|
| mxqq_snakesay-1.0.0.tar.gz | 3.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mxqq_snakesay-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.8 kB
Release files / mxqq_snakesay-1.0.0.tar.gz
| Download URL | mxqq_snakesay-1.0.0.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f238f7e1716d43a94c9e20d132429478c2035fe22ab0181b5ac0824ad67315c
|
|
BLAKE2b-256 checksum How to use checksums |
2f9e5d177de8e084a994f0af2d72c2c41b8d732a52edfe3f69e2d2b802cc1a05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0
|
Release files / mxqq_snakesay-1.0.0-py3-none-any.whl
| Download URL | mxqq_snakesay-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
40b134a7b418ec97714b31b54981c3e58fd641f35062a14ecbfa28bb49f724c1
|
|
BLAKE2b-256 checksum How to use checksums |
77daef417baa86766774c9eaffca727571ec46e223ebba2a05abcf80ffab0f40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.0
|
Security for mxqq-snakesay 1.0.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.