Nexus上傳python包

參考python

https://blog.csdn.net/m0_37607365/article/details/79998955

1.首先建立pypi倉庫json

 

 

其中,PyPI類的服務,支持三種:     bash

proxy,提供代理服務ui

hosted,提供私有包的發佈服務阿里雲

group,組合以上兩類的多個服務到一塊兒,經過同一個URL對外提供url

首先建立pypi-proxy,指定remote storage爲阿里雲.net

http://mirrors.aliyun.com/pypi

 

 

建立pypi-hosted3d

建立pypi-group代理

 

 在電腦上配置 .pypircorm

[distutils]
index-servers =
    nexus
    nexustest

# 要選擇所建倉庫中的hosted倉庫
[nexus]
repository=http://xxx.com:8081/nexus/repository/pypi-hosted/
username=xxx
password=xxx

[nexustest]
repository=http://xxx.com:8081/nexus/repository/pypi-hosted/
username=xxx
password=xxx

安裝twine

pip install twine

在你的工程中建立一個setup.py文件,好比這樣

 

setup.py文件

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',
    ]
)

安裝

python setup.py install

生成壓縮包

python setup.py sdist

上傳nexus,其中nexus就是在.pypirc文件中配置

twine upload -r nexus dist/*

使用

pip install -i http://ip:8081/nexus/repository/pypi-group/simple --trusted-host=ip xxxx==1.0.0
相關文章
相關標籤/搜索