zoukankan      html  css  js  c++  java
  • Python 上传和更新函数模块到PyPI

    1. update setup.py

    from distutils.core import setup
    
    setup(
            name        = 'iamericnester',
            version     = '1.4.0',
            py_modules  = ['nester'],
            author      = 'eric',
            author_email= 'eric@126.com',
            url         = 'http://126.com',
            description = 'a simple nested lists,fix the bug',
    
        )
    

    2. update nester.py

    """this is a new fuction, which work for a list"""
    def print_lol(the_list,indent=False,level=0):
        """ one arguement is the_list"""
        for each_item in the_list:
            if isinstance(each_item,list):
                print_lol(each_item,indent,level+1)
            else:
                if indent:
                        for tab_stop in range(level):
                            print("	",end='')
                print(each_item)
    

    3. install new version moudle to local

    C:UsersericDocumentsPython
    ester>c:UsersericAppDataLocalProgramsPythonPython35-32python.exe setup.py install
    running install
    running build
    running build_py
    running install_lib
    running install_egg_info
    Writing c:UsersericAppDataLocalProgramsPythonPython35-32Libsite-packagesiamericnester-1.4.0-py3.5.egg-info
    

    4. upload new version moudle to PyPI

    C:UsersericDocumentsPython
    ester>c:UsersericAppDataLocalProgramsPythonPython35-32python.exe setup.py sdist upload
    running sdist
    running check
    warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list)
    
    warning: sdist: standard file not found: should have one of README, README.txt
    
    writing manifest file 'MANIFEST'
    creating iamericnester-1.4.0
    making hard links in iamericnester-1.4.0...
    hard linking nester.py -> iamericnester-1.4.0
    hard linking setup.py -> iamericnester-1.4.0
    creating 'distiamericnester-1.4.0.zip' and adding 'iamericnester-1.4.0' to it
    adding 'iamericnester-1.4.0
    ester.py'
    adding 'iamericnester-1.4.0PKG-INFO'
    adding 'iamericnester-1.4.0setup.py'
    removing 'iamericnester-1.4.0' (and everything under it)
    running upload
    Submitting distiamericnester-1.4.0.zip to https://pypi.python.org/pypi
    

    5. test new moudle code

    ========== RESTART: C:UsersericDocumentsPython
    ester
    ester.py ==========
    >>> import nester
    >>> names = ['john','eric',['david','bob']]
    >>> nester.print_lol(names)
    john
    eric
    david
    bob
    >>> nester.print_lol(names,True)
    john
    eric
    	david
    	bob
    >>> nester.print_lol(names,True,3)
    			john
    			eric
    				david
    				bob
    >>> 
    
  • 相关阅读:
    wqy的ACM赛G朱柏庐
    可持久化数据结构
    LibreOJ#2362蚯蚓
    LibreOJ#2359天天爱跑步
    「Luogu2221」[HAOI2012]高速公路
    「Luogu4158」[SCOI2009]粉刷匠
    「Luogu4317」花神的数论题
    WC2019 游记
    最大权闭合子图模型
    「Luogu2762」太空飞行计划问题
  • 原文地址:https://www.cnblogs.com/oskb/p/4817376.html
Copyright © 2011-2022 走看看