无限制查看
一、创建包
创建一个工程,目录结构如下:
包名
├── LICENSE
├── 包名
│ └── __init__.py
├── README.md
└── setup.py
-
LICENSE
授权文件。可以从这里挑选一个你喜欢的授权。例如:
MIT License Copyright (c) [year] [fullname] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -
包名为包的源码目录注意:改成你自己包的名称。
-
README.md在这里写上库的详细描述。通常,写一下基本介绍,如何使用等等。
-
setup.py<

这篇博客详细介绍了如何将Python库提交到PyPI,包括创建包、编译与测试、注册PyPI账号以及上传步骤。创建包时要注意目录结构和`setup.py`的配置。测试通过后,在PyPI网站注册账号并启用双因子认证,生成API token用于上传。最后,使用twine工具进行包的上传。

909

被折叠的 条评论
为什么被折叠?



