This article only describes the process of uploading to test.pypi.org. If you want to upload to the official pypi.org, you only need to register an official account. Once the release is successful, you can use the pip install [your-package] command to install it.
1. The project directory is as follows
protocol_package
└── huitu_iot_protocol_rule
└── __init__.py
└── xxx.py
└── README.md
└── setup.py
2. The setup.py file is as follows
# -*- coding: utf-8 -*-
"""
File Name setup.py
Created on 2020/05/01
@author: gw
"""
from setuptools import setup
setup(
name='huitu_iot_protocol_rule', # 项目名称,保证它的唯一性,不要跟已存在的包名冲突即可
version='1.0.0', # 版本
description='协议规约', # 项目的简单描述
author='gw', # 作者
author_email='[email protected]', # 邮箱
url='http://xx.xx.xx.xx:xxxx', # 项目地址
packages=['huitu_iot_protocol_rule'],
)
3. Project packaging
python2.7 setup.py sdist bdist_wheel
4. Upload to Test PyPI
python2.7 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
5. Installation
5.1. Install with tar package in the dist folder
pip2.7 install huitu_iot_protocol_rule-1.0.0.tar.gz
5.2, install from Test PyPI
pip2.7 install -i https://test.pypi.org/simple/ --no-deps huitu_iot_protocol_rule==1.0.0