reference
https://blog.csdn.net/m0_37607365/article/details/79998955
1. First create pypi warehouse
Which, PyPI class service and support in three ways:
proxy, provides agency services
hosted, provide publishing services private package
Multiple services group, a combination of the above two categories together with the provision of external through a URL
First create pypi-proxy, specify the remote storage Ali cloud
http://mirrors.aliyun.com/pypi
Creating pypi-hosted
.Pypirc configuration on the computer
[distutils] index-servers = nexus nexustest # 要选择所建仓库中的hosted仓库 [nexus] repository=http://nexus.fuxi.netease.com:8081/nexus/repository/pypi-hosted/ username=xxx password=xxx [nexustest] repository=http://nexus.fuxi.netease.com:8081/nexus/repository/pypi-hosted/ username=xxx password=xxx
Installation twine
pip install twine
Create a setup.py file in your project, such as this
setup.py file
import sys if sys.version_info < (2, 6): print(sys.stderr, "{}: need Python 2.6 or later.".format(sys.argv[0])) print(sys.stderr, "Your Python is {}".format(sys.version)) sys.exit(1) from setuptools import setup, find_packages setup( name="xxxxxxxx", version="1.0", license="BSD", description="A python library adding a json log formatter", package_dir={'': 'src'}, packages=find_packages("src", exclude="tests"), install_requires=["setuptools", "thrift==0.10.0", "requests >= 2.13.0", "urllib3 >= 1.25.3"], classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.1', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Topic :: System :: Logging', ] )
installation
python setup.py install
Generating a compressed packet
python setup.py sdist
Upload nexus, nexus which is the configuration file in .pypirc
twine upload -r nexus dist/*
use