项目目录 项目目录说明: cqrcode:项目包(我的里面有多个目录) LINCENSE:许可证 MANIFEST.in:需要打包的项目文件说明 README.md:项目说明文档 requirements.txt:填写需要额外安装的第三方
项目目录
项目目录说明:
1. 项目包
由于项目需要调用 app、view 目录下的脚本,故相当于将 app、view 视作了模块,这两个目录中均存在 __init __.py 文件。
而项目 —— cqrcode 中所含有的 __init __.py 脚本不能省略(原因是需要作为模块标示),如下图所示:
2. LINCENSE
拷贝复制即可?
Copyright (c) 2018 The Python Packaging AuthorityPermission 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.
3. MANIFEST.in
说明需要额外打包的目录。
include README.mdinclude LICENSE
include requirements.txt
recursive-include cqrcode/app *
recursive-include cqrcode/static *
recursive-include cqrcode/view *
4. README.md
5. requirements.txt
Pillow>=6.1.0pyzbar>=0.1.8
qrcode>=6.1
PySnooper>=0.2.8
pretty-errors>=1.2.7
matplotlib>=3.0.3
6. setup.py
import setuptoolssetuptools.setup(name='cqrcode',
version='0.14',
description='Generate a QR code that can adapt to the cylinder',
long_description=open('README.md', 'r', encoding='utf-8').read(),
author='xxx',
author_email='xxx@qq.com',
url = 'https://pypi.org/project/cqrcode/',
license='MIT', # 与之前你选用的许可证类型有关系
packages=setuptools.find_packages(),
zip_safe=False,
include_package_data=True,
install_requires = [
'Pillow>=6.1.0',
'pyzbar>=0.1.8',
'qrcode>=6.1',
'PySnooper>=0.2.8',
'pretty-errors>=1.2.7',
'matplotlib>=3.0.3',
],
keywords='cylinder qrcode',
classifiers=[
"Natural Language :: Chinese (Simplified)",
"Development Status :: 3 - Alpha",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"License :: OSI Approved :: MIT License",
"Topic :: Utilities"
],
)
7. 准备twine配置文件
该目录下:
新建该脚本:
内容为:
index-servers=pypi
[pypi]
repository = https://upload.pypi.org/legacy/
username: pypi 账户名
password: pypi 账户密码
至此,准备完毕。
准备上传
三条命令:
python setup.py checkpython setup.py sdist bdist_wheeltwine upload dist/*具体演示
Found existing installation: cqrcode 0.13
Uninstalling cqrcode-0.13:
Would remove:
d:\python35\lib\site-packages\cqrcode-0.13.dist-info\*
d:\python35\lib\site-packages\cqrcode\*
Would not remove (might be manually added):
d:\python35\lib\site-packages\cqrcode\static\0二维码填充效果.png
d:\python35\lib\site-packages\cqrcode\static\0二维码识别掩码.png
d:\python35\lib\site-packages\cqrcode\static\0二维码识别模板.png
d:\python35\lib\site-packages\cqrcode\static\0填充结果.png
d:\python35\lib\site-packages\cqrcode\static\0扩展图片.png
d:\python35\lib\site-packages\cqrcode\static\_input.txt
d:\python35\lib\site-packages\cqrcode\static\_白板.png
d:\python35\lib\site-packages\cqrcode\static\overall_.png
d:\python35\lib\site-packages\cqrcode\static\传统二维码.png
Proceed (y/n)? y
Successfully uninstalled cqrcode-0.13
![在这里插入图片描述 python打包上传至pypi —— 具有多个目录的项目工程快速打包上传_python_07](http://img.558idc.com/uploadfile/allimg/python/21095949_62b126159b53c52485.png)
![在这里插入图片描述 python打包上传至pypi —— 具有多个目录的项目工程快速打包上传_python_08](http://img.558idc.com/uploadfile/allimg/python/21095950_62b126160241352789.png)
![在这里插入图片描述 python打包上传至pypi —— 具有多个目录的项目工程快速打包上传_python_09](http://img.558idc.com/uploadfile/allimg/python/21095950_62b126165e7c414760.png)
生成一堆文件:
![在这里插入图片描述 python打包上传至pypi —— 具有多个目录的项目工程快速打包上传_上传_10](http://img.558idc.com/uploadfile/allimg/python/21095950_62b12616ac05a53611.png)
![在这里插入图片描述 python打包上传至pypi —— 具有多个目录的项目工程快速打包上传_上传_11](http://img.558idc.com/uploadfile/allimg/python/21095951_62b126171b57e64559.png)
![在这里插入图片描述 python打包上传至pypi —— 具有多个目录的项目工程快速打包上传_开发语言_12](http://img.558idc.com/uploadfile/allimg/python/21095951_62b126177257062047.png)
上传成功。
![在这里插入图片描述 python打包上传至pypi —— 具有多个目录的项目工程快速打包上传_python_13](http://img.558idc.com/uploadfile/allimg/python/21095952_62b1261808ba717203.png)