Skip to content

pipdeptree workaround effort #1100

@stonebig

Description

@stonebig

"pip inspect" retunrs json presentation od the distribution

json past work
#850

def get_official_description(name):
    """Extract package Summary description from pypi.org"""
    from winpython import utils
    this = normalize(name)
    this_len = len(this)
    pip_ask = ['pip', 'search', this, '--retries', '0']
    if len(this)<2:  # don't ask stupid things
        return ''
    try:
        #  .run work when .popen fails when no internet
        pip_res = (utils.exec_run_cmd(pip_ask)+'\n').splitlines()
        pip_filter = [l for l in pip_res if this + " (" ==
                      normalize(l[:this_len])+l[this_len:this_len+2]]
        pip_desc = (pip_filter[0][len(this)+1:]).split(" - ", 1)[1] 
        return pip_desc.replace("://", " ")
    except:
        return ''

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions