博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
upgrade module on pypi
阅读量:5755 次
发布时间:2019-06-18

本文共 2294 字,大约阅读时间需要 7 分钟。

之前写了一篇如何将模块上传到pypi.python.org的文章
如果代码有更新, 如何更新到pypi呢?
例如 : 
首选更新代码
[root@localhost pydigoal]# vi digoal_nester.py """this is commentcomment end"""def print_lol(the_list, ident=False, level=0):  """this is function comment  comment end"""  for each_item in the_list:    if isinstance(each_item, list):      print_lol(each_item, ident, level+1)    else:      if ident:        for tab_stop in range(level):          print("\t", end='')      print(each_item)
然后要更新setup.py, 修改version.
[root@localhost pydigoal]# vi setup.py from distutils.core import setupsetup(    name = 'digoal_nester',    version = '1.2.0',    py_modules = ['digoal_nester'],    author = 'digoal',    author_email = 'digoal@126.com',    url = 'http://blog.163.com/digoal@126',    description = 'a test module by digoal')
使用python setup.py sdist upload上传
[root@localhost pydigoal]# python setup.py sdist uploadrunning sdistrunning checkwarning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list)warning: sdist: standard file not found: should have one of README, README.txtwriting manifest file 'MANIFEST'creating digoal_nester-1.2.0making hard links in digoal_nester-1.2.0...hard linking digoal_nester.py -> digoal_nester-1.2.0hard linking setup.py -> digoal_nester-1.2.0Creating tar archiveremoving 'digoal_nester-1.2.0' (and everything under it)running uploadSubmitting dist/digoal_nester-1.2.0.tar.gz to https://pypi.python.org/pypiServer response (200): OK
上传后可以通过URL搜索到上传的更新模块

本地测试
[root@localhost pydigoal]# python setup.py installrunning installrunning buildrunning build_pycopying digoal_nester.py -> build/librunning install_libcopying build/lib/nester.py -> /usr/local/lib/python3.4/site-packagescopying build/lib/digoal_nester.py -> /usr/local/lib/python3.4/site-packagesbyte-compiling /usr/local/lib/python3.4/site-packages/nester.py to nester.cpython-34.pycbyte-compiling /usr/local/lib/python3.4/site-packages/digoal_nester.py to digoal_nester.cpython-34.pycrunning install_egg_infoWriting /usr/local/lib/python3.4/site-packages/digoal_nester-1.2.0-py3.4.egg-info
本地测试
[root@localhost ~]# vi test.pyimport digoal_nesterl_list = ['hello',['i',['am','digoal']]]digoal_nester.print_lol(l_list,True)[root@localhost ~]# python ./test.pyhello        i                am                digoal

转载地址:http://wunkx.baihongyu.com/

你可能感兴趣的文章
微信分销系统商城营销5大重点
查看>>
求职准备 - 收藏集 - 掘金
查看>>
Linux-Centos启动流程
查看>>
后端技术精选 - 收藏集 - 掘金
查看>>
Ossim下的安全合规管理
查看>>
DelphiWebMVC框架下BPL热部署实现
查看>>
C++与MySQL的冲突
查看>>
siki学习之观察者模式笔记
查看>>
spring.net 继承
查看>>
ES6:模块简单解释
查看>>
JavaScript indexOf() 方法
查看>>
ZJU PAT 1023
查看>>
WMI远程访问问题解决方法
查看>>
Android开发历程_15(AppWidget的使用)
查看>>
阿花宝宝 Java 笔记 之 初识java
查看>>
Linux下的C编程实战
查看>>
[32期] html中部分代码与英语单词关系
查看>>
PHP安装环境,服务器不支持curl_exec的解决办法
查看>>
jQuery|元素遍历
查看>>
用 ThreadLocal 管理用户session
查看>>