欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Python私有pypi源注冊自定義依賴包Windows詳解

 更新時間:2023年11月29日 09:20:53   作者:Junx_fu  
這篇文章主要介紹了Python私有pypi源注冊自定義依賴包Windows,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教

一、pypi 源

1. 進(jìn)入C盤,用戶目錄下,創(chuàng)建.pypirc文件(若報錯沒有文件名,則命名時為 .pypirc. ,保存后即為.pypirc)

2. 配置私有源,上傳庫及用戶名密碼,可配置多個

[distutils]
index-servers =
    nexus, 
    pypi

[nexus]
repository: 
username: 
password: 

[pypi]
username: 
password: 

二、開發(fā)包

2.1開發(fā)包結(jié)構(gòu)

2.1.1 創(chuàng)建一個項(xiàng)目,項(xiàng)目名稱需要為所上傳依賴庫中沒有的名字

2.1.2 文件夾中未具體實(shí)現(xiàn)代碼

2.1.3 __init__.py文件,from .文件名 import *,有幾個文件from幾次

2.1.4 LICENSE,可參考 Choose an open source licenseChoose an open source license | Choose a LicenseChoose an open source license

The MIT License (MIT)
Copyright (c) 2013 Steve Canny, https://github.com/scanny

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.

2.1.5 README.md 項(xiàng)目簡介

2.1.6 setup.py 

import setuptools

setuptools.setup(
    # 項(xiàng)目的名稱
    name="",
    # 項(xiàng)目的版本
    version="0.0.1",
    # 項(xiàng)目的作者
    author="",
    # 作者的郵箱
    author_email="",
    # 項(xiàng)目描述
    description="",
    # 項(xiàng)目的長描述
    long_description="",
    # 以哪種文本格式顯示長描述
    long_description_content_type="text/markdown",  # 所需要的依賴
    install_requires=[
        'pymongo'
    ],
    # 項(xiàng)目中包含的子包,find_packages() 是自動發(fā)現(xiàn)根目錄中的所有的子包。
    packages=setuptools.find_packages(),
    # 其他信息,這里寫了使用 Python3,MIT License許可證,不依賴操作系統(tǒng)。
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ],
)

三、生成包并上傳

3.1生成 dist 目錄

pip install wheel
python setup.py sdist bdist_wheel

生成build、dist、xxx.egg.info

3.2上傳

pip install twine
twine upload dist/* -r nexus(nexus為配置文件中名稱)

 四、安裝

4.1配置臨時源

pip install jcdependency==0.0.1 -i 源 --trusted-host 信任

或

pip install jcdependency==0.0.1 -i 源

4.2配置永久源

進(jìn)入進(jìn)入C盤,用戶目錄下,創(chuàng)建pip文件夾,新增pip.ini

[global]
timeout = 6000
index-url = 源
trusted-host = 信任

 pip install jcdependency==0.0.1

總結(jié)

以上為個人經(jīng)驗(yàn),希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論