zoukankan      html  css  js  c++  java
  • Nexus上传python包

    参考

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

    1.首先创建pypi仓库

    其中,PyPI类的服务,支持三种:     

    proxy,提供代理服务

    hosted,提供私有包的发布服务

    group,组合以上两类的多个服务到一起,通过同一个URL对外提供

    首先创建pypi-proxy,指定remote storage为阿里云

    http://mirrors.aliyun.com/pypi
    

     

    创建pypi-hosted

    创建pypi-group

     在电脑上配置 .pypirc

    [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
    
  • 相关阅读:
    Laravel update某一字段值为另一字段值
    Layui 批量
    CI 框架多表关联查询
    PHP数组函数
    PHP固定长度字符串
    PHP常用方法汇总
    CI 框架批量添加数据(如果数据库有就更新数据)
    使用nginx-http-concat优化网站响应
    mysql自动化安装
    SQL迁移到ORACLE实例
  • 原文地址:https://www.cnblogs.com/tonglin0325/p/11613966.html
Copyright © 2011-2022 走看看