python日志简单实现
主要用于pypi学习
基于
nexus3
- 创建
pypi-hosted
仓库
hosted仓库用于存储私有模块 - 创建
pypi-proxy
仓库代理地址不要加
simple
proxy
仓库用于代理外部仓库 - 创建
pypi-group
仓库
应该包括hosted和proxy,主要用于对外统一暴露可以配置到
pip.conf
中,后边需要加simple
- 本地用户目录下增加
~/.pypirc
文件
内容示范:[distutils] index-servers = pypi [pypi] repository:https://pypi.python.org/pypi username:your_username password:your_password
pypi
为自定义上传服务器id
类似maven
中setting.xml
中的server
节点,可以在index-servers
的值后追加,直接换行即可,无需分割符号 - 客户端增加
~/.pip/pip.conf
文件
用于配置私服地址,index-url直接写group仓库地址加simple结尾即可[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple [install] trusted-host = https://pypi.tuna.tsinghua.edu.cn
参考官方文档
- 安装发布工具
python -m pip install setuptools wheel twine
- 构建
python setup.py sdist bdist_wheel
- 上传
twine upload -r pypi dist/*
-r即指明服务器id,可以是
.pypirc
下的任一可用地址,即可发布到远程仓库
- 客户端创建
~/.pip/pip.conf
- 安装
pip install xxx