pypi 上传包
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | [cprintf] lt 17:16:17 ☁ main ☂ ✭ . ├── cprintf │ ├── __init__.py │ └── color_print.py ├── README.md └── setup.py在项目根目录下(与 setup.py 同级),执行: python -m build 如果成功,你会看到 dist/ 目录下生成了 .tar.gz 和 .whl 两种文件,例如: [cprintf] lt . ├── cprintf │ ├── __init__.py │ └── color_print.py ├── cprintf.egg-info │ ├── dependency_links.txt │ ├── PKG-INFO │ ├── SOURCES.txt │ └── top_level.txt ├── dist │ ├── cprintf-0.0.4-py3-none-any.whl │ └── cprintf-0.0.4.tar.gz ├── README.md └── setup.py |
pip install --upgrade build twine
测试上传到 TestPyPI
python -m twine upload --repository testpypi dist/*
Uploading distributions to https://test.pypi.org/legacy/
Enter your API token:
Uploading cprintf-0.0.4-py3-none-any.whl
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.7/6.7 kB • 00:00 • ?
Uploading cprintf-0.0.4.tar.gz
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.3/6.3 kB • 00:00 • ?
View at:
https://test.pypi.org/project/cprintf/0.0.4/
安装并且测试 pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple -U cprintf 没问题的话 接下来 上传到 正式环境 pypi
1 2 3 4 5 6 7 8 9 10 11 | python -m twine upload dist/* 17:14:19 ☁ main ☂ ✭ Uploading distributions to https: //upload.pypi.org/legacy/ Enter your API token: Uploading cprintf-0.0.4-py3-none-any.whl 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.7/6.7 kB • 00:00 • ? Uploading cprintf-0.0.4.tar.gz 100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.3/6.3 kB • 00:00 • ? View at: https: //pypi.org/project/cprintf/0.0.4/ |
使用 `pip install cprintf` ## Usage ```python import cprintf cprintf.debug("Debug info") cprintf.ok("Everything looks good.") cprintf.info("This is some info.") cprintf.warn("This is a warning.") cprintf.err("This is an error message.") cprintf.fatal("This is a fatal error.") cprintf.line() cprintf.custom("This is a custom color message in cyan!", "\033[96m") cprintf.line(char='=', length=60, color='OK')
本文作者:🐳.城南
本文链接:https://www.cnblogs.com/dockers/p/18636300
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步