传统的项目文件每次上传都需要进行一次git拉取下来再进行安装,在朋友的指导下决定将相应的python项目发布到pypi上让用户使用pip直接安装
一.项目结构参考
二.具体步骤参考
1.注册用户
https
://pypi
.org
/account
/register
/
2.安装twine依赖
pip install twine
3.创建setup.py文件
from setuptools
import setup
, find_packages
import pathlib
here
= pathlib
.Path
(__file__
).parent
.resolve
()
long_description
= (here
/ 'README.md').read_text
(encoding
='utf-8')
setup
(
name
="hbase-thrift-py-sdk",
version
="2.0.0",
license
='MIT',
description
='Use elaticsearch to search hbase',
url
='http://gitlab.weyesns.com/jcsp/library/hbase-thrift-py-sdk',
long_description
=long_description
,
long_description_content_type
='text/markdown',
packages
=find_packages
(),
package_data
={
'hbase_thrift': ['Hbase.thrift']},
data_files
=[('.', ['README.md', 'requirements.txt'])
],
include_package_data
=True,
platforms
='any',
)
4.创建setup.cfg文件
[metadata
]
license_files
= LICENSE
.txt
5.创建MANIFEST.in文件
include test
.py
include LICENSE
.txt
6.创建许可证LICENSE.txt文件
MIT License
Copyright
(c
) [2020] [Cocktail_py
]
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
.
7.打包项目
pip install wheel
python setup
.py bdist_wheel
--universal
8.发布项目
twine upload dist
/*
参考官网
利用es实现的hbase二级索引作品